
CSc 3320
Programming project #3
DUE DATE: October 23, 2002
Objectives
1. Learning about shell scripts: conditional programming, list processing, and other
materials discussed in chapter 6.
2. Writing a C-shell script
3. Setting up an utility program with command-line parameters.
Introduction
Your assignment is given below. To solve it, write a program that reads the necessary
information to compute and output the indicated values, as efficiently as possible. First,
design your program by specifying its behavior, identifying the objects and operations it
needs to solve the problem, and then organizing the objects and operations into an
algorithm. Then code your design as a C-shell script using stepwise translation. Finally,
test your program thoroughly.
Project
1. Your program will allow two people to play tic-tac-toe. The game will be explained in
class briefly. If you do not know how this game works, see the instructor or teaching
assistant.
2. INPUT: Your program will need to know the names of the two players. Input can
come from the command line OR if the program is invoked without parameters, it should
use standard input (for the users' names). Your program will also need to read in the
players' moves. If the user enters a bad number (e.g. 0), prompt the user again. Do not
allow the user to select a spot that already has an X or O on it.
INPUT PARAMETERS:
The first parameter passed by the user is the first player's (X) name.
The second parameter passed by the user is the second player's (O) name.
Do not expect the "-" character.
If one parameter is passed, ask for the second player's name.
If no parameters are passed, ask for both player's names (one at a time).
If more than 2 parameters are passed, ignore the rest.