HOG2
SharedAMapGroup.h
Go to the documentation of this file.
1 /*
2  * $Id: SharedAMapGroup.h
3  * hog2
4  *
5  * Created by Nathan Sturtevant on 12/16/04.
6  * Modified by Nathan Sturtevant on 02/29/20.
7  *
8  * This file is part of HOG2. See https://github.com/nathansttt/hog2 for licensing information.
9  *
10  */
11 
12 
13 
14 #ifndef SHAREDAMAPGROUP_H
15 #define SHAREDAMAPGROUP_H
16 
17 #include "AbsMapUnit.h"
18 #include "UnitGroup.h"
19 #include "AbsMapUnitGroup.h"
20 #include "MapProvider.h"
21 
27 public:
30  virtual const char *GetName() { return "SharedAMapGroup"; }
31  //virtual tDirection makeMove(unit *u, MapProvider *mp, reservationProvider *rp, AbsMapSimulationInfo *simInfo);
32  virtual void OpenGLDraw(const AbsMapEnvironment *, const AbsMapSimulationInfo *) const;
33  virtual Map *GetMap() const;
34  virtual MapAbstraction *GetMapAbstraction();
35  virtual int GetNewTileCount() { return newTileCountPerTrial; }
36 
38  void UpdateLocation(Unit<xyLoc, tDirection, AbsMapEnvironment> *u, AbsMapEnvironment *, xyLoc &loc, bool success, AbsMapSimulationInfo *);
39  //virtual void updateLocation(BaseAbsMapUnit *, MapProvider *m, int _x, int _y, bool, AbsMapSimulationInfo *);
41  virtual bool Done();
43  void StartNewTrial(StatCollection *stats);
44  void LogStats(StatCollection *stats);
45 
46  void SetVisibilityRadius(int _visibility);
47  int GetVisibilityRadius();
48  bool Explored(int x, int y);
49  bool Explored(unsigned int _node);
50  //void printRoundStats(unit *, FILE *f);
51 
53  bool SeenBefore(int x, int y) { return (seen->Get(y * map->GetMapWidth() + x)); }
54 
55 protected:
56  //void setUnitSimulation(unitSimulation *_us, Map *m);
57 
58  MapAbstraction *aMap;
59  Map *map;
61  int visRadius;
62  bool sawNewLand;
65 };
66 
67 #endif
SharedAMapGroup::GetMap
virtual Map * GetMap() const
Definition: SharedAMapGroup.cpp:131
UnitGroup
Definition: UnitGroup.h:31
AbsMapUnitGroup.h
SimulationInfo
Definition: SimulationInfo.h:13
MapProvider
Definition: MapProvider.h:23
SharedAMapGroup::newTileCount
int newTileCount
Definition: SharedAMapGroup.h:63
SharedAMapGroup::GetMapAbstraction
virtual MapAbstraction * GetMapAbstraction()
Definition: SharedAMapGroup.cpp:126
SharedAMapGroup::map
Map * map
Definition: SharedAMapGroup.h:59
SharedAMapGroup::UpdateLocation
void UpdateLocation(Unit< xyLoc, tDirection, AbsMapEnvironment > *u, AbsMapEnvironment *, xyLoc &loc, bool success, AbsMapSimulationInfo *)
reset the location of a given unit
Definition: SharedAMapGroup.cpp:43
xyLoc
Definition: Map2DEnvironment.h:37
SharedAMapGroup::~SharedAMapGroup
~SharedAMapGroup()
Definition: SharedAMapGroup.cpp:36
AbsMapUnit.h
loc
Definition: MapGenerators.cpp:296
SharedAMapGroup::SetVisibilityRadius
void SetVisibilityRadius(int _visibility)
Definition: SharedAMapGroup.cpp:163
BitVector
Definition: BitVector.h:34
SharedAMapGroup::GetName
virtual const char * GetName()
Definition: SharedAMapGroup.h:30
SharedAMapGroup::SeenBefore
bool SeenBefore(int x, int y)
Definition: SharedAMapGroup.h:53
SharedAMapGroup::newTileCountPerTrial
int newTileCountPerTrial
Definition: SharedAMapGroup.h:64
SharedAMapGroup::aMap
MapAbstraction * aMap
Definition: SharedAMapGroup.h:58
Map::GetMapWidth
long GetMapWidth() const
return the width of the map
Definition: Map.h:163
SharedAMapGroup::StartNewTrial
void StartNewTrial(StatCollection *stats)
Lets the unit group do what it needs to reset a trial.
Definition: SharedAMapGroup.cpp:155
SharedAMapGroup
A group which incrementally builds a map of the world as the units in the group explore the Graph.
Definition: SharedAMapGroup.h:26
SharedAMapGroup::GetNewTileCountPerStep
int GetNewTileCountPerStep()
Definition: SharedAMapGroup.h:52
SharedAMapGroup::OpenGLDraw
virtual void OpenGLDraw(const AbsMapEnvironment *, const AbsMapSimulationInfo *) const
Definition: SharedAMapGroup.cpp:102
SharedAMapGroup::GetVisibilityRadius
int GetVisibilityRadius()
Definition: SharedAMapGroup.cpp:168
SharedAMapGroup::seen
BitVector * seen
Definition: SharedAMapGroup.h:60
StatCollection
The StatCollection class is for collecting stats across different parts of the simulation.
Definition: StatCollection.h:34
SharedAMapGroup::Explored
bool Explored(int x, int y)
Definition: SharedAMapGroup.cpp:173
SharedAMapGroup::SharedAMapGroup
SharedAMapGroup(MapProvider *)
Definition: SharedAMapGroup.cpp:20
SharedAMapGroup::Done
virtual bool Done()
Is the group done with their exploration?
Definition: SharedAMapGroup.cpp:137
SharedAMapGroup::LogStats
void LogStats(StatCollection *stats)
Definition: SharedAMapGroup.cpp:142
UnitGroup.h
SharedAMapGroup::visRadius
int visRadius
Definition: SharedAMapGroup.h:61
SharedAMapGroup::sawNewLand
bool sawNewLand
Definition: SharedAMapGroup.h:62
BitVector::Get
bool Get(uint64_t index) const
Definition: BitVector.h:54
Map
A tile-based representation of the world.
Definition: Map.h:142
SharedAMapGroup::GetNewTileCount
virtual int GetNewTileCount()
Definition: SharedAMapGroup.h:35
MapProvider.h
Unit
Definition: Unit.h:23