Game of Hunt in C++ language Create the 'Game of Hunt'. The computer ‘hides’ the treasure at a random location in a 10x10 matrix. The user guesses the location by entering a row and column values. The game ends when the user locates the treasure or the treasure value is less than or equal to zero. Guesses in the wrong location will provide clues such as a compass direction or number of squares horizontally or vertically to the treasure. Using the random number generator, display one of the following in the board where the player made their guess: U# Treasure is up ‘#’ on the vertical axis (where # represents an integer number). D# Treasure is down ‘#’ on the vertical axis (where # represents an integer number) || Treasure is in this row, not up or down from the guess location. -> Treasure is to the right. <- Treasure is to the left. -- Treasure is in the same column, not left or right. +$ Adds $50 to treasure and no $50 turn loss. -$ Subtracts additional $50 from treasure amount. ?? No information about the treasure available. This is essentially 'lose a turn' with no clue. The treasure is $1000. Each turn will decrease the treasure by $50. When the user locates the treasure, display the treasure amount and a win message. If the treasure is depleted to zero before the user finds it, display a lose message. Use a struct and functions in your program. At least on function must use pass-by-reference.
Game of Hunt in C++ language
Create the 'Game of Hunt'.
The computer ‘hides’ the treasure at a random location in a 10x10 matrix. The user guesses the location by entering a row and column values. The game ends when the user locates the treasure or the treasure value is less than or equal to zero.
Guesses in the wrong location will provide clues such as a compass direction or number of squares horizontally or vertically to the treasure. Using the random number generator, display one of the following in the board where the player made their guess:
U# |
Treasure is up ‘#’ on the vertical axis (where # represents an integer number). |
D# |
Treasure is down ‘#’ on the vertical axis (where # represents an integer number) |
|| |
Treasure is in this row, not up or down from the guess location. |
-> |
Treasure is to the right. |
<- |
Treasure is to the left. |
-- |
Treasure is in the same column, not left or right. |
+$ |
Adds $50 to treasure and no $50 turn loss. |
-$ |
Subtracts additional $50 from treasure amount. |
?? |
No information about the treasure available. This is essentially 'lose a turn' with no clue. |
The treasure is $1000. Each turn will decrease the treasure by $50. When the user locates the treasure, display the treasure amount and a win message. If the treasure is depleted to zero before the user finds it, display a lose message.
Use a struct and functions in your program. At least on function must use pass-by-reference.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 12 images