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,...
-
The table shows the tax, in dollars, on a pack of cigarettes in each of the 50 states and Washington, DC, as of January 2014. Note: The state with the lowest tax is Missouri and the state with the...
-
Explain the differences between the techniques for determining sample sizes for discrete versus continuous variables (population measures).
-
What approach(es) are used to analyze impairment on available-for-sale and held-to-maturity debt securities?
-
Sekhon Company had a beginning inventory on January 1 of 160 units of Product 4-18-15 at a cost of $20 per unit. During the year, the following purchases were made. 1,000 units were sold. Sekhon...
-
a bank has a base loans rate of 4.75% and for the loan under consideration would apply a 2% risk premium. the bank also required compensating balance (non-interest bearing) equal to 5% of loan...
-
You will play the roles of a Freight Forwarder and a materials and distribution manager for Apotex Pharmaceuticals in Toronto. Your role is the materials and distribution manager for Apotex...
-
As a treasurer of dollar opt bank . You have sold forward USD to your customers and cover your own USD exposure. Current rates are @ INR 75/usd. However, apprehending volatility in the forex market,...
-
Riverwood Accounting Company has the following account in its cost records: Work in Process Jones Audit Direct labor 2 0 0 , 0 0 0 Services completed 4 2 2 , 5 3 0 Project overhead 2 7 0 , 0 0 0...
-
Renter Company acquired the use of a machine by agreeing to pay the manufacturer of the machine $7,500 per year for 10 years. At the time the lease was signed, the interest rate for a 10-year loan...
-
What type of web server is sending packet/frame 280 of the capture? 2. What type of HTTP Status Code is the web server in packet/frame 314 sending? Google the error and provide a quote summarizing...
-
A manager at a busy restaurant is known for yelling and slamming doors when customer orders are not delivered on time. According to Ontario's Human Rights Code, this is an example of what?
-
1.Available subnet 192.168.4.0/24 Create 8 subnets Write down the new subnet mask Write down the number of Hosts in one subnet Write down the subnet ranges 2.Available subnet 148.16.0.0/16 Create 60...
-
Which allocation method do you think is best (CCR, RVU, ABC)? Time-driven activity-based costing is extremely detailed but do you think it is practical?
-
The figure shows six containers, each of which is filled from the top. Assume that water is poured into the containers at a constant rate and each container is filled in 10 seconds. Assume also that...
-
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...
-
\(\frac{b^{6}}{b^{19}}\) Simplify the expression.
-
\(\frac{c^{9}}{c^{4}}\) Simplify the expression.
-
\(\frac{15^{14}}{15^{11}}\) Simplify the expression.
Study smarter with the SolutionInn App