Question: Use Java programming language Write a class that encapsulates a tic-tac-toe board. A tic-tac-toe board looks like a table of three rows and three columns

Use Java programming language

Write a class that encapsulates a tic-tac-toe board. A tic-tac-toe board looks like a table of three rows and three columns where two players alternate filing its cells with X(player1) and O (player2). A players wins if he/she manages to align three tokens (X or O) in a row, a column or diagonally.

You class should include the following methods:

startSession() that is called by the client class to start a game session

play() that defines the move of a player. It accepts the player id, the row and the column to be set.

A constructor() to initiate the tic-tac-toe object

Any other needed method for setting/getting the fields.

Note: The tic-tactoe class should draw the status of the table after each move.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!