Ready to sink some ships? Battleship Solitaire is your ultimate solo puzzle challenge!
Rather than battling someone on the other side of the board, challenge yourself to identify all the battleship locations with just a few hints!
This project generates both a brand new, randomized battleship puzzle to solve alongside its solution counterpart.
Choose the size of the board, number of ships and max size of ships, and have endless fun solving battleships!
Puzzle Sheet
Answer Sheet
- ✅ Generate randomized puzzles
- ✅ Configurable board size and ship count
- ✅ Exports puzzle & solutions as images
1️⃣ Clone the repository:
git clone https://github.com/blakeldridge/BattleshipSolitaire
cd BattleshipSolitaire2️⃣ Install Dependencies:
pip install pillow pandas3️⃣ Generate the puzzle:
python battleship.py 10 10 80010 10= rows x columns800= image width in pixels- Allowed rows and columns shown in settings.csv
This files defines the allowed board sizes and the number of ships per size.
Each row represents one configuration.
Width,Height,1,2,3,4,5,6
15,15,4,4,3,2,1,0
12,12,4,4,2,1,1,0
10,10,4,3,2,1,1,0
8,8,3,3,2,1,0,0
7,7,3,2,1,1,0,0
6,6,3,2,1,0,0,0Columns Explained
- Width, Height -> Board dimensions
- 1, 2, 3, 4, 5, 6 -> ship sizes
✅ Example:
10,10,4,3,2,1,1,0 means:
- Board size: 10×10
- Ships: 4 of size 1, 3 of size 2, 2 of size 3, 1 of size 4, 1 of size 5, 0 of size 6
settings.csv are supported.
Check out : https://www.ultraboardgames.com/battleship/solitaire.php for the rules!
- 🐍 Python
- 🖌️ PIL (Image manipulation)
Created by Blake Eldridge - Feel free to reach out!
📧 Email : blakeldridge@gmail.com
💼 LinkedIn : blakeldridge

