Assignment #3
Due Midnight, Wednesday Oct. 16, 1996
Implement the following program in Motif:
NAME
TTT - Tic Tac Toe game for two persons
SYNOPSIS
TTT
DESCRIPTION
The program starts by displaying an Invitation Interface (II).
II has the following widgets:
- Text Field1 : containing your information "user1@display1"
- Text Field2 : containing the other player information "user2@display2"
- Push Button1: labeled "Send Invitation" to go ahead and send invitation to user2.
- Push Button2: labeled "Exit", to quit the TTT application.
- Label Widget: To display the status of the invitation.
One of the following messages is to be displayed:
- Could not open display display2
- Waiting for response from user2@display2
- user2@display2 declined the invitation.
- Time out (10 seconds), no response from user2@display2
Push Button1 should become insensitive during the waiting period of 10 seconds,
i.e., allow only one invitation at a time.
If an invitation fails (due to decline or timeout),
you may change the content of Text Field2 and issue another invitation.
On user2@display2 a Dialogue widget appears 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 YES, The II of user1 disappears and
a Tic-Tac-Toe board of 3x3 push buttons 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 it is not a user's turn, the whole board becomes insensitive.
When it is a user's turn, only the unchecked buttons becomes sensitive.
When the game is over, the program displays a dialogue widget 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