1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sliva [168]
3 years ago
7

Write a class named FBoard for playing a game, where player x is trying to get her piece to row 7 and player o is trying to make

it so player x doesn't have any legal moves. It should have: An 8x8 array of char for tracking the positions of the pieces.A data member called gameState that holds one of the following values: X_WON, O_WON, or UNFINISHED - use an enum type for this, not string (the enum definition should go in Board.hpp, before the class, not inside it).Data members to keep track of where the x piece is.A default constructor that initializes the array to empty (you can use whatever character you want to represent empty). It should then put four o pieces on row 7, in columns 0, 2, 4, and 6. It should put an x piece on row 0, column 3. It should also initialize the other data members.A method called getGameState that just returns the value of gameState.A method called moveX that takes as parameters the row and column of the square to move to. If the desired move is not allowed, or if the game has already been won, it should just return false. Otherwise it should make the move and return true. A piece belonging to x can move 1 square diagonally in any direction. A piece is not allowed to move off the board or to an occupied square. If x's move gets her piece to row 7, gameState should be set to X_WON.A method called moveO that takes as parameters the row and column to move from, and the row and column to move to. If the first pair of coordinates doesn't hold o's piece, or if the desired move is not allowed, or if the game has already been won, it should just return false. Othewise it should make the move and return true. A piece belonging to o can move 1 square diagonally, but the row cannot increase, so any o piece has at most two available moves. For example, if player o has a piece at (5, 2), it could move to (4, 1) or (4, 3), but not (6, 1) or (6, 3). It is not allowed to move off the board or to an occupied square. If o's move leaves no legal move for x, gameState should be set to O_WON.You do not need to track whose turn it is. Either move method can be called multiple times in a row. It doesn't matter which index of the array you consider the row and which you consider the column as long as you're consistent.Feel free to add private helper functions if you want. You may also find it useful to add a public print function to help with debugging.Do not access the array out of bounds. Make sure values are in bounds before using them to index into the array.
Engineering
1 answer:
OverLord2011 [107]3 years ago
7 0

Answer:

12345=V

Explanation:

You might be interested in
A river has an average rate of water flow of 59.6 M3/s. This river has three tributaries, tributary A, B and C, which account fo
Fiesta28 [93]

Answer:

50421.6 m³

Explanation:

The river has an average rate of water flow of 59.6 m³/s.

Tributary B accounts for 47% of the rate of water flow. Therefore the rate of water flow through tributary B is:

Flow rate of water through tributary B = 47% of 59.6 m³/s = 0.47 * 59.6 m³/s = 28.012 m³/s

The volume of water that has been discharged through tributary B = Flow rate of water through tributary B * time taken

time = 30 minutes = 30 minutes * 60 seconds / minute = 1800 seconds

The volume of water that has been discharged through tributary B in 30 seconds = 28.012 m³/s * 1800 seconds = 50421.6 m³

3 0
3 years ago
What are the two reasons for a clear cut
Inessa [10]

Answer:

to clear land for agriculture and settlement and to use or sell timber for lumber, paper products, or fuel.

3 0
2 years ago
Water from the Earth's surface turns into a gas, or water vapor, when it is warmed and
bagirrra123 [75]

Answer:

Evaporation.

Explanation:

Evaporation is the stage of the Water Cycle where water turns into water vapor. The steps following Evaporation in order include Condensation, Precipitation, and Transpiration.

4 0
3 years ago
Read 2 more answers
What kinds of problems or projects would a civil engineer work on?
lisov135 [29]

Answer:

simple projects bovonhztisgx

8 0
3 years ago
During January, at a location in Alaska winds at -20°C can be observed, However, several meters below ground the temperature rem
maw [93]

Answer:

a) \eta_{th} = 10.910\,\%, b) Yes.

Explanation:

a) The maximum thermal efficiency is given by the Carnot's Cycle, whose formula is:

\eta_{th} =\left(1-\frac{253.15\,K}{284.15\,K}  \right) \times 100\,\%

\eta_{th} = 10.910\,\%

b) The claim of the inventor is possible since real efficiency is lower than maximum thermal efficiency.

4 0
3 years ago
Other questions:
  • Suppose an underground storage tank has been leaking for many years, contaminating a groundwater and causing a contaminant conce
    8·1 answer
  • If you were choosing between two strain gauges, one which has a single resistor in a bridge that varies and one that has two res
    11·1 answer
  • After being purged with nitrogen, a low-pressure tank used to store flammable liquids is at a total pressure of 0.03 psig. (a) I
    13·1 answer
  • An aquifer has three different formations. Formation A has a thickness of 8.0 m and hydraulic conductivity of 25.0 m/d. Formatio
    9·1 answer
  • (a) In a 3-phase, 4-wire system, the currents are in the A, B, and C lines under abnormal conditions of loading were as follows:
    9·1 answer
  • For the system form of the basic laws, the momentum of a system can change as a result of: a. pressure acting on the system. b.
    14·2 answers
  • A 500-km, 500-kV, 60-Hz, uncompensated three-phase line has a positivesequence series impedance. z = 5 0.03 1 + j 0.35 V/km and
    11·1 answer
  • Which type of Bridge is considered the strongest in both compression and tension?
    11·2 answers
  • The branding, packaging, and labeling of your product should accomplish all of the following except
    12·1 answer
  • Which of following is not malicious ?<br> Worm<br> Trogan Horse<br> Driver<br> Virus
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!