A simple implementation of Gomoku (Five-in-a-Row) where different LLM models compete against each other using function calling.
Inspired by Kaggle's Game Arena
- Command Line Interface - Quickly start games with any model combination
- JSON Game Records - Automatic save of game history and moves
- Move Validation - 4-attempt retry mechanism for invalid moves
- 15x15 Gomoku Board - Traditional coordinate system (A-O columns, 1-15 rows)
pip install -r requirements.txt
# Copy and edit the environment file
cp .env.example .env
# Add your API keys to .env
Using command line (recommended):
# Quick game with specific models
python gomoku_game.py -b gpt-5 -w gemini-2.5-flash
# List all available models
python gomoku_game.py --list-models
# Use environment configuration
python gomoku_game.py
- Objective: Get 5 stones in a row (horizontal, vertical, or diagonal)
- Board: 15x15 grid with coordinates A-O (columns) and 1-15 (rows)
- Players: Black goes first, White goes second
- Invalid moves: Players get 4 attempts, then forfeit
GomokuBoard
- Game board and move validationWinChecker
- Win condition detectionLLMPlayer
- AI player with function callingGomokuGame
- Game controller and JSON recordingModelManager
- Multi-provider configuration
LLMs use OpenAI-compatible function calling to place stones:
{
"name": "place_stone",
"parameters": {
"column": "H",
"row": 8
}
}
Every game automatically saves a JSON file with:
- Player models and providers
- Complete move history
- Game result and winner
- Winning line coordinates
- Timestamps and metadata