Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Objective Use Java GUI libraries and OpenGL to implement the Snake and ladder game. A. Introduction Snakes and Ladders is an ancient Indian board

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Lab Objective Use Java GUI libraries and OpenGL to implement the Snake and ladder game. A. Introduction Snakes and Ladders is an ancient Indian board game regarded today as a worldwide game. It is played between two or more players on a game-board having numbered, gridded squares. A number of "ladders" and "snakes" are pictured on the board, each connecting two specific board squares. The objective of the game is to navigate between the grids of the board, according to throw of dice, from the start (Bottom Square) to the finish (Top Square). 100 99 98 92 91 96 97 184 Os shutters 94 93 86 87 88 813 82 89 83 285 shutters 90 76 75 MiniDoodle 80 79 174 72 71 78 177 62 SA A AO 60 B. How to play the game? Assume that one payer plays the game only. The player will have a board filled with 10*10 cells, including ladders, snakes, buttons and a timer set to 3 minutes to finish the game. The player will begin from the start cell, he/she will roll a dice (a random number will be generated between land 6) The value of the dice will specify the new cell that the player will reach. This new cell will become the current position of the player + ValueOfDice. The details of the game are as follow: 1) There are 4 types of cells on the board: a. The blank cell. b. The cell with symbol 1, which denotes a ladder. When the palyer reaches this cell, he/she will move forward to a new cell according to the cell number specified by the arrow side, for example if the player reached 145, then the player will move forward to cell number 45. c. The cell with symbol 1, which denotes a snake. When the player reaches this cell, he/she will move backwards to a new cell according Os shutters 1815 shutters MiniDo 6> shuC72 100 99 98 92 91 96 94 93 82 184 586 87 88 89. 83 90 76 75 80 79 78 77 174 71 63 64 66 68 69 61 62 65 70 60 58 551 51 59 57 56 54 53 52 42 43 47 44 45 46 48 49 50 40 33 31 39 36 35 34 32 22 21 24 25 26 28 29 30 15 14 12 20 19 18 16 13 11 7 Cutters Mardile shutter 2 shutter 6 10 reaches this cell, he/she will move backwards to a new cell according to the cell number specified by the arrow side, for example if the player reached 125, then the player will move backwards to cell number 25. d. The cell with symbol ? which is a button. When the player reaches this cell, he/she has must click the button. After that, a pop up question with a 10 seconds timer will show up to the player. The question will have 3 choices thatll appear in the pop up window. The player will have to answer within the specified time, an then roll the dice to continue playing: i. If the player's answer was wrong or he/she failed to answer within 10 seconds, then the player will be subjected to a penalty of moving backwards according to a random generated number once the user press on the submit result button. a) The random generated number will have any value from one until the current position. ii. If the player's answer was correct during the 10 seconds, he/she will get a bonus of moving forward according to a random generated number once the user press on the submit result button. a) The random generated number will have any value from the current position until 100. e. Note The current cell that the player reached will have a color different from other cells. 2) Your game interface should include the 10*10 board, the 3 minutes timer and the rotating dice used. Note that in order to win the game; the player must arrive to the top square of the board (position 100) within 3 minutes. 3) Upon rotating the dice, if two consecutive rolls gave the same value, then this value will be added as a bonus to the last current position of the player. For example, if the two consecutive rotations gave the player a value of 4, then upon the second rotation of the cube the current position say 27 will be updated to 35; it will move 4 steps according to the value of the rotating dice and 4 more steps as a bonus for the user. 4) In each roll, the position of the player is changed under certain constraints. You should take into consideration the cells numbered 95 and above: a. If the current position of the player is cell 95, then the player won't be able to move forward if he/she get in the second roll a value of 6. In this case, the player has to roll the dice again to get a value less than 6. b. If the current position of the player is cell 96, then the player won't be able to move forward if he/she get in the second roll a value greater than 4. In this case, the player has to roll the dice again to get a value less than 5. c. If the current position of the player is cell 97, then the player won't be able to move forward if he/she get in the second roll a value greater than 3. In this case, the player has to roll the dice again to get a value less than 4. d. If the current position of the player is cell 98, then the player won't be able to move forward if he/she get in the second roll a value greater than 2. In this case, the player has to roll the dice again to get a value less than 3. e. If the current position of the player is cell 99, then the player will be able to move forward only if he/she get in the second roll a value of 1, else the player has to roll the dice again. C. Summary of Requirements: Create the rotating dice as requested by lab 5. Implement a method separately for the rotating dice. Create the game board with the following symbols and buttons. You can use setBorder(BorderFactory.createLineBorder (Color.BLACK,2)) to draw a border for each cell 100 99 98 97 96 95 93 92 91 179 94 ? 175 173 81 82 83 84 85 86 87 88 89 90 136 80 79 78 77 76 75 74 73 71 007 1 99 ? 72 191 61 63 65 66 67 68 69 70 62 119 64 160 100 99 98 97 96 95 93 92 91 94 ? 179 175 173 81 82 83 84 85 86 87 88 89 90 136 80 79 77 76 75 74 73 72 71 78 ? 199 191 61 62 63 64 65 66 67 68 69 70 119 160 60 59 58 57 56 55 54 53 52 51 ? 134 167 41 42 43 44 45 46 47 48 49 50 40 39 38 37 35 34 33 32 31 36 ? 21 22 24 25 26 27 28 29 30 23 ? 142 184 20 19 18 17 16 15 14 13 12 11 17 1 2 3 4 5 7 8 9 10 38 114 131 Add the 3 minutes timer to the interface. (You can import the Java Swing timer library) Make sure to apply all the mentioned rules for this game. D. Grading of the project: Page 4 Rotating dice with a random generated number (10 pts) Add the timer to the interface.(10 pts) Create the grid of the game and update the position of the player on the grid based on the rotating dice. (10 pts) Rotating dice with a random generated number (10 pts) Add the timer to the interface.(10 pts) Create the grid of the game and update the position of the player on the grid based on the rotating dice. (10 pts) Add ladders with functionalities (7 pts) Add snakes with functionalities (7pts) Add buttons with functionalities (30 pts) 14 pts for setting the questions and their answers. .6 pts for setting the timer for each question. - 10 pts for updating the position of the player based on the answer. Apply the constraint mentioned in part 3 (10 pts) Apply the constraints mentioned in part 4 (10 pts) The correct functionality of the game (The interface of the game: the grid, the timer & the rotating cube) (6 pts)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

Find the value of each expression if x = 2 and y = -1. 2xy -1

Answered: 1 week ago