A web-based implementation of Gomoku (Five in a Row) built with FastAPI and Socket.IO. Play against an AI opponent or challenge a friend in real-time.
Gomoku is a strategic board game where two players take turns placing stones on a 15×15 grid. The goal is simple: be the first to get five of your stones in a row horizontally, vertically, or diagonally. It's like tic-tac-toe but more complex and strategic.
- Play against a computer opponent using the minimax algorithm
- The AI analyzes the board and makes strategic moves
- Perfect for practicing or playing when you're alone
- Challenge a friend in real-time using WebSocket connections
- Both players connect to the same game room
- Real-time updates show moves instantly
- Python 3.11+
- pip
-
Clone the repository
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python main.py
-
Open your browser Navigate to
http://localhost:8000
python-gomoku/
├── game/ # Core game logic
│ ├── game.py # Game state management
│ ├── minimax.py # AI algorithm implementation
│ ├── views.py # Socket.IO event handlers
│ └── helper.py # Utility functions
├── static/ # CSS, JS, and images
├── templates/ # HTML templates
├── main.py # FastAPI application entry point
├── config.py # Configuration settings
└── requirements.txt # Dependencies
Key settings in config.py:
- Board size (default: 15×15)
- AI search depth
- Server host/port
- Game types and modes
python main.pyuvicorn main:socket_app --host 0.0.0.0 --port 8000