Draft:Brainfuck Battleship
Brainfuck Battleship is a programming game by User:AnalysisOfVariance in 2026. As the name suggests, it is an adaptation of the game Battleship to be played by brainfuck programs.
Overview
Brainfuck Battleship can be played by two or more participants which are just brainfuck programs. The participants are run in round-robin fashion in a specific order. The game ends when one participant has emerged victorious and sunk all of the others' ships or 1,000,000 cycles have passed with no winner.
There is a 256x256 grid of cells called the sea where the actual ships are placed.
Unlike some variants of Battleship, Brainfuck Battleship allows stacking ships on top of each other.
Each brainfuck program gets its own personal tape with 256 unsigned 8-bit cells to work with.
| Command | Description |
|---|---|
+
|
Increments the current cell. 255 wraps to 0. |
-
|
Decrements the current cell. 0 wraps to 255. |
<
|
Moves the tape head left. If the tape head is at the leftmost cell, it wraps around to the rightmost cell. |
>
|
Moves the tape head right. If the tape head is at the rightmost cell, it wraps around to the leftmost cell. |
.
|
TBA |
,
|
Triggers the interrupt with the interrupt number of the current cell. If no such interrupt exists, this is a no-op. |
[
|
If the current tape cell is zero, then this jumps to the corresponding ].
|
]
|
If the current tape cell is nonzero, then this jumps to the corresponding [.
|
Ships
Brainfuck Battleship borrows the ship types from Battleship.
| Ship index | Ship | Sink score | Sink penalty |
|---|---|---|---|
| 0 | Aircraft carrier | 15000 | -1000 |
| 1 | Battleship | 7500 | -5000 |
| 2 | Cruiser | 5000 | -3500 |
| 3 | Submarine | 5000 | -3000 |
| 4 | Patrol boat | 1000 | -750 |
Interrupts
An interrupt is a built-in routine that is triggered by the , command.
16
Interrupt 16
144
Interrupt 144 is a random number generator. It replaces the current cell's value with a random number.
Scoring
Participants in a round are scored based on how long they survived, how much ships they sank, the kinds of ships they sank, how much ships they lost, and the kinds of ships they lost.
Example strategies
All-in-one
This strategy is a high-risk high-reward strategy. Only use this if you are incredibly lucky.