School of Science

COSC1284 Programming Techniques


Assignment 3


Overview

GamingMax Corporation is a start up gaming business and is developing its first game with a working title, called ‘Battle Simulation’. The game has a basic AI ogre characters, however you have recently been hired to finish their game.

Your task is to implement basic AI hero characters with additional characteristics, provided to you in our skeleton code for a simple command line application.

The skeleton code is made up of four classes:

BattleSimulationApp: The driver class of the application.

BattleSimulationEngine: The class that manages all game assets and runs the simulation.

Entity: The super class for all AI characters.

Ogre: The sub class that the specific characteristics of the Ogre.

In addition to the four classes, further classes will be needed to support the game.

Currently, the game is in working order and is in the following state:

The game starts with a splash screen.

Creates four ogres and adds them to the entity array.

The ogres will fight each other because they are alone.

Once the ogres are dead, the game will end with the game over screen.

Your task, is to add an interaction menu, create, add and sort hero characters to the simulation, allow the hero and ogre characters to fight within the simulation, either resulting in game over or win and finally that the hero can use items, such as swords, armour and potions.


Question 1 (7 points)

Implement the method void menu() within the BattleSimulationEngine in the skeleton code, which allows the player to do the following action:

Add hero character to the existing entity array.

Sort hero characters by their health (see question 2 for more detail about health).Page 2 of 5

o You must implement your own sorting algorithm, don’t simply use one from the Java library or zero marks will awarded.

Print the hero name and health.

Run the simulation.

Exit simulation.

The menu method is the only method that can create and use the scanner class, therefore the scanner should be local to the menu method.


Question 2 (12 points)

Create a Hero class that extends the Entity class, furthermore you must override the methods that the Entity class is enforcing. These enforcing methods include the following:

void attack();

void add(Entity[] entities);

Additionally, hero characters’ health must be set between a random value of 150 and 500 and therefore underpowered compared to the ogres which have a health of 1000. This health value is set before the simulation starts.

The hero characters must be set to the hero team.

The DAMAGE variable is inherited from the Entity class, thus both the Hero and Ogre class can attack each with the same amount of damage.

The maximum number of hero characters that be created is four and need to be added to the entity array.

Hero characters need to be able to attack and be hurt by the ogres.

After which, the simulation should have the eight entities fighting each other, please note that the hero characters should not attack another hero character, only the ogre characters.

Once the hero characters have zero or less, then that character is dead and set null, no longer able to perform any more actions.

Hint: It is likely that your heroes will be defeated at this point.


Question 3 (12 points)

Create one super class called Item and three additional sub classes called Sword, Armour and Potion.

The Item class must have a name that shared with other sub classes, i.e. to obtain the name of a sword, the name must be located within the Item class, not the Sword class.

Each of the subclasses must do the following:

Sword class:

o Increases the damage output by 200%.

o Limited to 5 hits, then damage reduces back to 100%.

Armour class:

o The received damage is reduced to 125.

o Only works 50% of the time, other 50% the character receives the full 100% damage.

Potion class

o Increase the health back to 500.

o Can be used only when the health is less than 200.

o Can be only used once.

Apply these subclasses to the hero class and to be use in the simulation.


Question 4 (4 points)

Combine the last three questions into a cohesive application and demonstrate that the hero characters can defeat the ogres.

Additionally, provide screenshots of the following output:

The heroes are sorted by the health using the print hero’s name and health method.

The heroes can be defeated by the ogres, by showing a win output.

Furthermore, documentation needs to be provided, both in the code and in a readme. Inline, method and class descriptions comments are written into the class files that you have authored; no need to comment the skeleton code, except any additions changes that have been made by you.

The readme file contains your decision making process during the writing of the assignment, as well as any issues or bugs that were discovered.


This program will demonstrate the following key skills:

1. Creating a small Object Orientated program to demonstrate what you have learned as a developer.

2. Analysing a problem and developing an algorithm to solve the problem.

3. Converting an algorithm to computer code.

4. Debugging your code on test data sets.


Read the requirements thoroughly!

There are specific constraints that have been placed on you for this assignment to force you to work within defined parameters. The ability to work within a pre-defined set of parameters is a fundamental skill required by any software developer.

You will also need to debug code on your own.

You are given marks on your ability to fulfil all requirements of this document.

Develop this assignment in an iterative fashion, as opposed to completing it in one sitting.

Any questions regarding this assignment must be asked via the relevant Canvas discussion forums only (no emails to teaching staff, please) in a general manner.

Questions about clarifying the specifications can be asked, but questions about how to write the code cannot be answered.


2. Assessment Criteria

This assignment will assess several skills:

Following coding conventions and behavioural requirements provided in this document and in the lessons.

Independently solving a problem by using programming concepts taught over the first twelve weeks of the course.

Writing and debugging Java code independently.

Meeting deadlines.

Seeking clarifications from your teaching team, when needed, via discussion forums.

Creating a program by recalling concepts taught in class, understanding and applying concepts relevant to the solution, analysing components of the problem, and evaluating different approaches.

Collection classes such as, HashMaps and collection types are not allowed in this assignment.

ArrayList are optional, however, data structures that have been already coded into the skeleton code, must remain as is, i.e. the entries array, must stay as an array.

Other classes such as the StringBuilder class are allowed.


3. Learning Outcomes

This assessment is relevant to the following Course Learning Outcomes (CLOs:

CLO1. Demonstrate (through small programming exercises) knowledge and skills with concepts of program design and acceptable coding standards.

CLO2. Use Java programming language as a vehicle to demonstrate good software development practices.

CLO3. Use arrays and control structures to demonstrate skills of basic algorithms and data structures.

CLO4. Apply knowledge of the basic principles of the object-oriented development process to the analysis and design of solutions for small scale problems.

CLO5. Analyse requirements for a small-scale programming project.

CLO6. Design and implement small-scale software systems.

CLO7. Explain the rationale for program design, data structures, and user interface design chosen

CLO8. Demonstrate skills for self-directed learning.


4. Assessment details

Note: Please ensure that you have read sections 1-3 of this document before going further.

Your code must meet the following code requirements and debugging requirements (please, consult the table in Section 9):


5. Submission format

Follow the instructions below to complete this assessment:

Follow the instructions below to complete this assignment:

Download skeleton code for Assignment 3 from Canvas

Unzip the archive you have downloaded to a folder on your computer.

Open the folder in Visual Studio Code selecting File->Open Folder (File->Open on Mac OS) and then picking your folder.

You will need to complete the code, in response to Questions 1-4 by the due date.

DO NOT modify the files that are specified.

These files are included in the skeleton code assigned to you.

A number are java files, two screenshot image files and a readme text file is required for the submission of this assignment.

Use Visual Studio Code as your only editor to complete the program as per the specification provided to you in the questions.

Submit your entire project, as a .zip archive.

Make sure that you download your code after submission and thoroughly check that you have submitted correctly.


6. Academic integrity and plagiarism (standard warning)

Academic integrity is about honest presentation of your academic work. It means acknowledging the work of others while developing your own insights, knowledge and ideas. You should take extreme care that you have:

Acknowledged words, data, diagrams, models, frameworks and/or ideas of others you have quoted (i.e. directly copied), summarised, paraphrased, discussed or mentioned in your assessment through the appropriate referencing methods, Provided a reference list of the publication details so your reader can locate the source if necessary. This includes material taken from Internet sites.

If you do not acknowledge the sources of your material, you may be accused of plagiarism because you have passed off the work and ideas of another person without appropriate referencing, as if they were your own.

RMIT University treats plagiarism as a very serious offence constituting misconduct. Plagiarism covers a variety of inappropriate behaviours, including:

Failure to properly document a source

Copyright material from the internet or databases

Collusion between students

For further information on our policies and procedures, please refer to the University website.


Assessment declaration

When you submit work electronically, you agree to the assessment declaration.

Penalties

Code must be valid, runnable Java to be given a mark (code can only be marked as submitted, no corrections to code will be made in order to run your program).

Each instance of the following will incur a 20% marking penalty:


9. Rubric/assessment criteria for marking

Code must be valid, runnable Java to be given a mark (code that cannot be compiled, pseudo code, incomplete Java code cannot be marked).

Run-time errors will incur up to a 20% penalty (run-time errors due to data type mismatches in inputs are acceptable).