HOG2
mapalgorithms
RHRUnit.cpp
Go to the documentation of this file.
1
/*
2
* RHRUnit.cpp
3
* hog2
4
*
5
* Created by Nathan Sturtevant on 4/23/07.
6
* Copyright 2007 Nathan Sturtevant, University of Alberta. All rights reserved.
7
*
8
*/
9
10
#include "
RHRUnit.h
"
11
17
bool
RHRUnit::MakeMove
(
MapEnvironment
*,
OccupancyInterface<xyLoc, tDirection>
*,
MapSimulationInfo
*,
tDirection
& dir)
18
{
19
dir =
possibleDir
[
lastIndex
];
20
return
true
;
21
}
22
30
void
RHRUnit::UpdateLocation
(
MapEnvironment
*,
xyLoc
&l,
bool
success,
MapSimulationInfo
*)
31
{
32
loc
= l;
33
if
(
initial
&& success)
34
{
35
return
;
36
}
37
else
if
(
initial
&& !success)
38
initial
=
false
;
39
if
(success)
40
{
// I moved successfully
41
lastIndex
= (
lastIndex
+2)%8;
42
}
43
else
{
44
lastIndex
= (
lastIndex
+6)%8;
45
}
46
}
RHRUnit::MakeMove
bool MakeMove(MapEnvironment *, OccupancyInterface< xyLoc, tDirection > *, MapSimulationInfo *, tDirection &)
Make the next move.
Definition:
RHRUnit.cpp:17
SimulationInfo
Definition:
SimulationInfo.h:13
RHRUnit::UpdateLocation
void UpdateLocation(MapEnvironment *, xyLoc &, bool, MapSimulationInfo *)
set rhr unit location.
Definition:
RHRUnit.cpp:30
xyLoc
Definition:
Map2DEnvironment.h:37
possibleDir
const tDirection possibleDir[numActions]
Definition:
Map2DEnvironment.h:104
MapEnvironment
Definition:
Map2DEnvironment.h:133
loc
Definition:
MapGenerators.cpp:296
tDirection
tDirection
Definition:
Map2DEnvironment.h:77
RHRUnit::initial
bool initial
Definition:
RHRUnit.h:29
RHRUnit::lastIndex
int lastIndex
Definition:
RHRUnit.h:28
RHRUnit.h
OccupancyInterface< xyLoc, tDirection >
Generated by
1.8.17