User Tools

Site Tools


cs509:cs-699_sp13_assignment_5

Complete the following assignment.

The deadline is Monday, 4/1, 5pm.

Read/review the reading assignment on “Arrays as parameters” and “Character Sequences”. Also, read about “Enumerations (enum)”.

Write a program TicTacToe.cpp to play tic-tac-toe using one 9-element character array. The program must allow for 1-player (human vs. computer) or 2-player (human vs. human) games. In the 2-player game, the program should ask for moves alternately from player o and player x. The program should display the game positions as follows:

 1  2  3
 4  5  6
 7  8  9

The players enter their moves by entering the position number they wish to mark. After each move, the program displays the changed board. See the sample 2-player game.

In the 1-player version, the computer should just choose random open squares. See the sample 1-player game.

To play a version of this game, open a Terminal on the rockhopper or opus servers or in a Linux lab, and run

 $ ~jchung/cs699/tttoe

A program template is available for TicTacToe.cpp, with essential functions included. You must use this template as the basis of your program.


cs509/cs-699_sp13_assignment_5.txt · Last modified: 2013/03/29 20:50 by jchung

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki