Homework #13
Deadline:
The source code for this program (tttOO.cpp,
TicTacToe.h, TicTacToe.cpp) and its
executable (tttOO.exe) must be available in your home directory (i.e.,
cpsuser3.cps.udayton.edu/cps150/sectionn1/cps150-N1.[your number goes here])
by 5:50p on Tuesday, December 7, 2004. Also, turn in
a printout of your code in class, before class starts.
Note: You must use the filenames exactly as shown above (i.e., case-sensitive).
Problem (100 points):
Create a TicTacToe class that will enable you to write a complete
program to play the game of tic-tac-toe. The class contains as private
data a 3-by-3 double-subscripted array of integers. The constructor should
initialize the empty board to all zeros. In this game, a human will play
against the computer. Flip a coin to decide who moves first. Each move must
be to an empty square. Place a 1 in the specified square for the human player and
use a 2 for the computer. After each move, determine whether the game has been
won or is a draw.
Specifications:
- Make class TicTacToe an ADT.
- Use separate compilation.
- Include pre: and post: conditions for each function.
- Do not use global variables.