From UBC Wiki

Connect Four

Authors: Tony Huang, Matteo Mocellin, Ryan Wong

What is the problem?

We would like to implement the classic game of Connect Four (

What is the something extra?

We originally chose a complex AI as a "something extra", but after many attempts to integrate one into our code we decided that not only was the state branching too complex (around 10•10^19 possible states*), but that the time needed to implement one that is effective would be outside of the scope allotted to of a project of this size.

Instead, we implemented several functions that print the board state to the terminal (as well as prompts for info), making our program much easier to visualize and use as a working model of connect four.

What did we learn from doing this?

The biggest things we learned from this project were learning how to construct a more complex game structure in Haskell then what we learned in lecture, working around things such as the fact that Haskell has no side effects and therefore no global variables. We learned that there are different ways to construct conditional statements like through simple "|" statements we wrote in class as well the old "if-then-else" and the "case X of" statements. Through writing the win conditions, we have learned that although tuples can easily be created, there is a limit, however to how big they can get (15 in this case). Lastly, through our implementation of the UI, we have learned how to print statements through printStrln as well as taking in inputs through getLine (and reading it through "read').