Two-player LAN games with GUI lobby selection. After both players connect, choose from multiple games together.
- Python 3.9+
- Pygame for GUI interface
- Battleship (classic 10x10)
- Snake (two-player, simultaneous turns)
If both players choose the same game in the lobby, that game starts. If they choose differently, a random choice decides.
Recommended (ensures pygame
is installed and CLI entrypoints are available):
python3 --version
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
pip install -e .
This installs console commands: battleship
, battleship-host
, and battleship-join
.
One player hosts, the other joins.
- Find your local IP (e.g.,
192.168.1.23
). On macOS/Linux:ipconfig getifaddr en0
orifconfig
. - Start hosting:
versus host --bind 192.168.1.23 --port 5000
- Wait for your friend to connect, then both pick a game in the lobby.
versus join --address 192.168.1.23 --port 5000
- If your firewall prompts, allow incoming connections for Python.
Battleship
- During placement: type coordinates like
A1
,J10
andR
for rotate (horizontal/vertical) - During attack: type target tile
B7
,E10
- Use
q
to quit at any prompt
Snake
- Use WASD to steer. Press Enter to keep your previous direction.
q
to quit.
- Must be on the same LAN/Wi‑Fi. Internet play would require port forwarding or a relay server.
- Battleship ends when all ships of a player are sunk. Snake ends on collision; higher score wins, head-to-head or simultaneous crash is a draw.