FIT 9131 Java Data Structure
Specification
For this assignment you will write a program to play a game Fellowship of Code: a Java Adventure in Middle Earth. This section specifies the required functionality of the program.
Special Note: Before your Applied class in Week 11 there will be a small enhancement to the specification, so good design for your program will be important to allow easy modification to incorporate this change.
Background
Fellowship of Code is a game where a group of adventurers go on a quest through a labyrinth in Middle Earth to deliver a secret code stored on a floppy disk to a Java wizard on Mount Api. During the quest the group must protect the secret code from being stolen by any evil creatures they encounter. The group of adventurers are known as the Fellowship. The Fellowship is led by a hobbit and other members of the group are elves and dwarves. The evil creatures that try to steal the code are orcs, trolls, and goblins.
The aim of the quest is for the Fellowship to travel through a labyrinth and safely deliver the code. The labyrinth consists of a series of connected caves, with each one having at least one entry into another cave. At least one of the caves will have an exit to Mount Api. The Fellowship must decide which option to take as they navigate through the labyrinth. When entering a cave the Fellowship may encounter an orc, a troll or a goblin. As a consequence, they may suffer damage, and may have the code stolen from them. If the code is stolen then the Fellowship may try to steal it back if they encounter the same creature again. If any creature suffers too much damage, then they die and no longer participate in the game. The game ends successfully when at least one of the Fellowship reaches Mount Api with the secret code to deliver to the Java wizard.
Note that some of the characters and places in this assignment are taken from the "The Lord of the Rings" novels by J.R.R. Tolkien.
This section specifies the required functionality of the program. Only a text interface is required for this program; however, more marks will be gained for a simulation that is easy to follow with clear information/error messages to the user.
Fellowship of code
The Fellowship of Code game is controlled by a player. The player chooses the members of the Fellowship, chooses which members of the Fellowship will fight and makes the navigation decisions. The evil creatures appear randomly in each cave and the player must decide how to deal with them. The structure of the labyrinth is pre-determined and is read in from a file.
Program start up
The program begins by displaying a welcome message and brief instructions for the game.
The player is prompted for the type of creatures they would like to have as members of the Fellowship. They can choose up to 4 members. The leader will be a hobbit and the remainder must be elves or dwarves, in any combination. Each creature starts with no damage points and the following power ratings, which is used to determine their chances of winning a fight:
· hobbit: power = 3 points
· elf: power = 5 points
· dwarf: power = 7 points
In addition, the hobbit and each elf will have a special weapon, which can be used once and will always win a fight. Dwarves have greater power but no special weapon.
The labyrinth structure is read in from a file labyrinth.txt. The file consists of a number of lines, with each line containing the details of one cave. Each line has five comma separated integers: cave identity, north cave identity, east cave identity, south cave identity, west cave identity. A zero value for a north, east, south, west cave identity means that the entry to the cave is blocked or there is no cave in that direction. A value of 100 is the identity of Mount Api.
A collection of caves is created from the details read from the file. Each cave will have the following details.
· cave identity: an integer
· north: identity of the northern cave or Mount Api, or 0 if the entry is blocked.
· east: identity of the eastern cave or Mount Api, or 0 if the entry is blocked.
· south: identity of the southern cave or Mount Api, or 0 if the entry is blocked.
· west: identity of the western cave or or Mount Api, or 0 if the entry is blocked.
Living in the caves are orcs, trolls, and goblins. These are aggressive creatures that will fight to steal the code. These creatures start with no damage points and the following power ratings:
· orc: power = 5
· troll: power = 9
· goblin: power = 3
Note that these creatures do not have any special weapons.
The game begins with the Fellowship entering the first cave with the secret code. The Fellowship navigates from cave to cave through the labyrinth until they reach Mount Api or die along the way.
Specific actions in a cave
When the Fellowship enters a cave the following may occur:
1. There is a 75% chance of an orc, troll, or goblin being present in the cave. No more than one creature will be in the cave. Each creature has the same probability of appearing. The creature remains in the cave for the duration of the game.
2. If there is no orc, troll, or goblin in the cave then:
· the Fellowship members have a chance to recover and each member loses a damage point. Note that the damage points can't be negative.
· the Fellowship chooses the next cave to enter or takes the exit to Mount Api, if available.
3. If there is an orc, troll, or goblin in the cave then this aggressive creature will fight to steal the code. The player decides which member of the Fellowship will fight the creature. Possible outcomes of the fight depend on the difference in power rating. If a creature has a power rating of:
· 4 or more points greater than their opponent, they have a 90% chance of winning.
· 3 or more points greater than their opponent, they have a 80% chance of winning.
· 2 or more points greater than their opponent, they have a 70% chance of winning.
· 1 or more points greater than their opponent, they have a 60% chance of winning.
· equal to their opponent then each has a 50% chance of winning.
4. A creature can use their special weapon once in the game. The special weapon will kill the opponent.
5. As a result of a fight:
1.
o The winner steals the secret code.
o The damage points of the winner is increased by 1 point.
o The damage points of the loser is increased by 4 points.
o The creature will die if a special weapon has been used against them.
6. A creature can use their special weapon once in the game. The special weapon will kill the opponent and there will be no damage to the creature that used the weapon.
7. If a creature has 10 or more damage points then they unfortunately die and are no longer in the game.
8. If the last member of the Fellowship dies then the game ends.
9. If the orc, troll, and goblin are all killed then the Fellowship can navigate the labyrinth safely until they reach Mount Api.
10. After a fight the player chooses the next cave for the Fellowship to enter.
· If there is only one cave option then the Fellowship must enter this cave.
· If there is an exit to Mount Api then the Fellowship may take this exit to deliver the secret code to the Java wizard and the game ends.
· If the Fellowship does not have the secret code then they would try to navigate back to the cave to steal back the code from the creature that has the code.
11. After these events and before moving to the next cave, the following information is displayed:
· a list of caves the Fellowship has visited showing whether there is a creature in the cave
· an indication of which creature holds the code
· the damage points for each creature
· the identity of the cave that the Fellowship will enter
Specific actions at the end of the game
At the end of the game a summary is displayed.
· The outcome of the quest, whether it was successful or not and the creature that delivered the code
· The number of caves visited by the Fellowship
· The number of times the secret code changed hands
· A list of the creatures that died.
· The Fellowship fight success rate given as:
number of fights won by the Fellowship * 100 / total fights
A summary is written to the file fellowship.txt.
Program and Class Design
The design of the program will be discussed in your Applied Class in Week 9. It is important that you attend this class.
Important Notes
1. Your program must demonstrate your understanding of the object-oriented concepts and general programming constructs presented in FIT9131. Consider carefully your choice of classes, how they interact and the fields and methods of each class. You must use appropriate data structures to store the various objects (penguins) in the program. You must make use of both Arrays and ArrayLists in your program. Make sure that you discuss your design with your tutor. You must document any additional assumptions you made.
2. You will be required to justify your design and the choice of any data structures used at the interview.
3. Validation of values for fields and local variables should be implemented where appropriate. You should not allow an object of a class to be set to an invalid state (i.e., put some simple validations in your mutator methods).
4. Your program should handle incorrect or invalid input and present the user with relevant error messages. No invalid input should crash the program.
5. Exception handling should be used where appropriate.
6. Before your Applied class in Week 11 there will be a small enhancement to the specification, so good design for your program will be important to allow easy modification to incorporate this change.
Assessment
Assessment for this assignment will be done via an interview with your tutor. The marks will be allocated as follows:
· 10% - Progress of test strategy and code development, as shown via Ed workspace environment. Your tutor will assess your work during your applied session in weeks 10 and 11.
o 5% in week 10 for the Cave class and its test strategy
o 5% in week 11 for a draft of the class diagram and two further classes, which must be a FileIO class and another class which is a client class (please see Lesson 8.1.2 for an explanation of client class). Note that the class diagram should show the individual classes and the interactions between the classes but does not need to include the details within the classes.
· 10% - Test strategy for the Fellowship class, the class which holds the details of the Fellowship members.
· 10% - Class diagram, Java code quality and object-oriented design quality. This will be assessed on code quality (e.g., compliance with coding standards, including JavaDoc) appropriate design and implementation of classes, fields, constructors, methods, and validation of the object’s state.
· 10% - Program functionality in accordance to the requirements.
· 60% - Oral assessment.
Note that it is not a requirement that you use polymorphism and inheritance concepts in this assignment, but incorporating these concepts will enhance your chances of achieving a high distinction (HD) grade.
A reminder that you must use the workspace environment in the Ed platform (opposite this assignment specification) to code all parts of your program. You must not copy and paste large sections of code from other sources, and you must acknowledge any code in your assignment that has been taken from other sources.
Marks will be deducted for untidy/incomplete submissions.
You must submit your work by the submission deadline on the due date (a late penalty of 10% per day, inclusive of weekends, of the possible marks will apply). There will be no extensions - so start working on it early.
All submitted source code must compile. Any submission that does not compile, as submitted, will receive a grade of ‘N’.
Oral assessment
As part of the assessment you will attend an interview following the submission date. At the interview, you will be asked questions about your code. You will asked to explain your code/design, modify your code, and discuss your design decisions and alternatives. Marks will be awarded for your answers (the marker may also delete excessive in-code comments before you are asked to explain that code).
In other words, you will be assessed on your understanding of the code, and not on the actual code itself.
Interview times will be arranged in the applied classes in Week 12 and will take place on campus during the following week.
It is your responsibility to make yourself available for an interview time. Any student who does not attend an interview will not receive a pass grade for the assignment.
Submission Requirements
The assignment must be submitted by 11:55pm Friday of Week 12 (Friday 24 May).
The submission requirements for Assignment B are as follows:
· The main class in your program MUST be called FellowshipQuest.java and it should contain the main() method to start the program.
· Class diagram submitted as a pdf file.
· Test strategy for Fellowship class submitted as a pdf file.
· Submit all your work (coding, class diagram and test strategy) via the Ed platform.
· Re-submissions are allowed (and encouraged) before the submission deadline. Please ensure however that you do not click on the submit button after the due date. Your final submission will be used for grading purposes, and any submission made after the deadline will incur a late penalty.
· A signed Assignment Cover Sheet. [Note: You are required to download the Assignment Coversheet, sign the document and upload the pdf file in the Ed platform (you may drag and drop to the Toggle Pane)]
Marks will be deducted for any of these requirements that are not complied with.
Warning: there will be no extensions to the due date. Any late submission will incur a 10% per day penalty. It is strongly suggested that you submit the assignment well before the deadline, in case there are some unexpected complications on the day (e.g. interruptions to your home internet connection).
咨询 Alpha 小助手,获取更多课业帮助