Gomoku Game

gomoku

Objective

The objective of Gomoku is to be the first player to form a consecutive chain of five symbols horizontally, vertically, or diagonally on the board.

win

winsO

Game Setup

  • Board: Gomoku is traditionally played on a 15x15 grid.
  • Players: The game is played between two players, in my version it's human vs AI.
  • Symbols: The human player uses X's, and the AI uses O's.
  • Score: Each time the human or the AI wins, the score is updated. It starts with 0-0.
  • Reset Button: Any time the button is pressed, the board is reverted to its start-up state.

first_state

Game Rules

  1. Starting the Game:

    • The game begins with an empty board.
    • The human player takes the first turn, placing its symbol(X) somewhere on the table.
  2. Taking Turns:

    • Players alternate turns, AI will place its symbol(O) somewhere on an empty place.
    • AI places randomly until the human will have 4 in a line, then it will try to block the human in an attempt to stop the forthcoming loss.
    • If the AI has 4 in a line, it will prioritize placing the 5th symbol and win the game.
  3. Winning the Game:

    • A player wins by being the first to align five consecutive symbols horizontally, vertically, or diagonally.
    • If the board fills up without either player forming a chain of five stones, the game is a draw.
  4. No Removal:

    • Once a symbol is placed on the board, it cannot be moved or removed during the game.

image image image image image

Functionalities

  • 98% Test Coverage with PyUnit:
    Most of the Gomoku game has been rigorously tested using PyUnit, achieving 98% code coverage. This ensures that almost every function and possible game scenario has been accounted for, providing a robust and reliable game experience.

    image

  • User Interface (UI):
    In addition to a graphical user interface (GUI), the game also offers a command-line-based user interface (UI). This allows users to play the game in a terminal environment, depending on the preference.

    image