Tic Tac Toe Object This Object will contain the game state of a single game by...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Tic Tac Toe Object This Object will contain the game state of a single game by storing a 2D array of chars. For this game, we will use the char'' to represent an empty tile and the chars 'X' and 'O' for both the player id and the tile on the board. Complete the following methods. a. Create a new char[][] board of 3x3 size and set all chars to " public TicTacToe() b. Create a new char[] board of size size and set all chars 10. public Tic Tac Toe(int size) c. Create a new char|| board that is the same size as startingArray and assign it the provided values equal to starting Array. You should not assign starting Array directly, but instead copy the values over individually (deep copy). public Tic Tac Toc(char[] startingArray) Tip: Test these constructors before moving forward. If they do not work, nothing else will. d. Set all entries in the board to signifying an empty tile private void initBoard() e. Is the given tile empty (equal to') public boolean isEmpty(int row, int col) f. Find and return the char value at the given tile location. public char get Tile(int row, int col) g. Set a given array location to the provided value (should be 'X' or 'O' in this case.) public void set Tile(int row, int col, char player) Tic Tac Toe Object This Object will contain the game state of a single game by storing a 2D array of chars. For this game, we will use the char'' to represent an empty tile and the chars 'X' and 'O' for both the player id and the tile on the board. Complete the following methods. a. Create a new char[][] board of 3x3 size and set all chars to " public TicTacToe() b. Create a new char[] board of size size and set all chars 10. public Tic Tac Toe(int size) c. Create a new char|| board that is the same size as startingArray and assign it the provided values equal to starting Array. You should not assign starting Array directly, but instead copy the values over individually (deep copy). public Tic Tac Toc(char[] startingArray) Tip: Test these constructors before moving forward. If they do not work, nothing else will. d. Set all entries in the board to signifying an empty tile private void initBoard() e. Is the given tile empty (equal to') public boolean isEmpty(int row, int col) f. Find and return the char value at the given tile location. public char get Tile(int row, int col) g. Set a given array location to the provided value (should be 'X' or 'O' in this case.) public void set Tile(int row, int col, char player)
Expert Answer:
Answer rating: 100% (QA)
Answer here is the code for the TicTacToe object public class TicTacToe private char board public Ti... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
The core problem of a command-and-control approach to environmental policy is its inherent bias or tendency to standard-setting practice that is uniformly applicable to all situations. For example,...
-
A standard 4 in. steel pipe (ID = 4.026 in., OD = 4.500 in.) carries superheated steam at 1200?F in an enclosed space where a fire hazard exists, limiting the outer surface temperature to 100?F. In...
-
For each of the service business transactions of a dentist listed below, you are to enter in the Workbook: a the account name, with the debit account first b whether the account entry is a debit or...
-
Some of the prior interviews suggest that the company is so cheap that they wont pay people what they are worth. Have you had similar experiences?
-
Pickle Motorcycles, Inc. (PMI), manufactures three motorcycle models: a cruising bike (Route 66), a street bike (Main Street), and a starter model (Alley Cat). Because of the different materials...
-
At some point in the life of a company or firm, a decision of how to expand is necessary. This is especially important in for-profit firms as shareholders typically require larger and larger...
-
Use the from step b) to compute the monthly excess outperformance (or underperformance in case the number is negative) of Fund X. The formula is: RX - RVG (as a reminder Rx and Rvg are excess returns...
-
Bryant Company reports net income of $22,600. For the year, depreciation expense is $9,500 and the company reports a gain of $5,600 from sale of machinery. It also had a $4,600 loss from retirement...
-
Discuss one company or sustainable practice that has improved the supply chain to reduce waste, recycle material, or replenish resources. Examine the supply chain sustainability model and if there is...
-
Discuss the relationship Matrix and how companies prioritize some relationships over others. How will this impact the future of how the supply chain operates? Examine what motivates businesses to...
-
Discuss the role of the business in determining how best to source the material for their products and expand on the following concepts. Discuss the How It's Made video or "Biodiversity in Our...
-
A square picture has a 1-inch frame around it. If the area of the frame alone is 40sq inches, what is the area of the picture?
-
how are the four ps used in the brand under armour (product, price, place, and promotio) 3 buisness or social cultural considerations in translating marketing plans for under armour in foreign...
-
(30pts total) This problem involves the Boston housing dataset BostonHousing in the R package mlbench. The goal is to predict per capita crime rate using the other variables in this dataset. In other...
-
Explain what is meant by vicarious liability and when it is available?
-
Which of the following is true if a successfully running program contains the following statement: Arrays.fill(tax, 10); a. Tax is a two-dimensional array. b. fill() is a nonstatic method. c. Tax is...
-
Write an application that asks a user to type an even number or the sentinel value 999 to stop. When the user types an even number, display the message Good job! and then ask for another input. When...
-
Suppose that you have created a program with only the following variables. int age = 34; int weight = 180; double height = 5.9; Suppose that you also have a method with the following header: public...
-
For the probability distribution in Exercise 14, find the sampling distribution of the sample mean for all samples of size \(n=2\). (Hint: The sample means will be the same as given in Figure 3.7,...
-
Minitab can also be used to create a graphical summary of a given variable. The graphical summary can be found by selecting the Stat menu; under Basic Statistics a. Using Minitab, create a graphical...
-
Often we may be interested in comparing the amount of variability between two different data sets. This can be done using the sample coefficient of variation \((C O V)\), which is a percentage that...
Study smarter with the SolutionInn App