Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Assignment 3  Phase 2

1. Overview of the Assignment

1.1    Learning objectives

By doing this assignment you will learn how to:

•   Design and implement variations of behavior per FSM

•    Design and implement inheritance with abstract class

•    Create keyboard based interaction

•   Apply sophisticated model to enhance intelligent simulation

1.2.   Programming Requirements

Phase 2 requirements

First of all, for the coding, make sure your code is syntax error free so that it runs properly. You would receive 0 for the coding part if your code failed to run due to syntax errors.

•    You will continue working on your simulation on top of A3P1 with a final goal to build a      cohesive and sophisticated simulation project. Use Java and  no Processing except PVector class

1)    Change the superclass in A3P1 into an abstract class, and make at least its draw method to be an abstract one

2)     Incorporate an energy model along the line of FSM for your creatures (including both preys and predators). The FSM employed must use a state variable to refer to a state among different states specified by you using constants, and the state will transition from one into another as per the conditions as follows.

o  When a creature moves, it loses energy at certain rate based on their size AND their speed (you may need to experiment with different values to be desirable)

o  When a food is consumed, it adds to the creature an amount of energy proportional to the food size

o  When the energy goes above certain level (e.g. 100 units as maximum level), it will gain weights proportionate to the extra energy amount

o  When energy falls below certain level, draw animal as sick. Sick creatures move  at half of their speed. When they run out of energy and can’t get food to restore within certain time interval (e.g. 3 seconds), they will die.

o  Use appropriate visual to show the creature’s different states of energy level including dying (e.g. color differences as a whole or some body parts, mini-   animation for dying, etc.)

3)    Add a hunter class to your ecosystem, in appropriate figure (e.g. a submarine or some   special creature), and make it a subclass to the abstract superclass as well so as to take advantage of the shared properties and functionality. The hunter object, if it is a creature, must have some significant visual features on their appearance to set it apart clearly from other creatures

4)    The hunter serves the role of balancing the population of preys and predators in your      ecosystem, so that it will come in to intervene when preys run the risk of extinction. A     hunter won’t appear until the number of preys drops to half of its initial population (as a result of either predating or starvation), and try to rescue the rest preys by killing the      predators.

5)   The hunter will move up and down along a path near an edge of the environment on    its own (i.e. move autonomously without keyboard control), and use keyboard control to kill predators by shooting at them (with bullets or venom drops). The hunter should    do target shooting (with bullet locking down on the target and moving toward it until     hit like a missile) at the predators, which would hunt per a strategy of killing the                toughest predator first (i.e. the one with the largest energy level). It will repeat killing as such until the population of predators also drop to half of its initial population. For the   shooting (Please note: you will have a chance to recap the basics of bullet shooting          learned in IAT- 167 in week 9’s lab) though, it needs to meet the following requirements:

o  Each key press should shoot only one missile rather than a stream of it

o When a missile hits a target, the missile itself should be destroyed along with the target (i.e. disappear from the screen)

o  The missile should also be destroyed right after it moves out of the screen

6)    Once achieving the goal (i.e. killing half of the predators), the hunter will disappear, and both preys and predators will, in a delay of 5 seconds, respawn to their initial population level (as specified in 9) below), and the cycle of predating and killing starts again

7)    When hunter moves around, both preys and predators will try to avoid bumping with the hunter using either an FOV or feeler while pursuing their food or escape from a    predator

8)    Create 6 predators and 12 prey creatures, and include both of them in a single ArrayList typed with their superclass. The mechanics and dynamics among predator-prey-food     should be maintained as in A3P1

9)    Add textual information to be displayed by default above the creatures (including          preys, predators, and hunter) as a label and be moving with them, but no rotating and   scaling with them though. The information for preys and predators should include their energy level and speed magnitude, and for hunter it should be its health points (out of 100). The display must use appropriate Java font type, and centered around and above  the creature with appropriate gap in-between.

10)  You should be able to toggle the display of the information on and off for all creatures    (including hunter) all at once with the d key of keyboard. Use status bar within                 window’s frame area with appropriately formatted message to indicate appearance and disappearance of hunter, and dynamic message about how many more predators it         needs to kill before restoring the balance of the ecosystem

1.3 BONUS (up to 3 pts):

•   Add some visual effect to demonstrate the consequence of killing a predator (mini- animation for collapsing, blowing-off pieces, etc.) – up to 1pt

•   Make predators not shun but attack the hunter with bumping into them before they get shot and killed. Each bump from predator will cause hunter’s health to reduce by a rate that is proportionate to the creature’s energy level (i.e. the larger the energy, the more  the damage), the predator will lose its energy by a fixed amount with each bump as        such. The hunter will disappear when it loses all its health and is supposedly dead, and   then respawn after some delay e.g. 3 seconds – up to 1pt

•   After the hunter fires the 1st shot, and kills the 1st predator, all other predators will     approach and attack the hunter as a team in the pattern of a triangle, leading by the  one that has the largest energy level. The pattern will be maintained throughout the attacking process, i.e. when the leader got killed then the next one with the largest     energy level will fill in the leading position. After killing the hunter, they will restore to their regular prey hunting if they have survived – up to 2pts

Note: a) You must indicate in the comment at the top of the main file if any bonus feature you have attempted and also clearly indicate bonus functionality in the comments at the                   appropriate places. b) Total bonus is capped at 3, i.e. you’ll get 3 even if the add-up goes            beyond 3.

2. Submission and Grading Instructions

2.1 Phase 2

•   The project must be named (in Eclipse) with the following format

LabNumber_FirstName_LastName_AssignmentNumber

_PhaseNumer_StudentNumber, e.g.

D104_Jim_Silvester_Assignment3_Phase2_1234567

•    For the code the entire project MUST be submitted (not just the source files)

•   To submit, export the project (including all the libraries used) into a zip file (Archive File) and name it exactly the same as the project name

(Please note failure to meet any of these submission requirements above would result in a penalty of 0.25 pt each)

•    Late submission will be not be accepted unless you have a legitimate reason.

•   For a legitimate reason e.g. illness or emergency, a late submission might be allowed   pending discussion with your TA before the deadline. You may be required to provide supporting documents.