Take I

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:

  • maintain the configuration of the board as the game goes on
  • prompt the users to enter their moves in alternate turns
  • display the newly updated board
  • check for a winner and declare the player that won if one is found
  • If all squares on the board have been occupied without a winner, the program should announce a stalemate.

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.

Take II

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:

  • Is it possible to create a board with a different number of rows and columns?
  • Is it possible to select a position on the board that has previously been selected or not even on the board?
  • Is it possible for the game to never end?

To test for scalability, consider the following scenarios:

  • Board scalability: Should your game be played with different size boards and run seamlessly? This is a reasonable expectation that we will test for in the game of tic tac toe. Keep in mind though that board scalability is not infinite and ceilings should be placed on the size of the tic-tac-toe board. Additionally not all games should allow for board scalability. The implementation of the game of order and chaos should only allow for play on a 6x6 board, following the original specified winning rules. Consider carefully though, how you place and enforce these ceilings.
  • Player scalability: It is not unreasonable to consider playing with teams. Playing turn based games with teams can be accomplished multiple ways, here are a couple:
    • Each team can alternate players during each round.
    • Each round of the game can be played by two specific team members, and new team members can be randomly selected for each subsequent round.

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:

  • Object Design, with an emphasis on:
    • Scalability
    • Extendibility
  • Implementation, with a specific emphasis on:
    • Readability
    • Best practices
  • Usability
  • Program (and game) Correctness
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.