Part1:

(1) Divide the content pane into two.

(2) In the first pane, create a 3x3 grid for Tic Tac Toe using JButton.

(3) You should to be able to play the game with a second human player by just clicking the buttons.

(4) Increase the font size to fill each square of the grid with either a X or an O.

(5) The second pane is for setting the ReStart Button and the text area.

(6) Additionally create a 3x3 two dimensional array called play, and store moves in it as the game is progressing.

(7) Using this array, declare a winner or a draw.

(8) Imagine what should happen before a game begins or play a game against yourself to understand what all you have to do before one plays the game.

(9) After that plan what classes you need.

(10) design your game and show to your lab instructors. When they approve the plan, go ahead and code it.

Part2:

Modify the game so that a human player plays the game with a computer that uses random moves.

Part3:

Modify the game so that a human player plays the game with a computer that makes smart moves.

What does it mean for a computer to make a smart move?

The computer looks at the game position, then for each possible move, the computer analyzes all possible outcomes before it chooses the best move.

So you have to write an analysis method that would enable the computer do this.

Those of you, who can do this give it a try.

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.