Course:CPSC312-2024/Chess

From UBC Wiki

Authors: Jerry & Matthew

What is the problem?

We will build a playable Chess interface with Haskell. We will create an interactable interface to update the state of the game throughout player moves. We chose to make it a two-player game where both players play on the same local machine. The rules aren't strictly enforced so that there is room for the players to use their own custom rules. The chessboard and pieces are displayed using a combination of ascii and unicode symbols. The moves are processed using algebraic notation; (A1 A2) will move the piece at A1 to A2.

What is the something extra?

We plan on creating a chess AI for the player to play against. If we have time, we can train it based on theory-based openings as opposed to letting it learn entirely from scratch since this is a common strategy with current state-of-the-art chess AIs.

What did we learn from doing this?

We learned to embrace the functional paradigm that Haskell encourages which helped us shift our problem solving from the more familiar imperial paradigms such as OOP. Functional programming forced us to get out of our comfort zone of telling the machine how to do stuff to telling the machine what we want. This resulted in more concise and less cluttered code as opposed to something such as OOP which can be very verbose. The flexibility provided by functional programming also gave us the luxury to explore many more methods to reach a desired solution while still being predictable due to its robust system of statelessness.

Haskell was also a surprisingly nice language to use when working with others due to the aforementioned predictability. As long as we knew what we wanted each of our functions to do, we could trust one person to implement a function while the other implements another, and having both functions click together seamlessly due to FP's feature of one-input/one-output. The concurrency provided by this effect allowed for efficient development time.

Haskell however isn't perfect, and its development environment is proof that there is room for improvement. The development environment isn't as easy to start with as a Java project in IntelliJ or as easy to learn as a Python script. The learning curve to start writing Haskell is higher than the more popular languages of today due to the nature of FP and the crude nature of the tools provided such as GHCi.

Work division

We will discuss this with the TA.

Links to code etc.

https://github.com/ZatthewFan/stockfish-plus