Name: Libo cao

advertisement
Homework 2. project Terrarium CS 556
Team:
Work
Name: Chris Walsh, Jeff Renshaw, Don Finley, Derek Stacey, Libo cao
Date: 09/22/02
You may find 1. Actors; 2. Use-cases analysis; 3. User-interface elements in this documentary
1. Actors(Provided by whole group)
Actor 1: Carnivore
Briefly Description: This creature need to eat another animal as food or source of energy for
regeneration.
Actore2: Herbivore
Briefly Description: This creature need to eat plant as food or source of energy for grow or
regeneration.
Actor 3: Plant:
Briefly Description: This organism need not eat anything, however can regenerate after a
certain amount of time.
2. Use Cases Analysis:
Attacktion (Provided by Jeff Da Truk)
Precondition:
Another carnivore has attacked our animal, or our carnivore has found an
herbivore or carnivore to approach and attack.
Description:
The attack use case is begun by either our carnivore finding the closest target as it
is moving around, or another carnivore attacking our carnivore. In either case our
animal must determine the threat level of the other carnivore and decide whether or
not to continue attacking, or to jump to the run away case. To decide whether to
defend, attack or run depends on several checks that will continuously happen during
the attack sequence. First, our carnivore needs to determine which species it is
combating (we don’t want to attack our own species). If it is a different species then
we need to check its energy level to see if it is still alive or not. If it is alive then the
attack would be initiated. If not then the carnivore needs to check to see how long it
has been dead. If the dead animal is not to the point of rotting yet then our animal
should eat the other. During the battle the carnivore will also be checking its own
energy level and the threat level of the opponent. If our animal is losing the battle or
has no chance of winning, it should be able to determine that and run away or at least
defend. The case then ends in one of three ways, either we eat the animal, we run
away from the animal, or we are eaten by the opponent.
If same species
if energy too low
if rotting
confront
Animal
Check
Species
not Check threat low Check own high Make
Attack
energy
same Level
enough
enough
Check
for life
if
Check
Rotting
dead
if
eat
not
if opponent alive
if threat too high
Postcondition:
The use case ends when either our carnivore kills or eats the opponent or when
the opponent kills us. Also if the carnivores sense their danger through threat levels
and energy levels, the use case can be ended by running away.
Run
away
Regeneration: (Provided by libo cao)
An activity that caused by growth. To reproduce themselves there are plenty of requirments
(enough maturity, enough energy, and ready to procuce), and plenty of costs once your
creature has given birth.(die quicker, loss of energy, ect.). The children will be effected by
their parent through genetic memory.
Precondition:
The animal need to meet three requirement : be mature, ready to reproduce, and has enough
energy to reproduce.
Flow of Events
Basic Path:
A. The animal invokes the use case by beginning to check whether itself is mature,
determine whether or not itself has reached its full size.If the creature has reached its full
size then it is one step closer to being able to reproduce. In order to reach their full size
the creature must grow.
B. Once the creature reached its MatureRadius, it will be automatically set to the state of
ready to reproduce mode
C. Then the creature need to check whether it has enough energy. The energy state for the
creature must be bigger than normal energy level. Only under this condition the creature
can be ready to reproduce.
D. After all these requirements are met, the creature come to can-produce state and begin the
reproduction.
Alternative Paths:
At the state of reproduction, after one reproduction are finished, it should check for all the
three requirements again and see whether they are still met, if the answer is yes, it should loop
back to this state and begin another reproduction activity until the three requirement are not all
satisfied.
Postcondition:
The use-case instance ends when reproduciton are finished and the three requirement are not
all met. (This use case will effect the genetic memory of next generation. Some parameters
will be passed on to next generation. ) Might cause sickness if not optimize the number of
production.
Growth (Provided by libo cao)
Brief Description
Grow in size will make a creature be capable of reproducing, reaching maturity, or it's full
capacity to fight other creatures or defend itself. Size of a creature should effect the attacktion
ability, The requirments include space for the creature to grow, that the creature is capable of
growing at the current point in time, and that the creature have enough energy to grow, this
may effect the state of health for a creature.
Precondition:
Growing happens automatically assuming our creature met the growth requirements—space
for the creature to grow (often the hardest of the requirements to achieve or even realize that
space is needed), that the craeture is capable of growing at the current point in time, and that
creature have enough energy to grow.
Flow of Event:
1. Check the GrowthWait is 0 and the creature is currently not mature.
2. Check the energy state, if it is at Normal or Full energy state, then it can grow, or else, it
goes back to check all the states.
3. Check whether there are enough space to grow, which means our creature should have to
be up to 8 pixels from any other creature or plant to be capable of growing.
4. Ready to grow.
Postcondition:
Creature have bigger size, more mature, less energy right after the growth, however later on
will have more strength for attacktion and defense.
Movement: (Provided by Don Finley)
Precondition
The carnivore must have the required energy to complete the move.
Flow of Operations
1. The carnivore must find scan the landscape to “see” all that is around him.
2. After looking around the carnivore will decide on what point or creature to move
towards
3. Then the creature will figure out a speed in which to travel, depending on whether it
is attacking or just taking a stroll in the park.
4. If the carnivore does not have the required energy then speed will be adjusted or
another point selected.
5. While the carnivore is moving it will check to see if the other animal has moved or if
the
Post conditions
After the movement case is completed, it could lead to all other use cases, excluding
reproduction
Defending
(Provided by Derek Stacey)
Precondition:
If the threat level is greater than 0 then start defending.
Use Case:
·
o
§
Start Defending
Determine the threat level.
If the threat level is high
1.
If it is likely the opponent will win run
2.
Else block and attack
3.
Then revaluate the threat level
§
1.
§
Else if the threat level is low
Ignore and go on to the next possible task
Done Defending
Post-Condition:
The threat has been taken care of and the carnivore is ready for another course of action.
Provide a logical user interface design for your system (Provided by
libo cao)
Once the creature is loaded into Terrarium, it acts on the instructions supplied by its code. The
user should be able to watch the movement and get properies of any creature on this Terrarium.
Properties can be shown like: energy level, dangerous level, dead or not, bitmapradius, damage,
generation, food chunk, movement vector…
The user should be able to choose Terrarium mode or ecosystem mode, for each mode, the user
should be able to introduce and reintroduce different types of creatures. For the Terrarium mode,
the user should be able to create a new Terrarium, open an existing Terrarium, show property
window and show trace window.
The user should be able to see the event happened, like when an animal is teleported into the
world. Also can show property grid.
The use should be able to locate the world by clicking a map.
Icons show number of animals in the world and peers, also peer to peer-call-request, peer-to-peer
User-interface elements:
Locator:
When click will show the location in the map on the big window phase.
Show Trace Window:
Show the event list, like when an creature is teleported into the world.
Ecosystem Mode:
Introduce a creature and reintroduce a creature.
Terrarium Mode:
Introduce a creature, reintroduce a creature, create a new Terrarium, open an existing Terrarium,
show property window and show trace window.
Window Watch Properties:
energy level, damage, dead or not, bitmapradius, damage, generation, food chunk, movement
vector…
In this Terrarium project, because once the creature is loaded into Terrarium, it acts on the
instructions supplied by its code. There are not much use-interface relationships. The introduce of
different types of animals will effect the result spacies in the the Terrarium.
Download