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
12
votes
2answers
1k views

Generate a valid equation using user-specified numbers

This is based on a game one of my math teachers used to play in middle school. He would write 5 random one-digit numbers on the board, and then a random two-digit number. We would try to create an ...
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: <...
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: ...
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 ...
27
votes
4answers
3k views

Implement a Non-Guessing Sudoku Solver

Implement the shortest Sudoku solver. Sudoku Puzzle: ...
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. ...
7
votes
3answers
3k views

Lights Out - Find the solution

(This code golf task is related to Code-Golf: Lights Off!. The same puzzle is used, but the task is different.) Introduction "Lights Out" is a puzzle in which you should switch off all ...
6
votes
5answers
3k views

Build a solver for the cow and chicken problem

The cow and chicken problem is a traditional problem for introducing young students to the concept of systems of equations. It goes as follows: A farmer raises cows and chickens on his farm. His ...
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 ...
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 ...
14
votes
2answers
546 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 (...
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, ...
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 ...
11
votes
2answers
255 views

Minimal cost path in wall-breaking maze

Inspired by this Puzzling challenge. Challenge Given a 2D rectangular grid where each cell is either an empty space or a wall, find the path (or one of the paths) from the top left cell to the bottom ...
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 ...
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 ...
14
votes
1answer
497 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 ...
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 ...
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 ...
11
votes
1answer
857 views

Constructing an Orthogonal-Diagonal Greco-Latin Square

Consider a grid of NxN unique elements. Each element has a letter (from A to the Nth letter,...
9
votes
2answers
773 views

Tents and Trees feasibility

Sequel to Verify Tents and Trees solution. Background Tents and Trees (try here) is a puzzle played on a square (or rectangular) grid, where the objective is to place tents horizontally or vertically ...
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 ...
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 ...
10
votes
2answers
377 views

Crack the safe!

Inspired by https://puzzling.stackexchange.com/questions/24334/to-catch-a-thief You are given an n by n (...
7
votes
5answers
3k views

A simple Knight's problem

How many ways are there to place a black and a white knight on an N * M chessboard such that they do not attack each other? A knight can move two squares horizontally and one square vertically, or ...
5
votes
4answers
15k views

Solve the Magic Hexagon [closed]

A magic hexagon is a hexagon where every row and every diagonal add up to the same value. In this case the value is 38. Each number from 1 to 19 must be used exactly once. This image shows a solution ...