HOG2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Racetrack Class Reference

#include <Racetrack.h>

Inheritance diagram for Racetrack:
Inheritance graph
[legend]
Collaboration diagram for Racetrack:
Collaboration graph
[legend]

Public Member Functions

 Racetrack (Map *map)
 
 ~Racetrack ()
 
void UpdateMap (Map *map)
 
void GetSuccessors (const RacetrackState &nodeID, std::vector< RacetrackState > &neighbors) const
 
void GetActions (const RacetrackState &nodeID, std::vector< RacetrackMove > &actions) const
 
int GetNumSuccessors (const RacetrackState &stateID) const
 
void Reset (RacetrackState &s) const
 
void ApplyAction (RacetrackState &s, RacetrackMove a) const
 
bool InvertAction (RacetrackMove &a) const
 
RacetrackMove GetAction (const RacetrackState &s1, RacetrackState &s2) const
 
void Boundaries (RacetrackState &s, RacetrackMove &v) const
 
bool Legal (const RacetrackState &node1, RacetrackMove &act) const
 
double HCost (const RacetrackState &node1, const RacetrackState &node2) const
 Heuristic value between two arbitrary nodes. More...
 
double HCost (const RacetrackState &node) const
 Heuristic value between node and the stored goal. More...
 
double GCost (const RacetrackState &node1, const RacetrackState &node2) const
 
double GCost (const RacetrackState &node, const RacetrackMove &act) const
 
bool GoalTest (const RacetrackState &node, const RacetrackState &goal) const
 
uint64_t GetStateHash (const RacetrackState &node) const
 
uint64_t GetActionHash (RacetrackMove act) const
 
void OpenGLDraw () const
 
void OpenGLDraw (const RacetrackState &) const
 
void OpenGLDraw (const RacetrackState &, const RacetrackMove &) const
 
void Draw (Graphics::Display &display) const
 
void Draw (Graphics::Display &display, const RacetrackState &s) const
 
void Draw (Graphics::Display &display, const RacetrackState &, RacetrackMove &) const
 
void Draw (Graphics::Display &display, const RacetrackState &l1, const RacetrackState &l2, float v) const
 
void DrawLine (Graphics::Display &display, const RacetrackState &x, const RacetrackState &y, float width) const
 
- Public Member Functions inherited from SearchEnvironment< RacetrackState, RacetrackMove >
virtual ~SearchEnvironment ()
 
virtual RacetrackMove GetAction (const RacetrackState &s1, const RacetrackState &s2) const
 
virtual void UndoAction (RacetrackState &s, RacetrackMove a) const
 
virtual void GetNextState (const RacetrackState &s1, RacetrackMove a, RacetrackState &s2) const
 
virtual void StoreGoal (RacetrackState &s)
 Stores the goal for use by single-state HCost. More...
 
virtual void ClearGoal ()
 Clears the goal from memory. More...
 
virtual bool IsGoalStored () const
 Returns true if the goal is stored and false otherwise. More...
 
virtual double HCost (const RacetrackState &node1, const RacetrackState &node2, double parentHCost) const
 
virtual bool GoalTest (const RacetrackState &node) const
 Goal Test if the goal is stored. More...
 
virtual uint64_t GetMaxHash () const
 
virtual void GetStateFromHash (uint64_t parent, RacetrackState &s) const
 
virtual double GetPathLength (std::vector< RacetrackState > &neighbors)
 
virtual double GetPathLength (const RacetrackState &start, std::vector< RacetrackMove > &neighbors)
 
virtual OccupancyInterface< RacetrackState, RacetrackMove > * GetOccupancyInfo ()
 
