Gomoku is a strategy board game typically played with Go pieces on a Go board. Two players take turns placing stones on a grid, aiming to align five stones in a row (horizontally, vertically, or diagonally). The board size is typically 15 x 15, but any size (above 5 obviously) is playable. This Python implementation includes an interactive board that allows players to click to place their stones.
After cloning the repository:
cd gomoku
pip install -r requirements.txt- Run the script:
python play_gomoku.py
- Take turns clicking on the desired fields to place stones.
ctrl-cin the terminal to end the game.
You can customize the board size in play_gomoku.py:
board_size = 10 - Player X always starts first.
- Players alternate turns by clicking on the desired cell to place their stone.
- The game ends when a player aligns five stones in a row or all cells are filled.
You can adjust the following settings in the play_gomoku.py:
- Board Size: Change the
board_sizevariable to customize the size of the grid.
The game supports two types of visualizations that can be set in play_gomoku.py:
- Graphical Visualization: Uses an interactive graphical interface to display the board and allow players to click to place stones. This is the default visualization.
from gomoku.visualizer import GomokuVisualizer
visualizer = GomokuVisualizer(size=board_size)- Terminal Visualization: Displays the board in the terminal and prompts players to enter the row and column numbers to place stones.
from gomoku.visualizer import TerminalVisualizer
visualizer = TerminalVisualizer()
This project is licensed under the MIT License. See the LICENSE file for details.
