You need to track a werewolf that is terrorizing a village surrounded by forest.
You will search the different areas of the forest for a werewolf that has been terrorizing the local village and attempt to subdue it by firing silver bullets at it from an adjacent area. Each action you take during the night brings dawn closer, and each time dawn breaks you will find another villager has been taken by the wolf. If all the villagers die/leave then you lose the game.
If you successfully shoot the werewolf three times then it will be subdued and you can capture it and you win the game. But shoot toward the village and you’ll lose a villager and possibly end the game. As you explore the forest, if you enter the same area as your target it will take flight and move to another area before you can take a shot, but not before biting you! While bitten you become much less aware of your surroundings. You can still shoot while bitten, but you can only be healed by finding your way back to the village (which you will be able to hear when in an adjacent area). Worse, if you enter the same area as your target while bitten then it will finish you off (i.e., you lose the game). Bitten or not, if you run out of bullets then the village cannot be saved and the game ends.
As long as you are not bitten you will have some idea of your location, the areas around you, and the nearness the wolf (because of its smell). You can always tell if you are adjacent to the village due to the noise of activity, even if you’ve been bitten.
The game supports three difficulty levels, which have the following characteristics:
EASY: Player begins in village area = yes, Villagers = 6, Silver bullets = 8, werewolf moves when shot = no
NORMAL: Player begins in village area = no, Villagers = 4, Silver bullets = 6, werewolf moves when shot = no
HARD: Player begins in village area = no, Villagers = 4, Silver bullets = 6, werewolf moves when shot = yes
Note: The werewolf should always move each new day.
The completed implementation will consist of five files, only one of which must be written by you (and submitted). These files are:
Adventure2D.java This is the driver program (with a main() method). The code of this is complete and it MUST NOT be changed. The code in this file is very simple: it declares and instantiates an object of the
WereWolf class and calls its
GameWorld.java This is a library class and this file contains resources that you are to use in developing your implementation of the task. The code is complete and MUST NOT be changed.
Result.java This is an enumerated type (another library class) that lists the possible outcomes from different actions the user can take. The code is complete and MUST NOT be changed.
Difficulty.java This is an enumerated type (also another library class) that lists the possible difficulty levels of the game. Each value of this type can report details about aspects of the game’s difficulty, such as the number of silver bullets the player starts with.
WereWolf.java This is an organiser class and is the file that you are to write; the starting files (link is below) contain a ‘skeleton’ version of this code that you should use as a starting point.
- There will be no
main() method in the class, it will contain methods that organise the task. This will include all the interactions with the user.
- You should make sure that you do the following:
- Create and use an object of the
GameWorld class. You must not write code in
WereWolf.javathat duplicates things that could be done using methods of the
- Use the
trace() method (provided in the skeleton) to include tracing messages in your program (switch the messages off before submission).
- Use separate methods to implement the separate activities within the task.
- Use instance variables to store data that is used or changed by more than one method and/or needs to persist for the life of the object.
- Use local variables to store the data that is used by just one method.