You will develop a find the egg game, for which a user gets 3 tries to find the golden egg. Your program displays
a garden of flowers, represented as 4 x 4 grid. Users search for the hidden egg by clicking on individual cells in the
grid. Each cell in the grid displays an image of a flower or its number ranging from 0 .. 15. Various information
is displayed throughout the game, indicating whether the egg was or was not found, the number of tries left, and
whether the user wins or loses. A cheat button reveals the location of the egg. A reset button re-initializes the
game.
Requirements:
Define a class Flower Possible attributes for Flower are:
int numberID // 0 15, to indicate the Flowers location
boolean eggHere // indicates whether the egg is hidden in this Flower
When a cell is clicked, display its row and column location. You do not need to store attributes for the row and
column location of a Flower. If the cells in a m x n grid are horizontally numbered 0 .. (m*n-1), then the row
and column numbers can be calculated for a cell with number k :
RowNumber = k/n and ColNumber = k % n
Initialize (and thereafter in reset) the game by randomly hiding the egg.
Display various text/labels: the numberID of the flower just clicked, the number of search clicks so far, and
whether the game is ongoing, won, or lost. Display text/label that displays one of these messages as
appropriate:
Find the egg or You found the egg in flower 9!
When the egg is found in a given Flower, change the display for the relevant grid location in some way. For
example, the azalea might be replaced by a shining gold egg
Provide a cheat button that reveals the location of the egg
Display a reset button that re-initializes the game.
Display a nice heading that includes your name.
ou will need to have various global variables for storing the location number of the hidden egg, the number of
clicks, etc. Use other variables as you choose, for example, you might find it useful to keep a variable that holds a
mode, for example, 0, 1, 2 representing game in progress, game won, or game lost
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.