|
@@ -24,7 +24,6 @@ Agent::Agent(PictureEnvironment* iEnvironment)
|
24
|
24
|
|
25
|
25
|
void Agent::loop()
|
26
|
26
|
{
|
27
|
|
- fEnvironment->getPerception(&fCurrentPerception, fXPos, fYPos);
|
28
|
27
|
move();
|
29
|
28
|
this->paint();
|
30
|
29
|
}
|
|
@@ -33,8 +32,10 @@ int MOVESIZE = 10;
|
33
|
32
|
|
34
|
33
|
void Agent::move()
|
35
|
34
|
{
|
36
|
|
- fXPos += ((double)rand() / RAND_MAX) * MOVESIZE - ((double)MOVESIZE / 2);
|
37
|
|
- fYPos += ((double)rand() / RAND_MAX) * MOVESIZE - ((double)MOVESIZE / 2);
|
|
35
|
+ double vRand = rand() % (MOVESIZE + 1);
|
|
36
|
+ fXPos += vRand - MOVESIZE / 2;
|
|
37
|
+ vRand = rand() % (MOVESIZE + 1);
|
|
38
|
+ fYPos += vRand - MOVESIZE / 2;
|
38
|
39
|
}
|
39
|
40
|
|
40
|
41
|
void Agent::paint()
|