Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this exercise, you will complete the tictactoe Board that we started in the 2D Arrays Lesson We will add a couple of methods to

image text in transcribed
For this exercise, you will complete the tictactoe Board that we started in the 2D Arrays Lesson We will add a couple of methods to the Thetactoe class. To track whose turn it is, we will use a counter turn. This is already declared as a private instance variable. Create a getturn method that returns the value of turn. Other methods to implement 1. printBoard() - This method should print the reactor array onto the console. The board should include numbers that can help the user figure out which row and which column they are viewing at any given time Sample output for this would be: 2. potocnion(nt row, int col) - This method returns a boolean value that determines If the spot a user picks to put their place is volld. A valid space is one where the row and column are within the size of the board, and there are no X or values currently present 3. takuturn(int row, int col- This method adds an X or to the array ot position row.col depending on whose turn it is. If it's an even turn, X should be odded to the array, if it's odd, O should be added. It also adds one to the value of turn. 4. c)-This method returns a boolean that determines if o user has won the game. This method uses three methods to make that check Cocacos - This checks if a player has three X or values in a single column, and returns true if that's the case. thecus - This checks if a player has three X or O values in a single row. check. This checks If a player has three X or o values diagonally, checkoon only returns true if one of these three checks is true

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_2

Step: 3

blur-text-image_3

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions

Question

What is a 4PL? When would you use a 4PL instead of a 3PL?

Answered: 1 week ago