Assignment #2

Due Midnight, Wednesday Oct. 2, 1996

A simple game familiar to most is Tic-Tac-Toe. The Object of the game is to fill three squares horizontally, vertically, or diagonally with your symbol (X or O) in a 3x3 grid.
Implement the following program in Pure Xlib (i.e. no motif or any other widget set):

NAME

TTT - Tic Tac Toe game for two persons

SYNOPSIS

TTT user1@display1 user2@display2

DESCRIPTION

The program starts by inviting user2 at display2 to play the game with user1 at display1. The invitation window is composed of window that has a message area containing the string:

"user2: Would you like to play Tic-Tac-Toe with user1 at display1?"

and two buttons labeled "YES" and "NO".

If user2 clicks on "NO", it displays to user1 a window with a message area containing the string:

"user2 does no want to play with you"

and a button labeled with "OK".
Clicking on "OK" terminates the program.

If user2 clicks on "YES", a Tic-Tac-Toe board of 3x3 squares appears on each of the two displays. The program lets user2 play first, then it strictly alternates between them until the game is over with either a winner or a tie. When the game is over, the program displays a window to each user with a message area containing:

"user1/2 is the winner" Or "No winner, it is a tie"
"Would you like to play another game?"

and two buttons labeled "YES" and "NO".
If both users clicks on "YES", another game is played. In this case, the person who played first last game will play second. If any user clicks on "NO", the program terminates.


Back to Assignments Page
Back to CS476/576 Home Page