Questions tagged [puzzle-solver]

Use this tag if your challenge is about writing programs that solve puzzles such as Sudoku, Rubik's Cube, Crossword puzzles, etc.

Filter by
Sorted by
Tagged with
39
votes
5answers
6k views

Solve the eight queens problem at compile-time [closed]

Can you solve the eight queens puzzle at compile-time? Pick any suitable output format. I'm particularly interested in a C++ template metaprogramming solution, but you can use languages that have ...
39
votes
3answers
1k views

Solve this Alcazar for me

Recently I've been playing a game called Alcazar. It is a board puzzle game where your goal is to enter from one door, pass through all squares, and exit through another door. The only rules are: ...
38
votes
3answers
24k views

Solve Rubik's cube

Write the shortest program that solves Rubik's cube (3*3*3) within a reasonable amount of time and moves (say, max. 5 seconds on your machine and less than 1000 moves). The input is in the format: <...
35
votes
6answers
2k views

Solve the chromatic puzzle

Over at our friends at Puzzling.SE, the following puzzle was posted: Is this chromatic puzzle always solvable? by Edgar G. You can play it here. Puzzle explanation Given a ...
35
votes
7answers
2k views

A Tiny Explorer

You are an explorer, mapping an unknown world. Your ship is carried on the wind. Where it goes, who knows? Each day, in your spyglass, you see features to the north, south, east and west. You always ...
34
votes
17answers
5k views

Create a Flood Paint AI

In the game of Flood Paint, the goal of the game is to get the entire board to be the same colour in as few turns as possible. The game starts with a board that looks something like this: ...
34
votes
0answers
3k views

Rubik's Revenge [closed]

Everyone likes a good puzzle. After all, that's the basis for Code Golf and Code Challenge! What better puzzle exists than the famous Rubik's Cube? Well what else but her slightly larger sister, ...
33
votes
8answers
6k views

Cut the gold chain

A traveler needs to stay for n days in a hotel outside town. He is out of cash and his credit card is expired. But he has a gold chain with n links. The rule in this hotel is that residents should ...
30
votes
11answers
11k views

The fastest Sudoku solver

Winner found It seems as if we have a winner! Unless anyone plans on contesting the world's current fastest Sudoku solver, user 53x15 wins with the staggeringly fast solver Tdoku. For anyone still ...
27
votes
4answers
3k views

Implement a Non-Guessing Sudoku Solver

Implement the shortest Sudoku solver. Sudoku Puzzle: ...
25
votes
2answers
2k views

Nonogram line brute-force solving

Background Nonogram, also known as Picross or Griddlers, is a puzzle where the objective is to determine if each cell on the 2D grid should be colored or left blank, using the numbers of consecutive ...
25
votes
3answers
20k views

Solve the 15 Puzzle (the tile-sliding puzzle)

The 15 Puzzle is a famous puzzle involving sliding 15 tiles around on a 4x4 grid. Starting from a random configuration, the goal is to arrange the tiles in the correct order. Here is an example of a ...
24
votes
13answers
1k views

1D monochrome Link-a-Pix solvability

Background Link-a-Pix is a puzzle on a rectangular grid, where the objective is to reveal the hidden pixel art by the following rules: Connect two cells with number N with a line spanning N cells, so ...
23
votes
1answer
2k views

Solve Grid-Tangram

The Tangram is a dissection puzzle made from seven shapes: Five differently sized triangles, a parallelogram and a square. Given a shape, the goal is recreating the shape using all the pieces and ...
23
votes
2answers
548 views

Water held in a hexagonal rod scuplture

I have bunch of hexagonal rods glued together into an odd sculpture. The rods are 1 to 99 centimetres (cm) long and 1 square cm in cross-section area. All rods are glued on a hexagonal face to at ...
22
votes
13answers
5k views

Implement a Brute Force Sudoku Solver

Implement the shortest Sudoku solver using guessing. Since I have received a few request I have added this as an alternative question for those wishing to implement a brute force sudoku solver. ...
22
votes
2answers
421 views

A Peak Experience: Quickly Visit All the Peaks

I am standing at point (0,0) in a H x W map where the altitude is represented by digits, for ...
21
votes
6answers
3k views

Can you beat the British Intelligence? (Nonogram Solver)

It is time to embark on a perilous quest to defeat the British Intelligence. The aim of this challenge is to write the shortest code that will solve a Nonogram. What is a Nonogram? The rules are ...
21
votes
1answer
4k views

Fillomino Solver

Fillomino is a puzzle where you fill a grid with polyominoes. Each polyomino is an area of contiguous cells. The grid representation shows what size polyomino is covering each cell. For example, a ...
20
votes
4answers
2k views

Build a pair of spies that will throw stones into a river

Recently at the newly released Puzzling.SE, there was a problem about spies throwing stones into a river that was actually quite challenging: Two spies must pass each other two secret numbers (one ...
19
votes
3answers
1k views

Stringing a Pearl Necklace

Overview Pearls (or Masyu) is a logic game played on a grid. There are black and white pearls placed on the grid. The object is to form a single, closed loop that travels through each pearl using only ...
19
votes
1answer
2k views

Shortest 2-Player Game of Halma

In Chess, it's possible for the game to end after 4 moves (2 each) with a Fool's Mate. Your goal is to find the Fool's Mate of Halma: the 2-player game of Halma that minimises the number of turns ...
19
votes
1answer
934 views

Can you connect the dots?

This challenge is based off of Flow Free. An online version can be found here: http://www.moh97.us/ You will be given a puzzle, and you must return 1 if the ...
18
votes
3answers
2k views

Crossing a river with weird animals

Background One kind of river-crossing problems involves two kinds of animals. One such problem reads like this: (all wordings, including animal species, are arbitrary) A farmer has to cross a river ...
18
votes
1answer
744 views

Solve an 0h n0 board

0h n0 is a very simple and enjoyable game, a bit like Sudoku or minesweeper. Game rules (I recommend using the tutorial in the game if you can, it is very simple and useful) The puzzle starts with ...
17
votes
10answers
2k views

Write a word equation solver [duplicate]

Introduction Consider the following example: CODE + GOLF —————— GREAT This is an equation where each letter represents a decimal digit and the words ...
17
votes
2answers
1k views

Solve a Matchstick puzzle

On puzzling SE there are what are called "matchstick problems" in which math is written in match sticks and you are allowed to move a certain number of them to get a certain property. In this ...
16
votes
2answers
4k views

Solve the (Rubiks) Pocket Cube

Your task .. is to do what Brian Fantana apparently couldn't do, and solve the 2x2x2 Rubik's Cube. The Layout ...
16
votes
8answers
661 views

Recover boolean cells from windowed sums

Background In Minesweeper, you will often encounter a horizontal or vertical wall of one's and two's (not yet revealed cells are marked as ?): ...
16
votes
3answers
1k views

Build a poisoned wine testing scheduler

Recently at Puzzling.SE, there was a problem that I wrote about determining which two bottles out of a larger number are poisoned when the poison only activates if both components are drunk. It ended ...
16
votes
2answers
729 views

A Good Time to Refuse

The Setup Suppose you're given n fuses, with 1 ≤ n ≤ 5, each of which is a meter long, and where each fuse has an associated burn rate of N meters per D hours. A fuse can be lit at one or ...
16
votes
3answers
2k views

Code golf: Solve a Knights and Knaves logic problem by parsing English

Background There are two people, Bill and John. One of them is a knight, which always tells the truth, and the other is a knave, which always tells a lie. You don't know who is the knight and who is ...
16
votes
1answer
2k views

Build a MU puzzle solver

The MU puzzle is a puzzle in which you find out whether you can turn MI into MU given the following operations: If your string ...
16
votes
1answer
520 views

Given a list of lengths, and a string representing those lengths, do they match?

Given a pattern representing a list of lengths, and a string representing those lengths, do they match? For those interested, this is question equivalent to verifying if a row or column of a Nonogram ...
16
votes
1answer
886 views

We love our weird puzzles, us Brits

In a few British newspapers there is a game known as Hidato. It is somewhat similar to Sudoku, albeit instead of having 1-9 in a line and block, it's about placing numbers such that they connect in ...
15
votes
6answers
2k views

Solve 4x4 Mastermind in exactly 5 steps

Background Mastermind is a game of code-breaking for two players. One of the players is codemaker (Alice) and the other is codebreaker (Bob). 4x4 means that the player should guess the length-4 ...
15
votes
2answers
1k views

How do I get more Klotski in my life?

I really love sliding tile puzzles, but recently, I haven't had time for them. Hence, I need a program to give me my fix of sliding-tile puzzles, specifically Klotski puzzles. Your input will be in ...
15
votes
2answers
826 views

Build a top-front-side puzzle solver

A top-front-side puzzle is a puzzle where you are required to construct a 3-D shape of (usually cubic) blocks given three orthogonal views: a top view, a front view, and a side view. For example, ...
14
votes
12answers
6k views

3 and 5 Litre Jug Puzzle

You may have seen this one in Die Hard: With a Vengeance... This question is based on the famous 3 and 5 Litre Jug Puzzle, but with a slightly different slant. Golf up some code that when given an ...
14
votes
9answers
2k views

Minimum number of Jumps

Given a sequence of numbers, find the minimum number of jumps to go from the starting position to the end and come back to the starting position again. Each element of the sequence denotes the ...
14
votes
5answers
526 views

Lights out, 7-segment version

Given a 7-segment display with some segments switched on and some off, find a sequence of digits (0-9), such that after toggling the corresponding segments for each digit, all segments are switched ...
14
votes
3answers
469 views

Help Beth escape the desert

While similar to the other water-carrying puzzle, the unique aspects of this challenge make it entirely different. Beth is located at an oasis in the middle of a desert. There is plenty of water in ...
14
votes
3answers
299 views

Counting uniquely solvable polylinks

Related: Counting polystrips Background Link-a-Pix is a puzzle on a rectangular grid, where the objective is to reveal the hidden pixel art by the following rules: Connect two cells with number N ...
14
votes
2answers
548 views

Group these cells!

This challenge is based on the game Layerz. Given, on stdin or as a function argument, a 2D rectangular array of cells where each cell contains either a blank (you may choose to use 0s instead of ...
14
votes
1answer
328 views

Solve a meta-knowledge puzzle

Alice and Bob are perfect logicians trapped on an island with a puzzle generator. Although they can instantly solve the Riemann hypothesis and P=NP just by thinking about it, rather than doing ...
14
votes
1answer
501 views

Taxicab in San Francisco

You are a taxicab driver in San Francisco. As is typical of taxicab drivers, you are navigating a grid where the only valid directions you can move are the left, right, up, and down. However, San ...
13
votes
4answers
1k views

Solve the BattleBlock Theater Puzzle

The game BattleBlock Theater occasionally contains a puzzle which is a generalised version of Lights Out. You've got three adjacent blocks, each of which indicates a level between 1 and 4 inclusive ...
13
votes
4answers
962 views

Is the word typeable with keys adjacent to each other?

Before reading this I suggest reading this little puzzle: https://puzzling.stackexchange.com/questions/11408/longest-word-with-adjacent-letters-on-a-keyboard I want you to make a program that takes ...
13
votes
2answers
548 views

Is this Flow Free puzzle trivial?

Background Flow Free is a series of puzzle games whose objective is to connect all the same-colored pairs of dots on the grid. In this challenge, we consider the original game on a rectangular grid (...
13
votes
1answer
427 views

Interactive Maze Solver

Bob got kidnapped and is stuck in a maze. Your job is to help him find a way out. But since it is a very dark and scary maze, he can't see anything. He can only feel walls when he runs in to it, and ...