CPSC312-2019-Connect-Four-Prolog

From UBC Wiki

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 Prolog. This is a game where players drop circles of their own color into a vertical seven column, six row grid. The first player to have a sequence of 4 circles of their color in either a row, column, or diagonal wins the game.

We will be implementing our Project 1 in Prolog instead of Haskell.

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.

Implementing a GUI in Prolog sounds like an interesting challenge to tackle.

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.

First of all, Prolog is not well suited for GUIs. Other than that, implementing connect 4 in Prolog is not much more difficult then implementing it in Haskell. One major difference in the Haskell and Prolog implementations is the fact that you do not need to worry about types with Prolog; this makes writing the code much simpler. Furthermore, another difference is that Prolog does not have the built in 'lst !! n' function (for getting element n of a list), so you instead have to iterate over the list each time using accumulators to keep track of where you are.

Links to code

https://github.com/zachvav/connect4-prolog