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.

Filter by
Sorted by
Tagged with
14
votes
7answers
4k 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 ...
5
votes
4answers
336 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. ...
1
vote
1answer
158 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 ...
24
votes
3answers
9k views

A general solution to the decanting problem? (aka jug-pouring, water-pouring)

Take a look at these two questions: - A Set of Water Jug Challenges - Pouring problem Now I'm asking for a generalised solution to that problem. I define the problem as follows: You are required ...
7
votes
3answers
544 views

Algorithm for creating a "Dot" logic maze

I've been looking at Robert Abbott's logic mazes, in particular his Dot maze, and I'm trying to understand how they can be constructed so I can write an algorithm to do this automatically for ...
1
vote
2answers
328 views

Scheduling Meetings

I came across this problem in real life and thought it could be made into an interesting puzzle. I will enjoy seeing how my eventual solution could be improved! Here's the situation. There ...
4
votes
1answer
114 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 .--> ...
7
votes
1answer
315 views

$4\times4\times4$ Rubiks cube Top Layer Issue

The only way i am able to solve is to jumble the whole cube again. If you know the way to solve pls give images or algorithm.
4
votes
1answer
3k views

Rubiks Cube 4x4x4 Top Layer Issue - One Edge Pair Flipped

I have trouble with that edge. Please give algorithm or images for solutions for turning it up so that I can form a cross.
1
vote
1answer
170 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 ...
9
votes
1answer
676 views

Cube Scrambling

Take a normal 3x3 rubiks cube (the Classic unmodded cube). I know the WCA method for scrambling is to pick a random (valid) cube state and calculate a sequence of moves to go from solved to that state,...
11
votes
1answer
2k views

Worst way to solve Rubik's in one algorithm

If you apply the same algorithm over and over again the cube will be solved. I want to know what algorithm is the worst one (the one with the longest cycle) I have found RU (cycle of 60 times) I have ...
5
votes
1answer
304 views

Brute-force solver for Gear Octahedron - flawed method?

I am working on a program to brute-force a LanLan Gear Octahedron I bought second-hand (and scrambled). I have no background in "cubing" and just fancied solving the problem. The structure comprises ...
2
votes
1answer
179 views

Looking for an old Rubiks cube algorithm

I learnt rubiks cube before the YouTube days from a blog. I do not find the algorithm anymore online but it is something like White cross White corners (except one) Second layer corners (except one) ...
3
votes
1answer
151 views

Reapply *some* stickers on scrambled cube

I have this weird cube which have some pieces printed on the plastic and some are detachable. The cube was scrambled not solved and it fell on the floor being cheap cube almost all detachable faces ...
4
votes
2answers
888 views

Oriented Rubiks Cube 4x4 re-arrange center pieces

There are a lot solutions for oriented 3x3. They rotate all center pieces. I'm trying to solve oriented 4x4 with GabbasSoft Cube Demo. Luckily blue and green ...
2
votes
1answer
755 views

What is the next method after 3-style in 3x3 Blindfolded? [closed]

I have been using the method 3-style for over 2 years, 3-style and I have settled in the range of 25-30 seconds. I wish to permanently become sub-20, and for that I am planning to undertake the uphill ...
4
votes
1answer
325 views

How to discover twisty puzzle algorithms that are not commutators?

I am reasonably competent at using commutators to find my own algorithms on twisty puzzles. Many good tutorials for this exist online. However, there are also algorithms that are not commutators, ...
5
votes
1answer
15k views

Programmatically solving a math puzzle with four unknowns and four equations

I have this puzzle and I want to solve by code. I wrote simple code trying to brute force but it fail in one condition https://dotnetfiddle.net/cJyu3w How can I solve such problems?
10
votes
2answers
649 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
1answer
755 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 ...
11
votes
4answers
6k views

How do I memorize parity algorithms for higher-order Rubik's cubes?

I know how to solve a Rubik $4\times4\times4$ or $5\times5\times5$ or bigger, but I have problem with a specific algorithm: the parity error. What's the shortest parity algorithm for $n\times n\times ...
13
votes
2answers
2k views

Three knights searching for a princess in a castle

