Specify, design, and implement a class that can be one player in a game of tic-tac-toe. The

Question:

Specify, design, and implement a class that can be one player in a game of tic-tac-toe. The constructor should specify whether the object is to be the first player (Xs) or the second player (Os). There should be a method to ask the object to make its next move and a method that tells the object what the opponent’s next move is. Also include other useful methods, such as a method to ask whether a given spot of the tic-tac-toe board is occupied and, if so, whether the occupation is with an X or an O. Also include a method to determine when the game is over and whether it was a draw, an X win, or an O win.

Use the class in two programs: a program that plays tic-tac-toe against the program’s user and a program that has two tic-tac-toe objects that play against each other.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: