ballworld.model.strategy
Class WanderStrategy

java.lang.Object
  extended by ballworld.model.strategy.WanderStrategy
All Implemented Interfaces:
IUpdateStrategy

public class WanderStrategy
extends java.lang.Object
implements IUpdateStrategy

Strategy that randomly changes the velocity of the context ball by adding random values to it.

Author:
swong

Field Summary
private  int delta
          The maximum range of the velocity change.
private  IRandomizer rand
          Randomizer utility for obtaining random values to change the velocity
 
Constructor Summary
WanderStrategy()
           
 
Method Summary
 void updateState(Ball context)
          Add random values to both the x and y components of the velocity of hte context ball.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rand

private IRandomizer rand
Randomizer utility for obtaining random values to change the velocity


delta

private int delta
The maximum range of the velocity change.

Constructor Detail

WanderStrategy

public WanderStrategy()
Method Detail

updateState

public void updateState(Ball context)
Add random values to both the x and y components of the velocity of hte context ball.

Specified by:
updateState in interface IUpdateStrategy
Parameters:
context - The host ball for this strategy