Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
PROG2007 Assignment 2
Specifications
Your task is to complete various exercises in BlueJ, using the Java language, and to submit these via
the MySCU link created for this purpose.
Marking criteria includes:
• Use of correct coding style, including the use of comments;
• Accuracy of coding;
• Use of suitable coding structures;
• Correct submission and naming conventions of assessment items as required.
Designing your game
Using the given zuul-bad game as a starting point, you must design your own game. Some
possible game scenarios are described in Exercise 6.3 of the reference textbook. If you find it
difficult to visualise this sort of game scenario, try modelling your game on some familiar real-
world location. If you need additional inspiration, you can try playing the original Colossal
Cave Adventure game.
You must have the following in your game:
• Your game scenario must have at least six (8) different rooms.
• Your game scenario must have at least six (6) types of exits – north, south, east, west,
up and down, and any other you require. This requirement does NOT mean that each
room must have 6 exits.
• Your game scenario must include at least six (6) items that the player could find, pick
up and potentially use.
• The player can only carry a maximum of five (5) items in the player’s inventory.
• Your game must have some way for the player to win. Most likely, this will be by
achieving some goal such as finding a particular item, surviving for some specified
number of moves, or exiting a particular room … whatever makes sense for your game.
Programming exercise 1
Correct the problem of repeated functionality in the printWelcome and goRoom methods by
refactoring the repeated functionality out of these methods into a method of its own called
getRoomExitsAndDescription. Then call this new method in each place the description and
exits need to be displayed.
Programming exercise 2
• Refactor the code that generates the list of the exits into a method named
getExitString in the Room class. This method should return a String listing the exits
from the room. For example, if the room has exits to the north and west, this method
should return a String containing: “north west”.
Add a method called getLongDescription to the Room class that returns a String
containing the description of the current room and a list of the exits of a room (hint:
call the getExitString method you just created.
Now that each room has a method that can print information about a Room refactor
the code in the Game class to take advantage of this functionality. i.e. anywhere the
Game class uses the getRoomExitsAndDescription method, change it to use your
getLongDescription method.
•
•
Programming exercise 3
• Update the comments at the beginning of the Game class, the Room class and the
message displayed by the printWelcome method so that they describe your game.
Update the Game and Room class so that it creates the rooms and exits that you
invented for your game. You do not need to add any items to your game yet. You will
add items later.