首页 > > 详细

COMP517留学生讲解、LinkedList structure辅导、Java程序语言调试、辅导Java辅导留学生 Statistics

COMP517 Assignment 10
(Worth 25% of the module marks)
In this exercise you are asked to add more features to the adventure game you have been working
on.
Start by creating a Temple of Wishes, which is made up from a 6x6 matrix of chambers. The
presence of doors in each chamber should be read in from a file. For each chamber, the file has a
row of 4 numbers for each of the positions North, East, South and West, with 1 indicating a door and
0 indicating no door. For example, if the file begins with:
0 1 1 0
0 0 1 1

then the first chamber has doors in its east and south walls, and the second chamber has doors in its
south and west walls. (NB. This needs to be consistent, so that each door connects two adjacent
chambers. You may wish to draw a plan of your temple first!)
Next, randomly scatter 18 items around the Temple, ensuring that each chamber does not contain
more than one item. Each item has a name (String) and a value (int). The name should be read in
from your input file, and the value should be a random integer in the range 1-20.
Your hero has a pouch that can be used to contain items. The pouch should be implemented using a
Java LinkedList structure, with items always stored in ascending order of value (i.e. you should never
have to call a sorting function).
Each item is also guarded by a dragon (with a name, and firepower in the range 5-10). When you
place an item, you should also add a dragon to that chamber. (Ideally you should create the
dragons using the shuffled pack of dragon cards from Assignment 6, although you could also create
dragons randomly as in Assignment 2).
In addition to collecting the items, your hero should fight the dragons. The outcome of a battle is
decided by firepower. If both firepowers are equal, the winner is decided at random. A loss for the
hero causes his or her firepower to be decreased by 1 (down to a minimum of 5); a win causes it to
be increased by 1 (up to a max of 10). Note that the firepower of a dragon remains constant.
The hero can also increase their firepower by resting for a turn. (Use of this would probably be
limited in some way, but that is outside the scope of this particular assignment).
Begin the game by dropping your hero into a random chamber. You then have the following singleletter
commands available to you:
n, e, s, w : head north, east, south or west, assuming there is a door allowing it
f : fight the dragon, if one is present in the chamber
i : inventory – list all items in your backpack
p : pick up item
r : rest (increases firepower by 1)
The aim of the game is to defeat all the dragons and collect all the items.
Good luck!
MARKING CRITERIA
Program correctness and approach: 60%
Documentation (commenting and report): 15%
Program style (e.g. layout): 10%
Testing: 15%
SUBMISSION
As usual, submit your program, test data and output electronically. Include a brief report to explain
your approach. The deadline for submission of your solution is 12 noon on Wednesday December
11
SAMPLE RUN
Starting the game …
You are in chamber (3, 5)
There is a door going east
There is a door going north
There is a red dragon here!
There is a golden orb here (value 9)
What would you like to do? f
Preparing to fight . . .
You have won the battle! Your firepower is now 8.
What would you like to do? p
OK. Item taken.
What would you like to do? w
You can’t go that way
What would you like to do? n
You are in chamber (2,4)
There is a door going east
There is a door going south
There is a door going west
There is a green dragon here!
There is a magic key here (value 10)
What would you like to do? f
Preparing to fight . . .
Oh, dear! You have lost the battle! Your firepower is now 7. Come back when you are stronger.
What would you like to do? e
You are in chamber (2, 5)
There is a door going south
There is a door going west
There is a blue dragon here!
There is a silver chalice here (value 6)
What would you like to do? f
Preparing to fight . . .
You have won the battle! Your firepower is now 8.
What would you like to do? p
OK. Item taken.
What would you like to do? i
Here are the items in your pouch:
1: silver chalice (value 6)
2: golden orb (value 9)
Total value of all items is 15
What would you like to do?
Etc.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!