Questions tagged [algorithm]
A puzzle related to algorithms (a main concept in computer science). Puzzles may ask for an algorithm as an answer or require the analysis of a given algorithm.
192 questions
5
votes
0
answers
159
views
What is the optimum strategy for a logic word puzzle?
I’ve made a small browser puzzle called Codextri where you have to identify a hidden set of three letters by guessing words. Each guess returns a score based on how many of those hidden letters your ...
2
votes
0
answers
99
views
Is there a Python solver for the Picture-Cube?
I'm working on a CayleyPy project where we study the diameters of graphs that come from different combinatorial puzzles. At the moment I’m focusing on the Picture-Cube, a 3×3×3 puzzle where each move ...
3
votes
0
answers
124
views
Does Python Megaminx Solver exist?
I'm working on a CayleyPy project. We study the diameters of various graphs. These graphs are often associated with physical puzzles. One of these puzzles is Megmainx.
To test various hypotheses, I ...
1
vote
0
answers
182
views
Diamond-Shaped Light Out Game
The diamond-shaped Light Out game refers to a Light Out variant with a diamond-shaped grid, characterized by the following structural properties:
Total number of rows/columns: $2k+1$ rows (where k is ...
7
votes
2
answers
449
views
Lights Out Game with "Only Dark Cells Pressable" Rule
On an m × n grid, pressing a cell flips the state (turning a lit cell dark and a dark cell lit) of that cell and its four adjacent cells (the cells above, below, to the left, and to the right). ...
16
votes
2
answers
800
views
Moving water by repeated equilibration
There are 100 full water tanks and 100 empty ones. You are given a hose that can connect any two of them in order to equilibrate the water level between them. All the tanks are cubical in shape, of ...
3
votes
0
answers
249
views
Are block based puzzle games NP hard? [closed]
I’ve become interested in puzzle games that combine traditional Sokoban mechanics (box pushing) with shortest-path optimization—specifically puzzles where your objective isn’t merely to reach a goal ...
12
votes
1
answer
757
views
Missing postage stamp collectors' item.
A postage stamp collector, once, bought a, supposedly complete, rare set of original postage stamps laid out 5x6.
Each item in the set features a unique, rather peculiar, 5x6 pixel artwork.
One day ...
12
votes
2
answers
840
views
Cards are shuffled twice. What was the order of the cards after the first shuffle?
A card shuffling machine always rearranges cards in the same way relative to the order in which they are given to it. The thirteen spades arranged in the order
A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K
...
1
vote
3
answers
393
views
Rocks collection puzzle
This puzzle has a flavor of Hamiltonian puzzles. You are given a set of N rocks placed on a two-dimensional integer grid. The task is to find an orthogonal closed simple path with N orthogonal line ...
3
votes
4
answers
438
views
Guessing the correct combination for a certain weight without knowing the weight of each item
Problem: You are given N items.
You need to figure out what combination of these objects gives a certain unknown target weight. You do not know the target weight and the weight of each item.
Each time ...
1
vote
2
answers
253
views
How to fix same side corners?
How do fix this? All other sides are fixed
3
votes
0
answers
254
views
Worst peg solitaire game
I wonder if there is an algorithm for the worst game to keep as many pegs as possible.
I tried to search for "peg solitaire worst score/ max leave" etc, but it’s not quite that.
The question ...
1
vote
1
answer
173
views
What is the CMLL Algorithm that fits this particular case?
I implemented the CFOP method in my Rubik's cube solver. Now I am trying to add the Roux method. I couldn't find the right CMLL algorithm for this particular case.
After consulting the CMLL algorithms ...
5
votes
1
answer
473
views
Dishonest dungeon staff
You are faced with the difficult task to set up a dungeon for adventurers. However you made a deal with the guild: any adventurer brave enough to beat the dungeon and reach the treasure room will be ...
17
votes
4
answers
3k
views
Magic: the Gathering – Scry-sort
Let me start with a formulation of the problem for people who aren't familiar with Magic: the Gathering.
You have a stack of distinct cards face-down. You can apply the following actions arbitrarily ...
9
votes
3
answers
1k
views
Minimum number of flips needed to fully set a binary string
Source: My school teacher, it was just given as a problem statement.
Problem: You are given a binary sequence $S$ of up to $10^6$ bits. You wish to set all the bits in the string to $1$, but the catch ...
13
votes
1
answer
1k
views
1+3 Towers of Hanoi
There are four pegs in a row; let's call them A, B, C, and D from left to right. Peg A has a stack of $n$ differently sized disks, sorted in size so the smallest disk is at the top. All other pegs are ...
0
votes
0
answers
125
views
Heuristic function for estimating nurikabe puzzle state
I am trying to write a program for solving nurikabe puzzle. I need a method to approximately represent the state of the game in one number, to choose the best way for the algorithm to continue. I can'...
-2
votes
1
answer
299
views
Deciding whether a set of points on a 2D plane has axial symmetry [closed]
The problem to solve:
Let's say we have a set of $n$ points on the 2D plane. Determine whether it has axial symmetry.
My attempt so far:
For n=2 the answer is trivially "yes". For n=3 ...
2
votes
1
answer
334
views
stuck at robozzle 1251
Can anyone help me solve this robozzle? It is called bigPlus id 1251
http://www.robozzle.com/puzzle.aspx?id=1251
7
votes
3
answers
910
views
Longest Fibonacci word [closed]
Fibonacci words are defined as $F_0 = a, F_1 = b, F_{n+2} = F_nF_{n+1}$ where $a, b$ are letters. How can you find the longest Fibonacci sub-word in a given string?
Try to solve it in linear time ($O(...
1
vote
1
answer
380
views
Reversing a binary string with a restricted Turing Machine
Some malevolent entity (me) asks you to construct a Turing Machine which, given an input on its tape of the form $LbR$ where $b$ is some binary string, changes this to $Lb^{-1}R$ then halts (where $b^{...
5
votes
1
answer
378
views
Nuts and screws
Imagine that you are given a box with n nuts and n screws. Each screw have different size (diameter) and on each screw there is ...
6
votes
1
answer
722
views
Cable with mixed wires
Let's say you have a cable that has n wires. Each wire on the left side corresponds to one wire on the right side. However you cannot distinguish between the wires ...
2
votes
1
answer
1k
views
Solving Robozzle puzzle
I have a problem with solving the "Dispersion V2" puzzle on robozzle.com:
The puzzle has a robot that can be moved and turned with a program. The goal of the puzzle is to have the robot ...
1
vote
1
answer
1k
views
Help with solving 7x7 sub-centers inside 11x11x11 Rubik's cube -- errors in guide book
[companion question here]
I was given an 11x11x11 Rubik's cube as a gift. It came with a guide book that I have been following to solve the cube.
After solving four of the 9x9 sub-centers of the cube,...
1
vote
1
answer
272
views
Help with solving 5x5 sub-centers inside 11x11x11 Rubik's cube -- errors in guide book
[companion question here]
I was given an 11x11x11 Rubik's cube as a gift. It came with a guide book that I have been following to solve the cube.
I have solved four of the 9x9 sub-centers of the cube,...
1
vote
1
answer
254
views
Panini Linguistics Olympiad: Genes from Space
Problem:
Alien Protein Codes
Dr. Muzabique figured out how to manipulate six alien proteins to do three functions: construct, cut, and pack. The alien genetic code used to manipulate the proteins was ...
17
votes
17
answers
2k
views
The dessert problem (blind ballot remaining blind if non-unanimous) [closed]
A group of (possibly over-polite) people have just finished their meal at a restaurant. One of them asks, "Does anyone want dessert?" The table goes quiet.
Some of the people might want ...
3
votes
1
answer
206
views
Which sentences in S := {"the number of lies in S is a multiple of n" | n = 1,...,120} are true in every possible non-contradictory case?
Consider the set
$S := \{$ "the number of lies in the set $S$ is a multiple of $n$" $|$ $n = 1, 2, 3, ... , 120 \}$.
Question: Which elements/sentences in the set $S$ are true in every ...
1
vote
1
answer
369
views
Mastermind algorithm but for unique colors only
I have seen Donald Knuth's Algorithm to guess the correct pattern in maximum 5 tries. However, I want to write a program to find the correct pattern effectively however the code maker can only make a ...
5
votes
1
answer
3k
views
Orientate the centers of a Master Pyraminx (Pyraminx 4x4)
I have a very strange state on my 4x4 Pyraminx. The green side is solved and the other sides are almost solved, the problem is, on these 3 remaining sides the centers are not solved. The state looks ...
0
votes
1
answer
288
views
General Fake Coin: k fake coins out of n coins
Considering a general fake coin problem. There are $n$ coins in total and $k$ of them are fake. Fake coins are lighter than the normal ones. You only have a balance to compare two groups of coins (no ...
8
votes
1
answer
308
views
O princess, where art thou?
In the highest tower of her castle, a princess has N bedrooms which are arranged in a circle. She never sleeps in the same room on two consecutive days. Every morning she moves to another room by ...
16
votes
1
answer
932
views
Exterminating blobs on a grid
On an infinite square grid, some of the squares are occupied by little creatures called blobs. Cute as they are, it is your mission to exterminate all of them! You only have two methods at your ...
30
votes
12
answers
15k
views
What's the optimal strategy for Wordle?
Wordle is a game by Josh Wardle in which you try to guess a 5-letter word in at most six attempts. After each guess, the letters which are not in the word are highlighted in grey, the letters which ...
2
votes
1
answer
358
views
How can the princess escape the prince?
This is the story of the sister of the princess in this puzzle. I will shamelessly copy-paste some parts of this post. I have no reference to give for this version as I adapted a Computer Science ...
5
votes
4
answers
746
views
Algorithm to make two scrambled Rubik's cubes be exactly the same on all faces
There are millions of Rubik's cube combinations possible. If I have two 3×3 Rubik's cubes and both are scrambled, I want to make one scrambled cube exactly the same as the other without solving them. ...
4
votes
1
answer
192
views
Copy that solution
This copy machine program prints
the solution to a well-known puzzle.
Explanation of the syntax will follow.
What solution will be printed for which
well-known puzzle?
EXECUTION CODE
.--> LoopA-...
2
votes
1
answer
1k
views
Find the hidden message in... this grid
(So I made this puzzle, and I wanted it to be fun rather than difficult! I hope it’s original enough)
Given a 5x5 grid as input, here’s an algorithm:
randomly select any 3x3 grid within the 5x5 grid
...
10
votes
2
answers
937
views
Two dimensional Mastermind
You have probably played the classic game of Mastermind with 4 pegs and 6 colours. It turns out that the codebreaker can always find the pattern in 5 moves or fewer.
Now consider the 2D version of the ...
12
votes
1
answer
858
views
Transform each square of a chessboard to zero
Each square of an 8x8 chessboard is marked with a positive integer.
The integers can be changed according to the following two rules:
(1) all integers in a row are doubled
(2) all integers in a column ...
5
votes
2
answers
295
views
All possible locations of a robot going from $(x,y)$ to $(x+y, y)$ or $(x,x+y)$ [closed]
Suppose I had a little robot on the coordinate grid that moves according to the following rule. If it's at the point $(x,y)$, it can move to either $(x+y,y)$ or $(x,x+y)$. If the robot starts at the ...
1
vote
1
answer
220
views
Reverse Engineer Chess Software Calculations
TLDR Just the Puzzle
Given a number n and a weight w the function f will result in a weighted number r as follows.
f(n, w) = r
n can be a number from 0 to 200
w can be a number from -100 to 100 (...
4
votes
0
answers
73
views
Find the strategy: How to order without knowing [duplicate]
Imagine: You have a group of people in a room that is completely dark. Half of the group has red t-shirts and the other half blue t-shirts. The group gets told to think about a strategy to solve the ...
-4
votes
1
answer
156
views
A simple two-operation calculator. How to obtain any natural number from any other?
Imagine that you possess a very simple electronic calculator. It has a screen and ten buttons from 0 to 9 to enter natural decimal numbers (positive integers). However, it can perform just two unary ...
2
votes
1
answer
340
views
Is it possible to solve the Cube in a Cube in a Cube in a Cube state using its own algorithm on a 4x4?
So, I got curious if I could solve from the cube in a cube in a cube in a cube position to the solved state just using its own algorithm. This is the one I was using:
B' 2R2 2L2 U2 2R2 2L2 B F2 R U' ...
4
votes
0
answers
8k
views
The New York Time's "Letter Boxed" Puzzle (spoiler)
WARNING: I solved this puzzle and posted a solution below. I'm posting this more for muse.
Hello! I don't know if anyone's enjoyed this puzzle on The New York Times website, but I find it rather fun. ...
4
votes
1
answer
215
views
Constant puzzle
A constant is hiding behind this puzzle, can you tell which?
4 $\rightarrow$ 2 $\rightarrow$ 1 $\rightarrow$ 1 $\rightarrow$ 1 $\rightarrow$ $\dots$
? $\rightarrow$ ? $\rightarrow$ ? $\rightarrow$ $\...