virtual void SetOccupancyInfo (OccupancyInterface< RacetrackState, RacetrackMove > *)
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (const RacetrackState &, const RacetrackState &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void GLLabelState (const RacetrackState &, const char *) const
 
virtual void GLDrawLine (const RacetrackState &x, const RacetrackState &y) const
 
virtual void GLDrawPath (const std::vector< RacetrackState > &x) const
 
virtual void SetColor (const rgbColor &r) const
 
virtual void SetColor (GLfloat rr, GLfloat g, GLfloat b, GLfloat t=1.0) const
 
virtual void GetColor (GLfloat &rr, GLfloat &g, GLfloat &b, GLfloat &t) const
 
virtual rgbColor GetColor () const
 
- Public Member Functions inherited from Heuristic< RacetrackState >
 Heuristic ()
 
virtual ~Heuristic ()
 

Private Member Functions

int GetIndex (int x, int y) const
 
void GetCarCoordinates (const RacetrackState &s, Graphics::point &center, Graphics::point &p1, Graphics::point &p2, Graphics::point &p3) const
 

Private Attributes

MapEnvironmentme
 
Mapmap
 
std::vector< int > heuristic
 

Additional Inherited Members

- Public Attributes inherited from Heuristic< RacetrackState >
std::vector< HeuristicTreeNodelookups
 
std::vector< Heuristic * > heuristics
 
uint64_t histogram [256]
 
- Protected Attributes inherited from SearchEnvironment< RacetrackState, RacetrackMove >
bool bValidSearchGoal
 
RacetrackState searchGoal
 
rgbColor color
 
GLfloat transparency
 

Detailed Description

Definition at line 47 of file Racetrack.h.

Constructor & Destructor Documentation

◆ Racetrack()

Racetrack::Racetrack ( Map map)

Definition at line 40 of file Racetrack.cpp.

References map, and UpdateMap().

◆ ~Racetrack()

Racetrack::~Racetrack ( )

Definition at line 47 of file Racetrack.cpp.

References me.

Member Function Documentation

◆ ApplyAction()

void Racetrack::ApplyAction ( RacetrackState s,
RacetrackMove  a 
) const
virtual

◆ Boundaries()

void Racetrack::Boundaries ( RacetrackState s,
RacetrackMove v 
) const

◆ Draw() [1/4]

void Racetrack::Draw ( Graphics::Display display) const
virtual

Reimplemented from SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 356 of file Racetrack.cpp.

References MapEnvironment::Draw(), and me.

◆ Draw() [2/4]

void Racetrack::Draw ( Graphics::Display display,
const RacetrackState s,
RacetrackMove a 
) const

◆ Draw() [3/4]

void Racetrack::Draw ( Graphics::Display display,
const RacetrackState l1,
const RacetrackState l2,
float  v 
) const

◆ Draw() [4/4]

void Racetrack::Draw ( Graphics::Display display,
const RacetrackState s 
) const
virtual

◆ DrawLine()

void Racetrack::DrawLine ( Graphics::Display display,
const RacetrackState x,
const RacetrackState y,
float  width 
) const
virtual

◆ GCost() [1/2]

double Racetrack::GCost ( const RacetrackState node,
const RacetrackMove act 
) const
inlinevirtual

Implements SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 74 of file Racetrack.h.

◆ GCost() [2/2]

double Racetrack::GCost ( const RacetrackState node1,
const RacetrackState node2 
) const
inlinevirtual

Implements SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 73 of file Racetrack.h.

◆ GetAction()

RacetrackMove Racetrack::GetAction ( const RacetrackState s1,
RacetrackState s2 
) const

◆ GetActionHash()

uint64_t Racetrack::GetActionHash ( RacetrackMove  act) const
virtual

Implements SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 350 of file Racetrack.cpp.

◆ GetActions()

void Racetrack::GetActions ( const RacetrackState nodeID,
std::vector< RacetrackMove > &  actions 
) const
virtual

Implements SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 122 of file Racetrack.cpp.

References Legal().

Referenced by GetSuccessors().

◆ GetCarCoordinates()

void Racetrack::GetCarCoordinates ( const RacetrackState s,
Graphics::point center,
Graphics::point p1,
Graphics::point p2,
Graphics::point p3 
) const
private

◆ GetIndex()

int Racetrack::GetIndex ( int  x,
int  y 
) const
inlineprivate

Definition at line 96 of file Racetrack.h.

References Map::GetMapWidth(), and map.

Referenced by HCost(), and UpdateMap().

◆ GetNumSuccessors()

int Racetrack::GetNumSuccessors ( const RacetrackState stateID) const
inlinevirtual

Reimplemented from SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 54 of file Racetrack.h.

References GetSuccessors().

◆ GetStateHash()

uint64_t Racetrack::GetStateHash ( const RacetrackState node) const
virtual

Implements SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 345 of file Racetrack.cpp.

References maxVelocity.

◆ GetSuccessors()

void Racetrack::GetSuccessors ( const RacetrackState nodeID,
std::vector< RacetrackState > &  neighbors 
) const
virtual

Implements SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 108 of file Racetrack.cpp.

References ApplyAction(), and GetActions().

Referenced by GetNumSuccessors().

◆ GoalTest()

bool Racetrack::GoalTest ( const RacetrackState node,
const RacetrackState goal 
) const
virtual

◆ HCost() [1/2]

double Racetrack::HCost ( const RacetrackState node) const
virtual

Heuristic value between node and the stored goal.

Asserts that the goal is stored

Reimplemented from SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 329 of file Racetrack.cpp.

References GetIndex(), heuristic, and min().

◆ HCost() [2/2]

double Racetrack::HCost ( const RacetrackState node1,
const RacetrackState node2 
) const
virtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 324 of file Racetrack.cpp.

◆ InvertAction()

bool Racetrack::InvertAction ( RacetrackMove a) const
virtual

Implements SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 222 of file Racetrack.cpp.

◆ Legal()

bool Racetrack::Legal ( const RacetrackState node1,
RacetrackMove act 
) const

◆ OpenGLDraw() [1/3]

void Racetrack::OpenGLDraw ( ) const
inline

Definition at line 81 of file Racetrack.h.

◆ OpenGLDraw() [2/3]

void Racetrack::OpenGLDraw ( const RacetrackState ) const
inlinevirtual

Reimplemented from SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 82 of file Racetrack.h.

◆ OpenGLDraw() [3/3]

void Racetrack::OpenGLDraw ( const RacetrackState ,
const RacetrackMove  
) const
inlinevirtual

Reimplemented from SearchEnvironment< RacetrackState, RacetrackMove >.

Definition at line 83 of file Racetrack.h.

◆ Reset()

void Racetrack::Reset ( RacetrackState s) const

◆ UpdateMap()

void Racetrack::UpdateMap ( Map map)

Member Data Documentation

◆ heuristic

std::vector<int> Racetrack::heuristic
private

Definition at line 95 of file Racetrack.h.

Referenced by HCost(), and UpdateMap().

◆ map

Map* Racetrack::map
private

◆ me

MapEnvironment* Racetrack::me
private

Definition at line 93 of file Racetrack.h.

Referenced by Draw(), DrawLine(), UpdateMap(), and ~Racetrack().


The documentation for this class was generated from the following files: