32 #include "../Landscape/ls.h"
33 #include "../BatchALMaSS/PopulationManager.h"
34 #include "../Hare/hare_all.h"
36 #include "../BatchALMaSS/BoostRandomGenerators.h"
37 extern boost::variate_generator<base_generator_type&, boost::uniform_real<> >
g_rand_uni;
64 #define __SQRS 100 // __SQRS is the number of m2 foraged per forage square
65 int y_add[8] = { -10, -10, 0, 10, 10, 10, 0, -10 };
66 int x_add[8] = { 0, 10, 10, 10, 0, -10, -10, -10 };
92 for (
int i=0; i<8; i++)
101 }
else if (food[i]==best)
111 if (food[pd]== best) bestsquare=pd;
114 if (food[pd]== best) bestsquare=pd;
118 while (bestsquare==-1)
121 if (food[t]==best) bestsquare=t;
130 TotalFood+=food[bestsquare];
139 int subtract=1+(bestsquare & 1);
140 if ( subtract == 1) nsqs = 3;
else nsqs = 5;
141 for (
int j=0; j<nsqs; j++) {
142 next=((bestsquare-subtract)+j) & 7;
153 for (
int j=1; j<nsqs; j++) {
154 if (food[j]>food[found]) found=j;
155 else if (food[j]==food[found]) {
161 bestsquare=((bestsquare-subtract)+found) & 7;
194 #define __SQRS 100 // __SQRS is the number of m2 foraged per forage square
195 int y_add[8] = { -10, -10, 0, 10, 10, 10, 0, -10 };
196 int x_add[8] = { 0, 10, 10, 10, 0, -10, -10, -10 };
212 double PesticideExposure = 0.0;
226 for (
int i = 0; i<8; i++)
232 pesticide[i] = tempP;
238 else if (food[i] == best)
248 if (food[pd] == best) bestsquare = pd;
250 pd = (pd - 1) & 0x07;
251 if (food[pd] == best) bestsquare = pd;
255 while (bestsquare == -1)
258 if (food[t] == best) bestsquare = t;
267 TotalFood += food[bestsquare];
268 PesticideExposure += pesticide[bestsquare];
278 int subtract = 1 + (bestsquare & 1);
279 if (subtract == 1) nsqs = 3;
else nsqs = 5;
280 for (
int j = 0; j<nsqs; j++) {
281 next = ((bestsquare - subtract) + j) & 7;
285 TotalFood += food[j];
292 for (
int j = 1; j<nsqs; j++) {
293 if (food[j]>food[found]) found = j;
294 else if (food[j] == food[found]) {
295 if (random(3) == 0) {
300 bestsquare = ((bestsquare - subtract) + found) & 7;
330 if ((a_x >= sw-10) || (a_y > sh-10) || (a_x < 0 ) || (a_y < 0))
336 int x = (sw+a_x+random(10)) % sw;
337 int y = (sh+a_y+random(10)) % sh;
354 int x = a_x+random(10);
355 int y = a_y+random(10);
375 double somepesticide = 0.0;
381 if ((a_x >= sw - 10) || (a_y > sh - 10) || (a_x < 0) || (a_y < 0))
384 for (
int i = 0; i<
__FSQRS; i++)
387 int x = (sw + a_x + random(10)) % sw;
388 int y = (sh + a_y + random(10)) % sh;
403 for (
int i = 0; i<
__FSQRS; i++)
405 int x = a_x + random(10);
406 int y = a_y + random(10);
471 if ((d1 == 0) && (d2 == 0))
return random(8);