subject

Description

Once these are done, create a class called Adventure and write the main method of your program in it (remember that the class that contains the main method is the one that you run). The first thing to do in main is to create a Player object and set its starting coordinates to (0,0). Also, you will need to create a new Map object. The idea in the Adventure class is that you loop repeatedly until the player dies (attacked by grue – see below) or finds the treasure (opens chest – see below). Every time the player moves, update the player's position and get the appropriate Room object from the map. Using this object, display the appropriate text to the user based on what command they type in. A list of commands is given below. Ignore case on the user input.

β€’ GET LAMP – If the lamp is present in the current room (there is a method in the Room class (i. e. getLamp()) that allows you to check this. Note the method’s return type and assign the return value accordingly), this transfers the lamp from the room to the player. Be sure to clear the lamp from the room afterwards. Print "OK" if successful, or "No lamp present" if not. Note: that you can find the lamp in a dark room.

β€’ LIGHT LAMP – If the player has the lamp, this sets it to lit. Print "OK" if successful, or "You don't have the lamp to light" if the player doesn't have the lamp.

β€’ NORTH, SOUTH, EAST, WEST – If the current room (prior to the move) isDark(), AND the player doesn't have the lamp OR they have the lamp but the lamp is not lit, the player is eaten by a grue and the game is over. (see below for an example). Otherwise, move the user North one square (-1 x), South one square (+1 x), East one square (+1 y), or West one square (-1 y). See table below to understand x and y in the context of the map. Once you move into a new room, you should print out its description, so the user doesn't have to type LOOK every time. Be sure to check the current room object to see if the given direction is valid. If not, print ("Can't go that way"). If the room (after the move) isDark() AND the player does not have the lamp OR the lamp is not lit, then instead of printing the description, tell them: "It is pitch black, you can't see anything. You may be eaten by a grue!". (see below for an example)

β€’ LOOK –If the room isDark() and the player does not have the lamp or the lamp is not lit, then instead of printing the description, tell them: "It is pitch black, you can't see anything. You may be eaten by a grue!". (see below for an example). Otherwise, this prints the description of the current room object, as well as any objects that are in the room. You should also print which exits from the room are valid. i. If the lamp is present in the room, print "There is an old oil lamp here that was made long ago" after you have printed out the room description. ii. If the key is present in the room, print "You see the outline of a key on a dusty shelf that's covered in dust." after you have printed out the room description. iii. If the chest is present in the room, print "There is a large, wooden, massive, oaken chest here with the word "CHEST" carved into it" after you have printed out the room description.

β€’ GET KEY – If the key is present in the room, this transfers the key to the user's inventory. Be sure to clear the key from the room afterwards. Print "OK" if successful, "No key present" if not.

β€’ OPEN CHEST – If the chest is present in the room and is unlocked, then this should print out the chest's contents and end the game. If the chest is locked, print "The chest is locked". If the chest is not present in the room, print "No chest present".

β€’ UNLOCK CHEST – If the user has the key, call the use() method with the chest object to unlock it, then print "OK". If the user doesn't have the key, print "Need a key to do any unlocking!". If the chest is not present, print "No chest to unlock". β€’ (anything else) – Just print "I'm sorry I don't know how to do that."

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:00
Speed is how fast an object moves a certain distance within a length of time. how is speed calculated? a) distance/time b) time/distance c) velocity/time d) distance x time
Answers: 1
question
Computers and Technology, 22.06.2019 11:30
Hassan is writing his master’s thesis, which is a thirty-page document. he received some feedback from his professor in the form of comments, but does not see where the comments are. what is the fastest way for hassan to find the feedback?
Answers: 3
question
Computers and Technology, 23.06.2019 00:20
The open systems interconnection (osi) reference model: defines standards for many aspects of computing and communications within a network. is a generic description for how computers use multiple layers of protocol rules to communicate across a network. defines standards for wireless local area network (wlan) communication protocols. details the advantages and disadvantages of various basic network cabling options.
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Write an essay on online collaboration, how to do it, the challenges, resolving the challenges, and consider whether the risks are greater than rewards. ( need )
Answers: 1
You know the right answer?
Description

Once these are done, create a class called Adventure and write the main meth...
Questions
question
Mathematics, 18.11.2019 13:31
Questions on the website: 13722360