The assignment is to design and implement the game of Tic Tac Toe (in Java). The game should allow for two players to play each other. You can choose which of the two players begins. The players should continue to take turns until there is a winner or until there is a stalemate. The game should be played in terminal mode, there should NOT be a graphical component to this game.
The program should begin with a welcome message indicating the purpose of the program. To begin the game, the program should display the initial (empty) board. It should then prompt each player to enter the space they would like to move to. If the space is free, the move should be accepted else, the move should be rejected and they should be prompted to enter another space. The program should display the updated board with each accepted move. When appropriate, the program should check the board for a winner. If the program finds a winner it should congratulate the winner. In summary the program should:
Following is an example run:
+--+--+--+
| | | |
+--+--+--+
| | | |
+--+--+--+
| | | |
+--+--+--+
Player O Enter your move: 1,1
+--+--+--+
|O | | |
+--+--+--+
| | | |
+--+--+--+
| | | |
+--+--+--+
Player X Enter your move: 2,2
+--+--+--+
|O | | |
+--+--+--+
| |X | |
+--+--+--+
| | | |
+--+--+--+
Player O Enter your move: 1,2
+--+--+--+
|O |O | |
+--+--+--+
| |X | |
+--+--+--+
| | | |
+--+--+--+
Player X Enter your move: 1,3
+--+--+--+
|O |O |X |
+--+--+--+
| |X | |
+--+--+--+
| | | |
+--+--+--+
Etc...
NOTE: Alternatively, you can make your program friendlier by numbering each empty square and allowing the user to name the square using that number instead of entering of the row number and col number of the square. The following is an appropriate naming scheme:
+--+--+--+
|1 |2 |3 |
+--+--+--+
|4 |5 |6 |
+--+--+--+
|7 |8 |9 |
+--+--+--+
At the end of each game have the program prompt (the players) if they want to play another game. If they enter in the affirmative i.e. (v/Y)es the program should continue and play another.
Design and Develop an Object Oriented class structure that allows you to play continuing rounds of two different types of turn based board games. Tic-tac-toe, and a close variant called order and chaos. Please make sure you understand the game of order and chaos before you begin.
The specification for the tic-tac-toe game has not changed. However, your tic-tac-toe game should be able to seamlessly scale from a 3x3 board to an n x n board as specified.
Care should be given to your object design. Your class design should center on the logical objects that are needed to play these games and variants of. Your design will be evaluated not simply on correctness of play, but on scalability and extendibility.
To test for correctness. Consider the following scenarios:
To test for scalability, consider the following scenarios:
This is not an expectation of this submission, however, the ability to do will earn bonus points.
Scalability is not limited to the state of play. Scalability can also imply learning and intelligence. What if (at some point in the future) you wanted to make a smart game that learned from each round. Specifically, given the size of the board, which is the best starting point, or which is the most popular starting point, etc. This would require information to be maintained by each round, and even each cell of the board. This is not an expectation of the current submission, but the ability to allow for this type of scalability is not unreasonable and your design will be evaluated accordingly.
To check for extendibility, consider if your class design would be easily extendible to other turn based games like sorry, monopoly or card games, or other cell based board games like connect four, or chess, etc.
And in fact, you may be asked to extend this object structure to play another turn based game of your choice or by specification.
Your program will be evaluated as follows: