Question: please do it in java language! thank you so much! e treasure is hniddei SoInewhhere l Che y-lu gr ces to guess iTs location. If

 please do it in java language! thank you so much! etreasure is hniddei SoInewhhere l Che y-lu gr ces to guess iTs

location. If the treasure is not at the guessed location, the program

informs the user about how far the treasure is from the location

please do it in java language! thank you so much!

e treasure is hniddei SoInewhhere l Che y-lu gr ces to guess iTs location. If the treasure is not at the guessed location, the program informs the user about how far the treasure is from the location guessed presently. Also, the second round on, the program presents a diagram that shows the present guess and the previous guess. Optionally, the program advises the user with the information of whether or not the guess got closer than the previous guess The program uses six global int variables: static int prevX, prevY, nowX, nowY, trueX, trueY; These are in pairs and represent the previous guess, the present guess, the true location. For preparation, the program explains the rule of the game as # A treasure has been hidden at a location in a 10x10 # # gird. Guess where it is. You have 10 chances. It sets -1 to nowX and nowY, assigns a random integer between 1 and 10 to trueX, and assigns another random integer between 1 and 10 to trueY Then the program enters a for-loop that iterates over the round numbers 1.. 10 with some int variable i. The body of the loop is executed only if either nowX != trueX or nowY != trueY. The actions to be performed in the body of the if statement is as follows: 1. Announce the round is the following format -- RoundM- Here M represents the round number and should be substituted with an appropriate value. 2. If the round is greater than or equal to 2, show the locations by calling the method show (see below 3. Store the values of nowX and nowY in trueX and trueY 4. Receive the guess (that is, the values for nowX and nowY)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!