Read about the development process: Vibe Coding with Claude
A terminal-based Battleship game built with Go and Dolt database, featuring Git-style branching for game isolation.
- Dolt - SQL database with Git-style versioning
- Go 1.19 or later
sudo bash -c 'curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | bash'
git clone https://github.com/dolthub/vibin-battleship
cd vibin-battleship
git checkout claude
From the source root, build the battleship binary:
go install .
Navigate to the db
directory and start the Dolt SQL server:
mkdir db
cd db
dolt sql-server
The server will start on 127.0.0.1:3306
by default.
battleship new
This will output a game ID that players can use to join.
Each player joins using the game ID and chooses red or blue:
battleship join <game_id> red
battleship join <game_id> blue
Players will be prompted to place their 5 ships:
- Carrier (5 spaces)
- Battleship (4 spaces)
- Cruiser (3 spaces)
- Submarine (3 spaces)
- Destroyer (2 spaces)
Start the interactive game session:
battleship play <game_id> red
# In another terminal:
battleship play <game_id> blue
Players take turns attacking coordinates (e.g., A5, J10) until one player sinks all of the opponent's ships.
The following commands are primarily for debugging and inspection.
battleship print <game_id> <red|blue>
battleship attack <game_id> <red|blue> <coordinate>
battleship list
This game leverages Dolt's unique branching capabilities:
- The
main
branch contains agames
table with game metadata and results - Each game creates its own branch with three tables:
turn
- Manages turn order with random valuesred_board
andblue_board
- Store ship positions and attack results
- When a game completes, temporary tables are dropped and the branch is merged back to
main
This approach provides complete game isolation and a full audit trail of every move through Dolt's commit history.
- Standard Battleship rules apply
- 10x10 grid using coordinates A1-J10
- First player is determined by random roll when both players join
- Hit all enemy ships to win
- Ships cannot overlap or extend off the board
go test -v
The game uses a branching strategy where each game gets its own isolated branch:
Main Branch:
games
table - Game metadata and final results
Game Branches:
turn
table - Turn management with player valuesred_board
/blue_board
tables - Ship placements and attack results
This design ensures games are completely isolated and provides full versioning of game state.