Course:312-2024/Gomoku/

From UBC Wiki

Overview

Authors:

Sukanya Sen, Aiden Seo, John Ahn

What is the problem?

We want to see if it’s feasible to implement the strategy board game Gomoku in Haskell.

Game Board

It is traditionally played with Go pieces and on a 15x15 Go board.

Game Rules

The game is very similar to Connect 4, though it’s more complex. Rather than dropping a chip down a column, each player alternates by placing a piece on the Go board within an empty intersection. The objective is to form a horizontal, vertical, or diagonal line of five stones of the same color.

Winning Condition

The winner is the player who manages to connect five pieces of their color horizontally, vertically, or diagonally. However, if the board is completely filled and no player can make a line of five stones, then the game ends in a draw.

User Interface

The implementation will include a simple graphical user interface for player(s) to interact with the game.

Testing

We will add tests as we implement the code. We plan to use Haskell's testing frameworks (HUnit/ QuickCheck - TBD) to verify the correctness and robustness of game logic functions.

Detailed Game Description

See https://en.wikipedia.org/wiki/Gomoku.  

What is the something extra?

We plan to add the following features:

  • Save/Load functionality
  • Player vs AI
  • Player vs Player

What did we learn from doing this? (TBD)

Learning Goals:

  • Explore different approaches to user GUI development in Haskell.
  • Develop proficiency in writing tests for Haskell code on the go using testing frameworks such as HUnit or QuickCheck.

Work division

Sukanya

  • Develop the base code and GUI for the game
  • Player vs Player
  • Set vertical, horizontal and diagonal game-ending conditions
  • Change the size of the board from 15x15 to 19x19 (made variable integer >=5)

John

  • Implement Player vs. AI functionality

Aiden

  • Implement Save/Load functionality
    • Save the board state
    • Load saved games

Features

Pattern Matching

Leverage Haskell's pattern-matching to handle game states, player moves, and winning conditions.

Lazy Evaluation

Explore lazy evaluation in Haskell to optimize run time by discarding temporary computations.

Link to Code

Code link to Gomoku Game here