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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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. 

Sample Output
WELCOME TO THE TREASURE HUNT GAME!!
The object of this game is to find the treasure:
located somewhere on a 10x10 board. Enter row and
column guesses (0-9) and receive a clue to the treasure
location. Each guess will deduct $50 from the treasure
value. Here are some clues you may receive:
'U3' means go up three rows.
'D4'
means go down four rows.
means go to the right.
means go to the left.
means no information this turn.
'<-
'?
'+$' means $50 was added to the treasure.
'-$' means an extra $50 was deducted from the treasure.
GOOD LUCK IN THE TREASURE HUNT!!!
Press enter to continue
First, the program prints instructions and uses cin.get() to pause until the user presses the enter key.
The location is: 5, 0
0
1
2
3
4
5
0 1 2 3 4 5 6 7 8 9
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ##
## ## ## ## ##
## ## ## ## ## ## ##
## ## ##
## ## ## ## ## ##
## ## ## ##
6
## ## ## ## ## ## ## ## ## ##
7 ## ## ## ## ## ## ## ## ## ##
8 ## ## ## ## ## ## ## ## ## ##
9 ## ## ## ## ## ## ## ## ## ##
The treasure is 1000.00
Enter row: 5
Enter col: 1
0 1 2 3 4 5 6 7 8 9
0
1
2
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
4 ## ## ## ## ## ## ## ## ## ##
5 ## <- ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
3
6
7
## ## ## ## ## ## ## ## ## ##
8
## ## ## ## ## ## ## ## ## ##
9 ## ## ## ## ## ## ## ## ## ##
The treasure is 950.00
For testing purposes, at the start of the game I print the location of the treasure. I made a guess at 5, 1. It then
reprinted the board and the random clue told me I need to guess to the left of the column I selected. Also, 50$ was
deducted from the treasure, as will happen every turn.
Transcribed Image Text:Sample Output WELCOME TO THE TREASURE HUNT GAME!! The object of this game is to find the treasure: located somewhere on a 10x10 board. Enter row and column guesses (0-9) and receive a clue to the treasure location. Each guess will deduct $50 from the treasure value. Here are some clues you may receive: 'U3' means go up three rows. 'D4' means go down four rows. means go to the right. means go to the left. means no information this turn. '<- '? '+$' means $50 was added to the treasure. '-$' means an extra $50 was deducted from the treasure. GOOD LUCK IN THE TREASURE HUNT!!! Press enter to continue First, the program prints instructions and uses cin.get() to pause until the user presses the enter key. The location is: 5, 0 0 1 2 3 4 5 0 1 2 3 4 5 6 7 8 9 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## 6 ## ## ## ## ## ## ## ## ## ## 7 ## ## ## ## ## ## ## ## ## ## 8 ## ## ## ## ## ## ## ## ## ## 9 ## ## ## ## ## ## ## ## ## ## The treasure is 1000.00 Enter row: 5 Enter col: 1 0 1 2 3 4 5 6 7 8 9 0 1 2 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## 4 ## ## ## ## ## ## ## ## ## ## 5 ## <- ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## 3 6 7 ## ## ## ## ## ## ## ## ## ## 8 ## ## ## ## ## ## ## ## ## ## 9 ## ## ## ## ## ## ## ## ## ## The treasure is 950.00 For testing purposes, at the start of the game I print the location of the treasure. I made a guess at 5, 1. It then reprinted the board and the random clue told me I need to guess to the left of the column I selected. Also, 50$ was deducted from the treasure, as will happen every turn.
Enter row: 5
Enter col: 1
That guess has been made. Try again.
Enter row: 5
Enter col: 2
01 2 3
+7
7
8
9
0
1
2
3 ## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
5 ## ## -$ ## ## ## ## ## ## ##
6
อ
17
9
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ##
## ## ## ##
1
2
3
5
The treasure is 850.00
Enter row: 7
Enter col: 2
4
5
When trying to guess the same place twice, I get an error. Once I put in a correct guess at 5, 2, I got a -$ as my
random event which not only took the 50$ per turn fee, but also an additional 50$ from my treasure.
6
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
17
7 8
## ## ## ## ## ## ## ## ## ##
9
## ## ## ## ## ## ## ## ## ##
0 1 2 3 4 5 6 7 8
## ## ## ## ## ## ## ## ## ##
4
5
6
7
18 ## ## ## ## ## ## ## ## ## ##
19 ## ## ## ## ## ## ## ## ## ##
The treasure is 800.00
Enter row: 8
Enter col: 2
0 1 2 3 4 5
## ## ## ## ##
##
## ## ## ##
##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ##
## ## ## ## ## ## -> ## ##
##
##
##
6
0
1 ## ## ## ## ## ## ## ## ## ##
2
3 ## ## ## ## ## ## ## ## ## ##
6 7 8 9
## ## ## ## ## ## ## ## ## ##
##
##
## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ##
## ## ## ##
8 ## ## U3 ## ## ## ## ## ## ##
9 ## ## ## ## ## ## ## ## ## ##
The treasure is 750.00
I guessed 7,2, it told me I should guess to the left of column 2 again, and then it told me I should guess 3 rows up
from row 8.
Transcribed Image Text:Enter row: 5 Enter col: 1 That guess has been made. Try again. Enter row: 5 Enter col: 2 01 2 3 +7 7 8 9 0 1 2 3 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## 5 ## ## -$ ## ## ## ## ## ## ## 6 อ 17 9 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## 1 2 3 5 The treasure is 850.00 Enter row: 7 Enter col: 2 4 5 When trying to guess the same place twice, I get an error. Once I put in a correct guess at 5, 2, I got a -$ as my random event which not only took the 50$ per turn fee, but also an additional 50$ from my treasure. 6 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## 17 7 8 ## ## ## ## ## ## ## ## ## ## 9 ## ## ## ## ## ## ## ## ## ## 0 1 2 3 4 5 6 7 8 ## ## ## ## ## ## ## ## ## ## 4 5 6 7 18 ## ## ## ## ## ## ## ## ## ## 19 ## ## ## ## ## ## ## ## ## ## The treasure is 800.00 Enter row: 8 Enter col: 2 0 1 2 3 4 5 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## -> ## ## ## ## ## 6 0 1 ## ## ## ## ## ## ## ## ## ## 2 3 ## ## ## ## ## ## ## ## ## ## 6 7 8 9 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## 8 ## ## U3 ## ## ## ## ## ## ## 9 ## ## ## ## ## ## ## ## ## ## The treasure is 750.00 I guessed 7,2, it told me I should guess to the left of column 2 again, and then it told me I should guess 3 rows up from row 8.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 12 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education