|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectballwar.model.strategy.ANoOpStrategy
ballwar.model.strategy.ExplodeStrategy
public class ExplodeStrategy
An ANoOpStrategy-based strategy that, upon colliding with another ball, may replace its context with a number of smaller balls with the same strategy, unless the context's radius is below a minumum length, upon which the context is simply killed. The size and masses of the new balls are calculated to conservere total area and mass before and after the collision..
Field Summary | |
---|---|
private static int |
_MinRadius
The minimum radius that will explode. |
private static int |
_NBalls
The number of balls to explode into. |
private static double |
_Prob
The probability of explosion. |
private static int |
_RadiusDivider
The divisor of the radius when the ball explodes. |
Fields inherited from interface ballwar.model.IUpdateStrategy |
---|
NullObject |
Constructor Summary | |
---|---|
ExplodeStrategy()
|
Method Summary | |
---|---|
void |
updateCollision(Ball context,
Ball target)
With a given probability, explodes the context ball into a number of smaller balls, unless the context's radius is below a minimum length, upon which the context is killed and no more balls are made. |
Methods inherited from class ballwar.model.strategy.ANoOpStrategy |
---|
init, updateKill, updateState |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static double _Prob
private static int _MinRadius
private static int _NBalls
private static int _RadiusDivider
Constructor Detail |
---|
public ExplodeStrategy()
Method Detail |
---|
public void updateCollision(Ball context, Ball target)
updateCollision
in interface IUpdateStrategy
updateCollision
in class ANoOpStrategy
context
- The strategy's contexttarget
- The ball the context collided with.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |