We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Brainfuck Minesweeper
Brainfuck Minesweeper is a programming game by user:raiseafloppafan7741 in 2026. As the name suggests, it is Minesweeper played by brainfuck programs. The author did not realize when creating it that Minesweeper solvers do exist, however they think it'd still be a fun challenge to golf a Minesweeper solver in brainfuck size-wise and speed-wise.
Overview
Brainfuck Minesweeper can either be played solo or with two or more players.
Each program gets their own minefield and a tape of 30,000 unsigned 8-bit cells that wraps at the edges. Because of this, the maximum size for a minefield is 256x256. The grid does not have to be square.
At the start of each round, a minefield of random size with a random amount of mines is created and copies of it are distributed to the players. The first two cells of each tape contains the X and Y coordinates of the mine cell with zero neighbors, the third and fourth cells contain the width and height of the minefield, and the fifth cell contains the number of mines.
When there are two or more players, they are run in round-robin fashion in the order they were loaded.
The round continues until either all players have halted or 10,000,000 iterations have passed with at least one player still standing.
| Command | Description |
|---|---|
+
|
Same as in brainfuck. They wrap around. |
-
| |
<
| |
>
| |
[
|
If the current tape cell is zero, the instruction pointer jumps to the matching ].
|
]
|
If the current tape cell is nonzero, the instruction pointer jumps to the matching [.
|
,
|
Let X be the current tape cell and Y be the tape cell to the right of that and sets the current tape cell to the number of mine neighbors of the minefield cell (X, Y) if the cell is open, or 255 if it is closed. A point that is out of bounds will wrap around. |
.
|
Let X be the current tape cell and Y be the tape cell to the right of that and opens the cell on the minefield (X, Y). Opening a cell with no mine neighbors cascade-opens all of its neighbors. A point that is out of bounds will wrap around. |
Scoring
There are several scoring categories: code length, running time, ending state, and the number of tiles opened. There are also separate per-round scores and overall scores.
To keep scoring fair, 75 rounds of Brainfuck Minesweeper are played.
Code length
The code length score is higher the shorter a program is.
The "code length" here only includes brainfuck instructions. This means that +[] and + candy cookie chocolate [] both have the same code length score.
This statistic was helped with by User:Dragoneater67.
The program's other scale per-round scores are multiplied by 0.9995 raised to the power of the code length.
Running time
This statistic was helped with by User:Dragoneater67.
The program's other scale per-round scores are multiplied by 0.9999999 raised to the power of the number of iterations a program has been running for.
Ending state
The per-round ending state score is an ordinal score.
- 0 - Program uncovered a mine and got blown to bits
- 1 - Program is still running after the round has ended
- 2 - Program halts naturally
The overall ending state statistic is the percentage of rounds where the program got blown to bits, followed by the percentage of rounds where the program continued after the end of the round, followed by the percentage of rounds where it halted naturally. For example, the program <+[] will have an overall ending state statistic of (0%, 100%, 0%).
Tiles opened
The per-round score is the percentage of opened tiles on a minefield. For example if there are 40 non-mine tiles and a program opened 20 of them, the program would get a score of 50%.
The overall score is the average percentage of opened tiles. For example if four rounds were run and a program opened 40%, 3%, 0%, and 72% of the tiles of the respective minefields, then its overall score would be 28.75%.
Example strategies
Time waster
This strategy relies on the fact that opening a cell with zero neighboring mines opens its neighbors. In fact, the previous sentence is just a steganography of it.
.
Runner
This strategy just runs for it. This strategy is absolutely horrible, but it exists to give you an idea of what playing this game would look like.
<+ Initialize forever loop
[>
. Open starting tile
[ Open row
+. Move to next tile and open it
]
>+< Next row
<]
Minimized:
<+[>.[+.]<]
See also
External resources
- Reference implementation (not updated to handle rounds or scoring)