Project 3
CSC 4101 – Programming Languages
Due May 2nd, 2006
(No extension!)
Design
and implement a Prolog program that plays Connect-4.
Connect-4 is a two player game which is played on a 7x6 rectangular board placed vertically between them. Each player can drop a token at the top of the board in any one of the seven columns, as long as this column is not full (6 tokens in one column). The objective of the game is to align four connected (neighboring) tokens of the same color either horizontally, vertically or diagonally. The game ends in a draw if the board is full and all 42 tokens have been played without either player achieving four connected tokens. Players alternate and are forced to move, rule which becomes particular relevant towards the end of the game as more and more columns fill up.

Your solution should follow the techniques presented in the section 11.2.5 of the textbook (i.e. the tic-tac-toe example).
You have to implement a basic program which will allow a user to play connect-4 against the computer. The computer should be able to block any winning move and win whenever possible. Your program should be interactive. The user should be able to choose its color (e.g. black (O), that starts first, or red (X) to go second). The program must also print the board in text-mode after each move (use X for red and O for black. For instance
A B C D E F G
6 - - - - - - -
5 - - - - - - -
4 - - - X - - -
3 - - - O O - -
2 - - - X X O -
1 - - O X O X X
To learn more about the Connect-4 game, you
can check:
· http://www.ce.unipr.it/~gbe/cn4rules.html
If you need a Prolog reference manual, you
can check:
· http://www.swi.psy.uva.nl/projects/SWI-Prolog/Manual/Contents.html
Teamwork: You are strongly encouraged to do this assignment with a team of two. When you submit your assignment, indicate the composition of your team (names and email addresses) in your README file.
If you cannot find a partner and would like one, send an email to kosar@lsu.edu and I will try to find one for you. Teams of more than two members are not permitted. You are free to do the assignment alone if you prefer so.
Before submitting your code:
1) Create a folder with your last name.
2) Copy all of the source code, and test files into this folder
3) Create a README file that:
To submit your program, make sure that everything that you want to submit is located in the directory with your last name. Zip (or tar) that directory and send it as a single file to the TA (gschof1@lsu.edu) and CC to the Professor (kosar@lsu.edu). As the subject line, put “Project 1 by your name (& your partner’s name)”.