HOG2
|
A simple unit that attempts to follow walls using the right hand rule. More...
#include <RHRUnit.h>
Public Member Functions | |
RHRUnit (int x, int y) | |
const char * | GetName () |
bool | MakeMove (MapEnvironment *, OccupancyInterface< xyLoc, tDirection > *, MapSimulationInfo *, tDirection &) |
Make the next move. More... | |
void | UpdateLocation (MapEnvironment *, xyLoc &, bool, MapSimulationInfo *) |
set rhr unit location. 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 |
bool | initial |
Additional Inherited Members | |
Protected Attributes inherited from MapUnit | |
GLfloat | r |
GLfloat | g |
GLfloat | b |
xyLoc | loc |
A simple unit that attempts to follow walls using the right hand rule.
|
inline |
|
inlinevirtual |
Implements Unit< xyLoc, tDirection, MapEnvironment >.
|
virtual |
Make the next move.
Make the next move following the right hand rule.
Implements Unit< xyLoc, tDirection, MapEnvironment >.
Definition at line 17 of file RHRUnit.cpp.
References lastIndex, and possibleDir.
|
virtual |
set rhr unit location.
To follow the right hand rule, we do the following: 1) if the last move was successful, turn 90 degrees to the right and keep going. 2) if the last move wasn't successful, turn 90 degrees to the left and keep going.
Reimplemented from MapUnit.
Definition at line 30 of file RHRUnit.cpp.
|
private |
Definition at line 29 of file RHRUnit.h.
Referenced by RHRUnit(), and UpdateLocation().
|
private |
Definition at line 28 of file RHRUnit.h.
Referenced by MakeMove(), RHRUnit(), and UpdateLocation().