There is a castle with rooms arranged in a 4x4 square grid. The princess living in the castle sleeps in a different room each night, but always one adjacent to the one in which she slept in the ...
4
votes
2answers
258 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
1answer
119 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 (...
12
votes
3answers
1k views

Find Local Maximum in an Integer Sequence

An element of an integer sequence is called a local maximum if it is not smaller than all its neighbors. E.g., all local maximums of the following sequence are bolded. 3, * 4 *, 2, 1, * 3 *, 2, * 8 *, ...
3
votes
1answer
577 views

How do I solve this F2L case quickly?

I have been unable to find a solution for this F2L case. It takes about 3 seconds to do, and I do it really slowly. Basically, the F2L case is solved, but the edge is inverted. The way I do it right ...
20
votes
4answers
3k views

Checkerboard Infection

There is a dangerous bacteria, Checkerichia Coli, (or C. Coli for short) which lives in the squares of checkerboards. Squares with this bacteria living in their digestive systems are said to have &...
4
votes
0answers
69 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
1answer
118 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 ...
9
votes
1answer
660 views

Puzzles like Sokoban?

I am looking for some puzzles like Sokoban or 15-puzzle but more difficult to solve and satisfy the following requirements: The number of possible moves at each step should be limited, let's say < ...
2
votes
1answer
134 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' ...
3
votes
0answers
216 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
1answer
153 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$ $\...
7
votes
0answers
179 views

Rolling dice in a box

A box containing identical dice that were arranged to have same orientation has a missing die at the center (see figure). The dice moves to the free space for they can change orientation and ...
12
votes
1answer
374 views

Infection (Information Dissemination) Puzzle

There are 2020 people in a room. One person has COVID. After each minute, each person $\mathrm{P}$ is paired with some other person $\mathrm{Q}$ who was never paired with $\mathrm{P}$ before, and they ...
1
vote
1answer
115 views

Minimise battle time in Monster's Den

So there is this excellent flash game, Monster's Den. In order to make a high score, I must complete many battles..this question is about battles with the Legendary Monsters. The target is to reduce ...
8
votes
5answers
2k views

Minimum cells to fill grid without consecutive neighbours

Imagine you have a m x n grid which is initially colored white. you can fill in a cell with black color if and only if there are no immediately neighboring black cells (no black cells to the left/...
14
votes
6answers
2k views

Radioactive Rods

You have 8 identical looking rods, 2 of which are radioactive, though you don't know which. You also have a box which can test for radioactivity, which can hold any number of rods. After the test, the ...
2
votes
1answer
277 views

A robot moving on a grid

In the spirit the question I propose the puzzle: A robot is placed on a vertex of a grid. At each move the robot must take three steps along the edge of the grid. After each step the robot must turn ...
3
votes
1answer
1k views

A robot visiting every edge of a 4x4 grid

This is a harder version of this puzzle: A robot visiting every edge of a 3x3 grid A robot is placed on the top-left vertex of a 4x4 grid. At each move the robot can take one step (up, down, left or ...
2
votes
1answer
3k views

A robot visiting every edge of a 3x3 grid

A robot is placed on the top-left vertex of a 3x3 grid. At each move the robot can take one step (up, down, left or right) along the edge of the grid to the adjacent vertex, but he cannot go outside ...
24
votes
1answer
3k views

Is there an algorithm to decide that the nonogram puzzle is unique

A good nonogram puzzle has a unique solution. However, some nonograms do not. For example, this puzzle: ...
2
votes
2answers
265 views

Missing number in a set of four segment circles

This is a puzzle posted on a social networking site that I have been trying hard since yesterday to solve: My approach has been to find out a mathematical function with the numbers in the yellow, ...
2
votes
1answer
217 views

Based on 9-trains puzzle

Based on this problem, we have got some algorithms that can sort the 9 train cars in a given specific arrangement. But say if the 9 train cars are given in any-arrangement? Say ABC ABC ABC ...
3
votes
1answer
133 views

demystify and paint me!

To demystify me, look and say. Then paint me not with colors but with array. ...
13
votes
1answer
545 views

GameDev: stuck with first puzzle design, would love resources to study from or algorithm suggestions!

First time posting here and I'm really, really hoping this is the community I've been looking for. I'm developing a game, right now I'm in the middle of designing levels as the core mechanics have ...
6
votes
1answer
145 views

Has Connect Four been solved on arbitrary board sizes?

Victor Allis in his program VICTOR used his algorithm for six by seven connect four, his algorithm has proven to give a sure win. Is it possible to have similar algorithm for x by y board?
4
votes
1answer
226 views

Cutting a Rectangular Board

There is an $m \times n$ rectangular board drawn on a graph paper. You need to cut it into $mn$ $1 \times 1$ squares by straight cuts along the grid lines. You are allowed to stack several pieces ...
9
votes
5answers
269 views

An $n$-sided polygon with area $n$

Here is a $10$-sided polygon which area is $23$ (i.e. it contains exactly 23 unit squares). Can you draw a polygon with: $6$ sides and area $6$? $8$ sides and area $8$? $12$ sides and area $12$? ...