ballwar.model.strategy
Class WanderStrategy

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

public class WanderStrategy
extends ANoOpStrategy

An ANoOpStrategy-based strategy that randomly modifies the velocity whenever the state of the context is updated.


Field Summary
private  int _delta
          The maximum absolute value of any of the velocity increment's coordinates.
private  IRandomizer _rand
          The Randomizer used to generate the random velocity increment vector's coordinates.
 
Fields inherited from interface ballwar.model.IUpdateStrategy
NullObject
 
Constructor Summary
WanderStrategy()
           
 
Method Summary
 void updateState(Ball context)
          Adds a random vector value to the context's velocity.
 
Methods inherited from class ballwar.model.strategy.ANoOpStrategy
init, kill, updateCollision
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_rand

private IRandomizer _rand
The Randomizer used to generate the random velocity increment vector's coordinates.


_delta

private int _delta
The maximum absolute value of any of the velocity increment's coordinates.

Constructor Detail

WanderStrategy

public WanderStrategy()
Method Detail

updateState

public void updateState(Ball context)
Adds a random vector value to the context's velocity. The coordinates of the random vector each have an absolute value less than or equal to a stored maximum.

Specified by:
updateState in interface IUpdateStrategy
Overrides:
updateState in class ANoOpStrategy
Parameters:
context - The context for this strategy.