Treasure hunt Download

Charlie Lunetta

2d arrays, if statements, for loops, printing Polish needed


If you ever dreamed of one day finding buried treasure on the beach, this might be your lucky day!


Use a 2d array to represent a 10 x 10 grid of boxes. Your program should randomly place a "prize" into four of the boxes.

The computer then guesses boxes until it finds all the prizes. A few other constraints: - The program cannot place more than one prize in a box. - The computer cannot make a guess it has already made. - Track the number of guesses needed to find all the prizes. - Display the number of guesses needed to find each box when it has been found

Once all the boxes have been found, also display the total number of guesses needed.

Oh, yeah—you have to redraw the grid after each guess. Be sure to separate the "iterations" from each other in such a way that the user won't be confused.

Starter code

class Treasure{

Useful tools to solve the problem