A fully functional Battleship game — human vs. computer — written in Python with Pygame.
Video series on YouTube (in Russian)
Pre-built binaries are available on the Releases page — no Python required.
| Platform | File |
|---|---|
| macOS | BattleshipGame.dmg |
| Windows | BattleshipGame-windows.zip |
| Linux | BattleshipGame-linux.tar.gz |
macOS: open the .dmg, drag the app to your Applications folder, then launch it from there.
First launch: if macOS blocks the app with "unidentified developer", run this in Terminal:
xattr -cr /Applications/BattleshipGame.appThen launch the app normally.
Windows: unzip the archive and run BattleshipGame.exe inside the extracted folder.
Linux:
tar -xzf BattleshipGame-linux.tar.gz
chmod +x BattleshipGame/BattleshipGame
./BattleshipGame/BattleshipGameRequirements: Python 3.10+
# Clone the repository
git clone https://github.com/Perun108/BattleshipGame.git
cd BattleshipGame
# Install dependencies
poetry install --no-root
# Activate the virtual environment
source venv/bin/activate # macOS / Linux
venv\Scripts\activate # Windows
# Run the game
cd src && python main.py- At the start, choose to place your ships automatically or manually
- Manual placement: click and drag on your grid to draw each ship (1–4 blocks)
- Use the UNDO button to remove the last placed ship
- Click on the computer's grid to fire — hits are marked with X, misses with a dot
- The computer fires back automatically after each of your shots
- First player to sink all 10 opponent ships wins
Fleet: 1×4-block, 2×3-block, 3×2-block, 4×1-block ships (10 total)
# Run tests
python -m pytest
# Run linter
pylint src/





