Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you help me with this in JAVA please. Thank you Create a class to play a game of tio-tac-toe with a user. Then, write

Can you help me with this in JAVA please. Thank you
image text in transcribed
Create a class to play a game of tio-tac-toe with a user. Then, write a driver to play a game of tic- tac-toe between the computer program and the user, creating an instance of the class. The class should address the following design requirements in its 1) The class should ask the user if he wants to go first (be X) or second (be 0). programming 2) The class should have the ability to make 'intelligent" moves acting cither as the X-player or the 0-player. It sho make no illegal or impossible moves, nor remove any previous move until the game is over. 3) The class should have referee capability which can determine whether a move is a good move and also whether a game has been won by X-player or 0-player. It should stop the player from making an impossible move (c.g. one not on the game board) and an illegal move (c.g. one that attempts to place X or O over an already occupied location). 4) The class should re-display the current board after each move, and should have the following appearance, includin the matrix indices. (Take this as an example of a game in progress.) (2,0) 0(2,1) (2,2) 5) The user should be able to enter his move by answering at a prompt "Your move: "with the location of his next move: rc (that is, row#, column#). For instance, in the game above, the user being X could have responded with 2,2 - in which case he would have been notified that he won the game, "Tic-tac-toe!" But, for example, if the user had entered, 1,0 he would have been told that it is illegal to attempt to move on to an already occupied location. IMPORTANT: FOLLOW GOOD PROGRAMMING STYLE CONVENTION FOR NAMING ALL YOUR OBJECTS/VARIABLES. ADD COMMENTS ON TOP OF EACH METHOD AND AT TOP OF THE FILE (SEE EXAMPLE AT THE LAST PAGE)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago