Course:CPSC312-2023-UltimateTicTacToe

From UBC Wiki

Authors: Amanda, Ethan, and Maggie

What is the problem?

We are creating a Haskell implementation of the game Ultimate Tic-Tac-Toe. A version of the game with the rules explained can be found here: https://bejofo.net/ttt

In summary, the board resembles a large Tic-Tac-Toe board (the super-board), where each of the nine squares contains a smaller Tic-Tac-Toe board (the sub-board). This is shown in Figure 1.

Figure 1: empty tic-tac-toe board

Each position in each super- and sub-board is represented by a number, like so:

0|1|2

-+-+-

3|4|5 

-+-+-

6|7|8

The number in the sub-board selected by the previous player determines which super-board the next player must play in. For instance, if the first player places their token on square 0 of the center sub-board, then the second player must play in the top-left sub-board, and which of the nine squares they choose place their token in dictates which sub-board the first players gets to make their next move in, and so and and so forth. If a player gets three in a row in one of the nine sub-boards, then the win that square in the super-board. Henceforth, no player can place any token in that sub-board. If they are directed to do so by the previous player's move, then they may choose another sub-board to play in, as is done for the very first move of the game. A player wins when they get three in a row in the super-board.

What is the something extra?

We are planning on creating a simple, updating UI that shows both the large board, and the smaller board that you are currently making a move on. Potentially a minimax opponent AI too.

What did we learn from doing this?

- Haskell was suitable for implementing Ultimate Tic Tac Toe. Haskell's typing system made the process predictable, and using simple definitions for Action and State made everything relatively straightforward, as long as the data was defined appropriately. Using the game abstractions and pattern matching discussed in class was also very useful.

- Testing was also extremely important for ironing out bugs in our game, specifically involving board index and IO problems.

-we also gained a further appreciation for the importance of well-commented code, especially when lots of smaller functions together into a larger program.

Links to code etc

https://github.com/JessenM/cpsc312-project1.git