Question
Game Features Create UI similar to the illustration Use fonts, color, images etc. to make the game look interesting The treasure field is 10 by
Game Features
Create UI similar to the illustration
Use fonts, color, images etc. to make the game look interesting
The treasure field is 10 by 10 locationsEach location can be clicked to reveal
A treasure, or
Nothing
Treasures Left shows the number of treasures left on the board starting with 20
Treasures Found shows the number of treasures the user has found
Tries Left shows the number of clicks on the board the user has left
Counting each field only once
The game starts with 50 tries available
Last Move shows whether the last click on the board revealed a treasure, a miss, or if the game is over.
User Stories
1. As a user, I can see the title of game so that I know what I will be playing.
2. As a player, I can see a board of 10 by 10 locations where I can click, so that I can play the game.
3. As a player, when I click on a location on the board where there is a treasure, the Treasures Left is reduce by one, and the Treasures Found is increased by one , so that I can see how successful I have been so far.
4. As a player, when I click on a location on the board, the location changes so that I can see if there was a treasure randomly placed at the location.
5. As a player, I can see how many treasures that are hidden on the board, so that I know how far away from winning I am.
6. As a player, I can see how many treasure of the 20 treasures that I have discovered so far, so that I can see how successful I have been.
7. As a player, I can see how many of the 50 tries/turns I started with are left, so that I can see how far I have to go.
8. As a player, when I click on a location on the board, the Tries Left is reduced by one, so that I know how many tries I have left .
9. As a player, when I click on a location that I have already clicked, nothing happens, so that I cannot fake finding treasures.
10. As a player, when I click on a location, the Last Move fields shows: "Miss" - if there was nothing at the location "Treasure" - if there was a treasure at the location "Game Over - You win" - if there are no treasures left "Game Over - You lose" - if there are treasures more left but no tries
11 As a player, when I have no more tries left, clicking on the board locations does nothing.
12 As a player, when I have no more tries left, I can see where all the treasures are on the board.
Technical Implementation
These are the instructions for the technical implementation:
Implement each story one at a time in the order given.
Keep each class in a separate file. Use the CRC card format from the Chapter 8 (p. 547-548) to explain in a comment right before the class definition what the responsibilities and functions of the class are.
Use a border layout for the main window (or another layout that allows the design above).
Use a grid layout for the board and two nested for-loop to populate the board.
Extend the JButton class to create a BoardButton class instances of which are the contents of the board
Set the default text or icon for an unclicked button in the constructor
Make the button disabled when it is clicked.
Extend the JButton class to create a TreasureButton class instances of which are on the board
Change the look of the button when a user clicks on it: change the text or the icon
As you create the buttons, keep them in an array so that you can easily access them later.
The main method should simply contain: new TreasureGame().play();
Do not use instanceof, or break, except inside of switch statements.
Keep the code tidy (with comments and indentation) because you will be building on it over the next weeks.
Sreaoure Cunt Treasures left: 12 Treasures found: 8 Tries left: 27 Last move: Treasure Miss/You won /You loseStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started