morey.spore
Class Flip
java.lang.Object
|
+--morey.spore.SporeAction
|
+--morey.spore.Flip
- public class Flip
- extends SporeAction
- implements java.lang.Cloneable
The flip occurs off the side that the spore is heading. It is like putting
a mirror along the side that the spore is heading then replacing the spore
with its mirror image. The mirror image concept is important to have since
The odd side polygons have an interesting way of flipping twice. When going
in a straight line the new headings are not clear for a odd side polygon.
Arbitrarily, we favour the a slightly right handed world. But after a flip
this favouring is now a slightly left handed world. This allows for odd
sided polygons to move in a straight line easily. For instance,
pent 5 10 flip |
moves first slightly right then slightly left then back again slightly
etc. This cause an over all straight line. This is a bit subtle since all
new odd-sided spores start with a right leaning.
A flip could cause a collision and demise of the spore.
The execution time is related to the area of the spore
(an arbitrary unit that the others will be scaled against).
The complexity of this SporeAction is moderate (and also a unit value
that the others will be scaled).
Here
is a link to the source code
- See Also:
RPolygon.flip(),
RPolygon.right(),
Left,
Right,
Type,
Claim,
Spawn
|
Constructor Summary |
Flip()
construct a simple flip. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
EXECUTE
protected static final double EXECUTE
COMPLEXITY
protected static final int COMPLEXITY
Flip
public Flip()
- construct a simple flip.
getExecutionTime
public double getExecutionTime(Spore s,
Processor cpu)
- gets up the time of execution for the next action
- Overrides:
- getExecutionTime in class SporeAction
- Parameters:
s - the spore wanting to execute the actioncpu - that executes this action (and required info...)- Returns:
- the time of execution
executeAction
public boolean executeAction(Spore s,
Processor cpu)
- flip the spore
- Overrides:
- executeAction in class SporeAction
- Returns:
- true if it doesn't collide
toString
public java.lang.String toString()
- Gives a String representation of this
- Overrides:
- toString in class java.lang.Object