CSCI 324 Fall 2013
Project #1
Date
Due: 9
September 2013
Purpose: to realize the differences between a normal program and an
artificially intelligent one.
Program
objective: You are to implement a program that plays a
competent game of tic-tac-toe
Instructions: You are to implement
a program that plays a competent game of tic-tac-toe. It should work with a 3x3 board, allow the
user to play multiple games in a single session, and keep track of the number of
times X wins, the number of times O wins, and the number of cat games. At the end of a series of games, it should
print out the number of wins, losses, and draws. The human player should have the option of
going first or second. Remember that X
always moves first. The algorithm you
use can be anything you come up with, but for the purpose of this exercise, do
NOT consult the web or books to develop your program. Write it ONLY using knowledge you have from
you programming courses and data structures.
You do not need to worry about
graphics—a simple text representation of the board will suffice. In addition, to get a user’s move you can ask
them to input the number of the square they wish to move to, instead of having
to have a mouse or cursor interface, where the squares are numbered 1 through 9
from left to right, top to bottom. For
example, here is an excerpt from a possible game:
.
.
.
1 | 2 | X
------------
4 | 5 | 6
-----------
7 | 8 | O
Please enter your move: 7
1 | 2 | X
------------
4 | 5 | 6
-----------
X | 8 | O
O moves to square 5
1 | 2 | X
------------
4 | O | 6
-----------
7 | 8 | O
Please enter your move:1
X | 2 | X
------------
4 | 5 | 6
-----------
7 | 8 | O
.
.
.
When
you finish your program, you are to capture the output of a sample session and
append it to the end of your main program as a giant comment. To turn in your program, zip up all your *.c
and *.h files, and email me the zip file with the header “CSCI 324 Program #1”
as the subject line. THIS IS VERY IMPORTANT, since otherwise your turnin will get lost in my
inbox, and you won’t get credit for it.
Good
luck, and have fun. If you have any
questions, ask.