HOG2
RewardUnit.h
Go to the documentation of this file.
1 /*
2  * $Id: rewardUnit.h
3  * hog2
4  *
5  * Created by Nathan Sturtevant on 2/16/05.
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 #include "Unit.h"
14 #include "AStar.h"
15 
16 #ifndef REWARDUNIT_H
17 #define REWARDUNIT_H
18 
19 class rewardUnit : public unit {
20 public:
21  rewardUnit(int x, int y);
22  virtual const char *GetName() { return "rewardUnit"; }
23  virtual double sendReward() { return 1.0; }
24  virtual void receiveReward(double) {}
25  void OpenGLDraw(const MapProvider *, const SimulationInfo *) const;
26 };
27 
28 class rewardSeekingUnit : public rewardUnit {
29 public:
30  rewardSeekingUnit(int x, int y);
31  virtual const char *GetName() { return "rewardUnit"; }
32  virtual void receiveReward(double);
34  void OpenGLDraw(const MapProvider *, const SimulationInfo *) const;
36 private:
37  double goToRewardLoc(MapAbstraction *aMap, int which);
38  void addPathToCache(path *p);
39  std::vector<tDirection> moves;
40  std::vector<rewardUnit *> rewardLocs;
42 };
43 
44 #endif
rewardSeekingUnit::OpenGLDraw
void OpenGLDraw(const MapProvider *, const SimulationInfo *) const
Definition: RewardUnit.cpp:79
SimulationInfo
Definition: SimulationInfo.h:13
MapProvider
Definition: MapProvider.h:23
rewardSeekingUnit::GetName
virtual const char * GetName()
Definition: RewardUnit.h:31
rewardUnit::rewardUnit
rewardUnit(int x, int y)
Definition: RewardUnit.cpp:14
rewardUnit::GetName
virtual const char * GetName()
Definition: RewardUnit.h:22
rewardUnit::receiveReward
virtual void receiveReward(double)
Definition: RewardUnit.h:24
aStar
Definition: AStar.h:81
rewardSeekingUnit::a
aStar a
Definition: RewardUnit.h:41
rewardSeekingUnit
Definition: RewardUnit.h:28
rewardSeekingUnit::makeMove
virtual tDirection makeMove(MapProvider *, reservationProvider *, SimulationInfo *simInfo)
Definition: RewardUnit.cpp:42
rewardSeekingUnit::goToRewardLoc
double goToRewardLoc(MapAbstraction *aMap, int which)
Definition: RewardUnit.cpp:61
rewardSeekingUnit::receiveReward
virtual void receiveReward(double)
Definition: RewardUnit.cpp:37
tDirection
tDirection
Definition: Map2DEnvironment.h:77
rewardSeekingUnit::rewardLocs
std::vector< rewardUnit * > rewardLocs
Definition: RewardUnit.h:40
rewardUnit::sendReward
virtual double sendReward()
Definition: RewardUnit.h:23
rewardUnit
Definition: RewardUnit.h:19
rewardSeekingUnit::addRewardLocation
void addRewardLocation(rewardUnit *)
Definition: RewardUnit.cpp:104
rewardSeekingUnit::rewardSeekingUnit
rewardSeekingUnit(int x, int y)
Definition: RewardUnit.cpp:31
rewardUnit::OpenGLDraw
void OpenGLDraw(const MapProvider *, const SimulationInfo *) const
Definition: RewardUnit.cpp:20
reservationProvider
Definition: ReservationProvider.h:33
rewardSeekingUnit::moves
std::vector< tDirection > moves
Definition: RewardUnit.h:39
rewardSeekingUnit::addPathToCache
void addPathToCache(path *p)
Definition: RewardUnit.cpp:109
path
A linked list of nodes which form a continuous path.
Definition: Path.h:20
AStar.h
Unit.h