UMBC CS 201, Spring 08
UMBC CMSC 201
Spring '08

CSEE | 201 | 201 S'08 | lectures | news | help

CMSC 201
Programming Project Two

Four-In-A-Row

Out: Monday 3/3/08
Due: Before Midnight, Saturday 3/15/08

The design document for this project, design2.txt,
is due: Before Midnight, Sunday 3/9/08

The Objective

The objective of this assignment is to give you practice with project and function design. It will also give you an opportunity to work with a two-dimensional array and passing that array to functions for manipulation.

The Background

This game we're calling "Four-In-A-Row" is a popular game sold under a copyrighted name in both full-size and travel sizes. The board is vertical and forms a grid that is 6 rows high by 7 columns wide. The game is played by two players, each with their own color of checkers (either red or black). Checkers are dropped into the columns by each of the players in turn. The object of the game is to be the first player to get 4 of your checkers in a row, either horizontally, vertically, or diagonally.

Play begins by one player choosing a column in which to drop a checker. Since this is the first play, the checker will fall to the bottom of that column. The other player then gets to drop one of her checkers into the column of her choice. If player #2, your opponent, chooses to drop her checker in a different column than you did, it will fall to the bottom of that column. If she chooses the same column as you did then her checker will land just above yours. So the rule of placement is that the checker will fall down the column as far as it can.

If you would like to practice playing the game so that you understand it, I have found a version of it on the web that will allow you to play against the computer. Practice Playing Connect

The Task

Design and code a project that will allow you to play Four-In-A-Row against the computer.

The Specifications

Sample Run

This is the sample run, that was generated by running the program on linux2. In test mode, your projects should match the output produced by my program in the test mode examples.

Although your output need not be identical to that in the output file, all information (including a greeting and instructions that are not shown in the output) must be present. In TEST mode, using the same seed as I did, and entering the column choices in the same order should produce the same game with the same results for your project.

Please be aware that this may NOT be a complete test of the program.

Submitting the Program

You are to use separate compilation for this project, so you will be submitting five files.
Your C source code file that contains main() MUST be called proj2.c. You will also have files called game4.c and game4.h that contain all of the project-specific, hiding-details function definitions and their prototypes, respectively. You'll also need to have files called util.c and util.h, that contain modular function definitions like GetValidInt(), SetRandomSeed() and GetRandomNumber() and their prototypes, respectively. These are useful utilities for many programs and can be used unmodified for future projects.

To submit your project, type the following at the Unix prompt. Note that the project name starts with uppercase 'P'.

submit cs201 Proj2 proj2.c game4.c game4.h util.c util.h

To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show all files that you submitted in a format similar to the Unix 'ls' command.

submitls cs201 Proj2


CSEE | 201 | 201 S'08 | lectures | news | help

Monday, 03-Mar-2008 21:38:47 EST