|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectballwar.model.strategy.AUpdateStrategy
ballwar.model.strategy.DrunkenStrategy
public class DrunkenStrategy
AUpdateStrategy-bsed strategy that delegates to one of 4 randomly choosen strategies whenever it's updateState is called.
| Field Summary | |
|---|---|
private IRandomizer |
rand
Randomizer used to generate the random values. |
private IUpdateStrategy |
s1
A possible strategy to use. |
private IUpdateStrategy |
s2
A possible strategy to use. |
private IUpdateStrategy |
s3
A possible strategy to use. |
private IUpdateStrategy |
s4
A possible strategy to use. |
| Fields inherited from interface ballwar.model.IUpdateStrategy |
|---|
NullObject |
| Constructor Summary | |
|---|---|
DrunkenStrategy()
|
|
| Method Summary | |
|---|---|
void |
updateState(Ball context)
Randomly delegates to one of the four stored strategies as per the following probabilities: s1: 0.64, s2: 0.16, s3: 0.10 and s4: 0.10 |
| Methods inherited from class ballwar.model.strategy.AUpdateStrategy |
|---|
init, kill, updateCollision |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private IUpdateStrategy s1
private IUpdateStrategy s2
private IUpdateStrategy s3
private IUpdateStrategy s4
private IRandomizer rand
| Constructor Detail |
|---|
public DrunkenStrategy()
| Method Detail |
|---|
public void updateState(Ball context)
updateState in interface IUpdateStrategyupdateState in class AUpdateStrategycontext - The strategy's context
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||