public class DrunkenStrategy extends java.lang.Object implements IUpdateStrategy
Modifier and Type | Field and Description |
---|---|
private IRandomizer |
rand
Randomizer utility used to randomly select one of the possible
strategies.
|
private IUpdateStrategy |
s1
One of the strategies to choose from
|
private IUpdateStrategy |
s2
One of the strategies to choose from
|
private IUpdateStrategy |
s3
One of the strategies to choose from
|
private IUpdateStrategy |
s4
One of the strategies to choose from
|
Constructor and Description |
---|
DrunkenStrategy()
Constructor for the strategy.
|
Modifier and Type | Method and Description |
---|---|
void |
updateState(Ball context,
Dispatcher disp)
Randomly select one of the possible strategies and run it as the strategy
for the context.
|
private IUpdateStrategy s1
private IUpdateStrategy s2
private IUpdateStrategy s3
private IUpdateStrategy s4
private IRandomizer rand
public DrunkenStrategy()
public void updateState(Ball context, Dispatcher disp)
updateState
in interface IUpdateStrategy
context
- The host ball for this strategy.disp
- The dispatcher to use if necessary