Unformatted Attachment Preview
CSCI - 2525
FINAL EXAM
Fall 2016
DUE: 10 DEC 2018; 11:59PM
Problem: Write a program that simulates the game of Tic-Tac-Toe.
Specifications.
There are three possible modes in which the user can play. Player vs Player, Computer vs Player and
Computer vs Computer. The user will select which mode will be played.
1. You must use a two-dimensional array and Base-Index operands (Row-major order)
throughout the game. The game board is created with characters, if you get fancy with the
board that will not earn you extra credit.
-
-
1 -
1 -
1 -
This is an example of the empty board.
-
- 1 x I -
This is an example of a game in progress.
You must see the color
and the letter.
-
-
.
-
1
2. All Procedures will be called with PROTO/INVOKE/PROC. I will be checking for this. DO NOT
USE USES except for the Irvine32 library. Remember the Irvine Library instructions must be
called with CALL.
3. Randomly choose who will go first. The first player/computer will be assigned the letter x.
a. The computer chooses a move by selecting an open position randomly. (We are not
developing Artificial Intelligence so don't waste your time on this).
i) However, if the game is player vs computer, and the center square is
available on the computer's first turn, the computer MUST choose that
square (regardless of whether or not the computer is the first or second
player). This also holds true for computer1 vs computer2. Remember in PVC
it may be that the player does not choose the center square if they are the
first player.
ii) Afterwards, or if the center square is taken (see above) all moves by the
computer will be random.
b. The player will enter a move via the keyboard.
i) You must check to see if it is a valid move, i.e. not an already occupied
'square', or a square that is non-existent.
ii) Keep asking for a move until a valid move is entered.
CSCI - 2525
FINAL EXAM
Fall 2016
Deliverables:
1. Your code must be delivered on Canvas. Plan ahead, Canvas will not allow you to submit the
code late. If for some reason, CANVAS is down, then you may email me your code.
If you submit your code late, I will not accept an email unless Canvas is down for an extended period
of time.
2. You must also upload a screen shot (pdf only please) of
a) the player vs computer game in progress after 3 moves have been made
b) a completed game (this can be any from version of the game).
For extra credit (up to 35 points): You can do something unique. I leave it to you to challenge
yourselves to find something which merits extra credit. How much extra credit is awarded will
depend on what you successfully implement. If you choose to do the extra credit, you must
submit two files (the exam and the extra credit.)
To be eligible for extra credit you must complete the exam
First
A couple of ideas:
1. Larger tic-tac-toe boards (instead of 3x3, 4x4, 5x5 or user defined up to some limit).
2. Ultimate tic-tac-toe. (This has been successfully implemented in the past.)
3.3-player tic-tac-toe (X, O, Y). The board is 5x5 and the first player to get three in a row wins.
Be creative.
NOTE: Be sure to tell me what you have done that you feel merits extra credit, especially if it is
something to do with how you code the project (i.e. use of structs).
CSCI - 2525
Fall 2016
FINAL EXAM
iii) As the player selects a square, that square's background should turn to
yellow (x) or cyan (o), depending on whose turn it is. The foreground will
be black
iv) Do not assume the player knows how you have the board set up, you MUST
tell the player how to select a square. EX. Select a row and column.
c. After each move, clear the screen and redisplay the updated game.
d. At the conclusion of each game of tic-tac-toe, ask if the player wishes to play again.
Yes, even if it is computer vs computer.
e. Have a menu option that allows the user to check statistics. If you choose to add
more statistics you can, but it won't get you extra credit.
i) How many PvP games played
ii) How many PvC games played
How many CVC games played
iv) How many games resulted in a draw
f. When the user chooses to exit the program, the above statistics will be displayed until
a key is pressed.
4. If the game is computer vs computer, after each move display the current state of the game
for 1 second, before allowing another move to be made. The user just watches the game being
played.
5. When the game ends, display who won (player 1 or player 2) or if the game was a draw.
a. If someone (either player or computer) wins, highlight the winning path (either three
x's or three o's) with blue on white as the final display.
6. The game will start with a menu. The options are player vs computer, computer vs
computer, player vs player, and exit.
7. As always, variables used by a procedure must either be passed to that procedure or created
within the procedure. Only Main PROC can directly access the variables initialized in .data. All
others must be local to the procedures.
8. Style counts to include proper commenting. You must at the beginning of your code)
include your name and any special functionality you have implemented.
9. I reserve the right to award extra credit for innovative code and implementation thereof.