High-level language programming project
Total class hours:64 Theory class hours:0 Practice class hours:64
Title: TicTacToe Class
Introduction:
1 |
| 2 |
| 2 |
|
2 |
| 1 |
The Tic-Tac-Toe game is played on a 3-by-3 board like the figure above. Two players alternate at placing 1's and 2's into 3 x 3 playing field. Before the game starts, both players have to agree about who will go first and who will mark his moves with which symbol. After the first move, the players alternately place their marks in any empty square. The goal of the game is to be the first player with three marks in a horizontal, diagonal or vertical line. If there are no empty cells and neither player has a winning combination, the game is a draw.
Basic requirements:
Create a class TicTacToe that will enable you to write a complete program to play the game of tic-tac-toe.
1. The class contains as private data a 3-by-3 two-dimensional array of integers.
2. The constructor should initialize the empty board to all zeros.
3. Allow two human players. Wherever the first player moves, place a 1 in the specified square. Place a 2 wherever the second player moves. Each move must be to an empty square.
5. After each move, determine whether the game has been won or is a draw.
Advanced requirements:
If you feel ambitious, modify your program to achieve some advanced features.
1. Users can specify the two symbols which will be used for marking the moves. Generally, these two symbols are defaulted as "1","2". Each symbol corresponds to one player.
2. The system automatically randomly determines which symbol will be marked first.
3. The system supports to go back with one move.
Marking criterion
Total score 100pts
1. functions of basic requirements 50%
2. functions of advanced requirements 20%
3. style of programming 10%
4. report 10%
5. defense 10%
Late submission will be punished.
1) 1~3 day late-> -10pts
2) 3~5 days late-> -20pts
3) >=5 days late-> -50pts