CS 1571: Homework 5 REDO

Game-Playing (Chapter 6): Programming (150 pts)

Assigned: October 28, 2008

Intent to REDO Due: November 4, 2008

Programming Due: November 11, 2008

Connect N/2 (150 pts)

The day before HW5 was due, a student's code was accidentally left in the public directory by the TA, and some of you have mistakenly thought that it was part of the support code. This is a regrettable accident, and we want to find the fairest way to resolve this dilemma. Here is how this problem will be handled:

  • If you used your classmate's java code as the basis of your program, you are required to do this modified assignment to get full credit. If not, your current program will be graded, but a penalty of 50 points will be taken.
  • For others, you may optionally choose to do this modified assignment as a redo opportunity, for example, if you want to try to improve your grade on the original assignment.
  • IMPORTANT NOTE: IF YOU PLAN TO DO THIS MODIFIED ASSIGNMENT, YOU MUST NOTIFY US BY NOVEMBER 4 (so we can start grading the already submitted ones).

    The assignment is exactly the same as before, except for the following: instead of playing tic-tac-toe, you are now playing Connect n/2, a generalized version of the board-game Connect-4.

    In the actual Connect-4 board game, each player is given a set of tokens, which s/he inserts into the top of a 7x6 grid. Due to the way the game is designed, the token can freely drop down due to gravity. The aim is to have four tokens lined up, which secures a win. In some cases, neither of the players lines up four tokens, and the game is a draw.

    For our Connect n/2 homework, we have generalized the game, to make it very similar to our original n x n tic tac toe. In Connect n/2, we make the grid n x n, and to win a player has to have n/2 tokens lined up. So the board and goal are similar to the original assignment, just the legal moves and heuristics are different. A legal move consists of a player putting a token in any column that is not full. Once the token is put in the column, it will fall down to the lowest unoccupied row in the column.

    As before, the support code written for this assignment lets you play two different programs against each other. You can find the new code here. Alternatively, you can get it on javalab at

  • /afs/cs.pitt.edu/usr0/chenhai/public/html/CS1571/connect