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.
191 questions
2
votes
0
answers
94
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 ...
1
vote
0
answers
179
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 ...
16
votes
2
answers
795
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 ...
12
votes
1
answer
752
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 ...
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 ...
1
vote
2
answers
247
views
How to fix same side corners?
How do fix this? All other sides are fixed
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 ...
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 ...
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 ...
-2
votes
1
answer
296
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 ...
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(...
5
votes
1
answer
375
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 ...
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
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,...
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 ...
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 ...
0
votes
1
answer
286
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 ...
16
votes
1
answer
924
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 ...
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 ...
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-...
10
votes
2
answers
935
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 ...
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 ...
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 ...
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
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$ $\...