CPSC312-2019-Connect-Four
Connect Four
Authors: Shaun, Jd, Zach
What is the problem?
State the general problem. If applicable, tell us what information you will use, e.g., a link to some web site that provides the information you used. What will you do?
We will implement the game “Connect Four” in Haskell. This is a game where players drop circles of their own colour into a vertical seven column, six row grid. The first player to have a sequence of 4 circles of their colour in either a row, column, or diagonal wins the game.
More information on the game can be found here: https://en.wikipedia.org/wiki/Connect_Four
What is the something extra?
What is the in-depth aspect you will do? If the problem is related to some other group's project, tell us how they fit together. If in doubt, include the information.
We will also implement varying levels of AI for the human player to play against. Furthermore, we will look into incorporating GUI libraries for displaying the game grid.
What did we learn from doing this?
(This should be written after you have done the work.) What is the bottom-line? Is functional programming suitable for (part-of) the task? Make sure you include the evidence for your claims.
Haskell and functional programming in general seems to be a good choice when designing simple games. You are able to carry abstractions that can apply to all games, and essentially just “fill in the blanks” with whatever the game is that you are trying to build. Connect Four is a simple enough game that the internal state can just be represented with 2d list of numbers, where each number is a slot on the game board. The most complex part of the game logic is checking whether someone has won; however, when boiled down the problem is conceptually simple, albeit somewhat tedious to write the code for.
Furthermore, incorporating graphics was actually easier than expected. We used a package called gloss which fit very nicely with our game abstractions. The amount of code required to make the graphics for our game was relatively minimal; mostly all that we needed was a function that maps the “world state” to an image, and functions to update the game state given a particular input event.
Links to code etc
https://drive.google.com/open?id=1qb-GAwy_3zjw7sTtqksLY6sXFZhmFOmy
https://github.com/jdganz/CS312_p1