HOG2
|
A configurable billiard ball unit. More...
#include <RandomUnits.h>
Public Member Functions | |
BilliardBallUnit (int _x, int _y, int _coolOffPeriod, double _probDirChange) | |
virtual const char * | GetName () |
bool | MakeMove (MapEnvironment *, OccupancyInterface< xyLoc, tDirection > *, MapSimulationInfo *, tDirection &dir) |
Make a move. More... | |
void | UpdateLocation (MapEnvironment *, xyLoc &, bool, MapSimulationInfo *) |
Set location after last move. More... | |
Public Member Functions inherited from MapUnit | |
MapUnit (int x, int y) | |
virtual void | GetLocation (xyLoc &l) |
virtual void | OpenGLDraw (const MapEnvironment *, const MapSimulationInfo *) const |
virtual void | GetGoal (xyLoc &s) |
Public Member Functions inherited from Unit< xyLoc, tDirection, MapEnvironment > | |
Unit () | |
virtual | ~Unit () |
virtual bool | Done () |
virtual double | GetSpeed () |
void | SetSpeed (double s) |
virtual void | LogStats (StatCollection *) |
log an stats that may have been computed during the last run More... | |
virtual void | LogFinalStats (StatCollection *) |
log any final one-time stats before a simulation is ended More... | |
virtual void | SetColor (GLfloat _r, GLfloat _g, GLfloat _b) |
virtual void | GetColor (GLfloat &_r, GLfloat &_g, GLfloat &_b) const |
UnitGroup< xyLoc, tDirection, MapEnvironment > * | GetUnitGroup () |
void | SetUnitGroup (UnitGroup< xyLoc, tDirection, MapEnvironment > *_group) |
virtual unsigned int | GetNum () |
virtual void | SetNum (unsigned int num) |
virtual void | StartNewTrial (StatCollection *) |
virtual int | GetPriority () |
virtual void | SetPriority (int val) |
Private Attributes | |
int | lastIndex |
int | collisionStatus |
double | probDirChange |
int | coolOffPeriod |
Additional Inherited Members | |
Protected Attributes inherited from MapUnit | |
GLfloat | r |
GLfloat | g |
GLfloat | b |
xyLoc | loc |
A configurable billiard ball unit.
Definition at line 64 of file RandomUnits.h.
|
inline |
Definition at line 66 of file RandomUnits.h.
References collisionStatus, coolOffPeriod, kStayIndex, lastIndex, and probDirChange.
|
inlinevirtual |
Implements Unit< xyLoc, tDirection, MapEnvironment >.
Definition at line 73 of file RandomUnits.h.
|
virtual |
Make a move.
the billiard ball unit keeps following the same direction until either a collision or instability
Implements Unit< xyLoc, tDirection, MapEnvironment >.
Definition at line 62 of file RandomUnits.cpp.
References lastIndex, and possibleDir.
|
virtual |
Set location after last move.
if the billiard ball unit collides, it will cool off for a period of time otherwise, it may changes its mind if it unstable
Reimplemented from MapUnit.
Definition at line 74 of file RandomUnits.cpp.
References collisionStatus, coolOffPeriod, fless(), kStayIndex, lastIndex, probDirChange, and MapUnit::UpdateLocation().
|
private |
Definition at line 79 of file RandomUnits.h.
Referenced by BilliardBallUnit(), and UpdateLocation().
|
private |
Definition at line 81 of file RandomUnits.h.
Referenced by BilliardBallUnit(), and UpdateLocation().
|
private |
Definition at line 78 of file RandomUnits.h.
Referenced by BilliardBallUnit(), MakeMove(), and UpdateLocation().
|
private |
Definition at line 80 of file RandomUnits.h.
Referenced by BilliardBallUnit(), and UpdateLocation().