ALMaSS Vole ODDox  1.1
The vole model description following ODdox protocol
Predators.cpp
Go to the documentation of this file.
1 /*
2 *******************************************************************************************************
3 Copyright (c) 2011, Christopher John Topping, Aarhus University
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without modification, are permitted provided
7 that the following conditions are met:
8 
9 Redistributions of source code must retain the above copyright notice, this list of conditions and the
10 following disclaimer.
11 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
12 the following disclaimer in the documentation and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
15 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
17 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
18 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
19 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 ********************************************************************************************************
23 */
32 //---------------------------------------------------------------------------
33 
34 #include <iostream>
35 #include <fstream>
36 #include<vector>
37 #include "../Landscape/ls.h"
38 #include "../BatchALMaSS/PopulationManager.h"
39 #include "../Vole/GeneticMaterial.h"
40 #include "../Vole/vole_all.h"
41 #include "../Vole/Predators.h"
42 #include "../BatchALMaSS/BinaryMapBase.h"
43 #include "../BatchALMaSS/MovementMap.h"
44 #include "../Vole/VolePopulationManager.h"
45 
46 //---------------------------------------------------------------------------
47 
48 #define WEASEL 0
49 #define OWL 1
50 
51 static CfgBool cfg_PredMortalityDataUsed("PRED_MORTALITY_DATA_USED",CFG_CUSTOM, false);
52 static CfgBool cfg_PredSampleDataUsed("PRED_SAMPLE_DATA_USED",CFG_CUSTOM, false);
53 
54 static CfgInt cfg_pred_first_sample_day("PRED_SAMPLE_FILE_DAY_ONE", CFG_CUSTOM,109);
55 static CfgInt cfg_pred_second_sample_day( "PRED_SAMPLE_FILE_DAY_TWO", CFG_CUSTOM,287 );
56 
57 static CfgInt cfg_weasel_breed_threshold( "WEASEL_BT", CFG_CUSTOM,5 );
58 static CfgInt cfg_owl_breed_threshold( "OWL_BT", CFG_CUSTOM,5000000 );
59 static CfgInt cfg_weasel_death_threshold( "WEASEL_DT", CFG_CUSTOM,10 );
60 static CfgInt cfg_owl_death_threshold( "OWL_DT", CFG_CUSTOM,-1 );
61 static CfgInt cfg_weasel_breed_day( "WEASEL_BD", CFG_CUSTOM,115 );
62 static CfgInt cfg_owl_breed_day( "OWL_BD", CFG_CUSTOM,120 );
63 static CfgInt cfg_weasel_kill_efficiency("WEASEL_KILL_EFF",CFG_CUSTOM,250);
64 static CfgInt cfg_weasel_home_range("WEASEL_HOME_RANGE",CFG_CUSTOM,250);
65 static CfgInt cfg_weasel_search_area("WEASEL_SEARCH_AREA",CFG_CUSTOM,100);
66 static CfgInt cfg_weasel_NoFailuresBeforeDispersal("WEASEL_FAILURES",CFG_CUSTOM,10);
67 static CfgInt cfg_weasel_DispersalMax("WEASEL_DISPERSAL_MAX",CFG_CUSTOM,200);
68 static CfgInt cfg_weasel_StartingNo("WEASEL_START_NO",CFG_CUSTOM,0);
69 static CfgInt cfg_owl_StartingNo("OWL_START_NO",CFG_CUSTOM,0);
70 
71 // Constants for the predator species that need to be fast
80 
81 //---------------------------------------------------------------------------
82 
84 {
85  // Should all be done by the Population_Manager destructor
86 }
87 //---------------------------------------------------------------------------
88 
92 {
93  // Constants for the predator species
102  // Must now create as many array elements as we have predator types
103  // two lists are needed so need to remove 8 of the ten default arrays
104  // Weasels and Owls
105  for (int i=0; i<8; i++)
106  {
107  TheArray.pop_back();
108  }
109  // Remember the prey
110  m_Prey=VPM;
113  // Create some weasels and owls
114  struct_Predator* sp;
115  sp = new struct_Predator;
116  sp->PM = this;
117  sp->L = m_TheLandscape;
119  for (int i=0; i<weasel_StartingNo; i++)
120  {
121  sp->x = random(SimW);
122  sp->y = random(SimH);
123  CreateObjects(0,NULL,sp,1); // 0 = weasel
124  }
125  for (int i=0; i<owl_StartingNo; i++)
126  {
127  sp->x = random(SimW);
128  sp->y = random(SimH);
129  CreateObjects(1,NULL,sp,1); // 1 = Owl
130  }
131  delete sp;
134 }
135 
136 //---------------------------------------------------------------------------
138  TAnimal * ,struct_Predator * data,int number)
139 {
140  Weasel* new_Weasel;
141  Owl* new_Owl;
142  for (int i=0; i<number; i++)
143  {
144  if (ob_type == WEASEL) // Weasel
145  {
146  new_Weasel = new Weasel(m_Prey,data->x, data->y, data->L, data->PM);
147  TheArray[ob_type].push_back(new_Weasel);
148  inc_inds(WEASEL);
149  }
150  if (ob_type == OWL) // Owl
151  {
152  new_Owl = new Owl(m_Prey,data->x, data->y, data->L, data->PM);
153  TheArray[ob_type].push_back(new_Owl);
154  inc_inds(OWL);
155  }
156  }
157 }
158 
159 //---------------------------------------------------------------------------
160 
162 
163  int today = m_TheLandscape->SupplyDayInYear();
164  int year = m_TheLandscape->SupplyYearNumber();
165  int month = m_TheLandscape->SupplyMonth();
166  int dayinMo = m_TheLandscape->SupplyDayInMonth();
167 
168  if ((cfg_weasel_StartingNo.value())&& (cfg_owl_StartingNo.value()> 0)){
169 
170  FILE* pref=fopen("PredSampleData.txt","a");
171  if (pref == NULL) {
172  m_TheLandscape->Warn("TPredator_Population_Manager::PredSampleFile","Could Not Open PredSampleData.txt File");
173  exit(0);
174  }
175 
176  Weasel* Wp;
177  unsigned int SizeWeasel = (unsigned int) TheArray[0].size();
178  Owl* Op;
179  unsigned int SizeOwl = (unsigned int) TheArray[1].size();
180  unsigned int TotalSize = SizeWeasel+SizeOwl;
181 
184  fprintf(pref,"%d\t %d\t %d\t %d\t %u\t %u\n", 0,w ,0, h, SizeWeasel, TotalSize);
185 
186  for (unsigned i=0; i<SizeWeasel; i++){
187 
188  Wp=dynamic_cast<Weasel*>(TheArray[0][i]);
189  int Wx = Wp->Supply_m_Location_x();
190  int Wy = Wp->Supply_m_Location_y();
191  int Wpoly = m_TheLandscape->SupplyPolyRef(Wx, Wy);
192  int Wele = m_TheLandscape->SupplyElementType(Wpoly);
193  int Wveg = m_TheLandscape->SupplyVegType(Wpoly);
194 
195  unsigned Wspecies = Wp->SupplySpeciesID();
196  int kill = Wp->SupplyKill();
197  int KillEff = Wp->SupplyKillEff();
198  int Terr = Wp->SupplyTerr();
199  int HomeR = Wp->SupplyHomeRange();
200 
201  fprintf(pref,"%d\t",year);
202  fprintf(pref,"%d\t",month);
203  fprintf(pref,"%d\t",dayinMo);
204  fprintf(pref,"%d\t",today);
205 
206  fprintf(pref,"%d\t",Wspecies);
207  fprintf(pref,"%d\t",kill);
208  fprintf(pref,"%d\t",KillEff);
209  fprintf(pref,"%d\t",Terr);
210  fprintf(pref,"%d\t",HomeR);
211 
212  fprintf(pref,"%d\t",Wx);
213  fprintf(pref,"%d\t",Wy);
214  fprintf(pref,"%d\t",Wpoly);
215  fprintf(pref,"%d\t",Wele);
216  fprintf(pref,"%d\t",Wveg);
217  fprintf(pref,"\n");
218  }
219 
220  fprintf(pref,"%d\t %d\t %d\t %d\t %u\t %u\n", 0,w ,0, h, SizeOwl, TotalSize);
221 
222  for (unsigned i = 0; i < SizeOwl; i++){
223  Op=dynamic_cast<Owl*>(TheArray[1][i]);
224  int Ox = Op->Supply_m_Location_x();
225  int Oy = Op->Supply_m_Location_y();
226  int Opoly = m_TheLandscape->SupplyPolyRef(Ox, Oy);
227  int Oele = m_TheLandscape->SupplyElementType(Opoly);
228  int Oveg = m_TheLandscape->SupplyVegType(Opoly);
229 
230  int species = Op->SupplySpeciesID();
231  int kill = Op->SupplyKill();
232  int KillEff = Op->SupplyKillEff();
233  int Terr = Op->SupplyTerr();
234  int HomeR = Op->SupplyHomeRange();
235 
236  fprintf(pref,"%d\t",year);
237  fprintf(pref,"%d\t",month);
238  fprintf(pref,"%d\t",dayinMo);
239  fprintf(pref,"%d\t",today);
240 
241  fprintf(pref,"%d\t",species);
242  fprintf(pref,"%d\t",kill);
243  fprintf(pref,"%d\t",KillEff);
244  fprintf(pref,"%d\t",Terr);
245  fprintf(pref,"%d\t",HomeR);
246 
247  fprintf(pref,"%d\t",Ox);
248  fprintf(pref,"%d\t",Oy);
249  fprintf(pref,"%d\t",Opoly);
250  fprintf(pref,"%d\t",Oele);
251  fprintf(pref,"%d\t",Oveg);
252  fprintf(pref,"\n");
253  }
254  fclose(pref);
255  }
256 
257  else if (cfg_weasel_StartingNo.value()> 0){
258 
259  FILE* pref=fopen("PredSampleData.txt","a");
260  if (pref == NULL) {
261  m_TheLandscape->Warn("TPredator_Population_Manager::PredSampleFile","Could Not Open PredSampleData.txt File");
262  exit(0);
263  }
264 
265  Weasel* Wp;
266  unsigned int SizeWeasel = (unsigned int) TheArray[0].size();
267  unsigned int TotalSize = (unsigned int) SizeWeasel;
268 
271  fprintf(pref,"%d\t %d\t %d\t %d\t %u\t %u\n", 0,w ,0, h, SizeWeasel, TotalSize);
272 
273  for (unsigned i = 0; i < SizeWeasel; i++){
274  Wp=dynamic_cast<Weasel*>(TheArray[0][i]);
275  int Wx = Wp->Supply_m_Location_x();
276  int Wy = Wp->Supply_m_Location_y();
277 
278  int Wpoly = m_TheLandscape->SupplyPolyRef(Wx, Wy);
279  int Wele = m_TheLandscape->SupplyElementType(Wpoly);
280  int Wveg = m_TheLandscape->SupplyVegType(Wpoly);
281 
282  int species = Wp->SupplySpeciesID();
283  int kill = Wp->SupplyKill();
284  int KillEff = Wp->SupplyKillEff();
285  int Terr = Wp->SupplyTerr();
286  int HomeR = Wp->SupplyHomeRange();
287 
288  fprintf(pref,"%d\t",year);
289  fprintf(pref,"%d\t",month);
290  fprintf(pref,"%d\t",dayinMo);
291  fprintf(pref,"%d\t",today);
292 
293  fprintf(pref,"%d\t",species);
294  fprintf(pref,"%d\t",kill);
295  fprintf(pref,"%d\t",KillEff);
296  fprintf(pref,"%d\t",Terr);
297  fprintf(pref,"%d\t",HomeR);
298 
299  fprintf(pref,"%d\t",Wx);
300  fprintf(pref,"%d\t",Wy);
301  fprintf(pref,"%d\t",Wpoly);
302  fprintf(pref,"%d\t",Wele);
303  fprintf(pref,"%d\t",Wveg);
304  fprintf(pref,"\n");
305  }
306  fclose(pref);
307  }
308 
309  else if (cfg_owl_StartingNo.value()> 0) {
310 
311  FILE* pref=fopen("PredSampleData.txt","a");
312  if (pref == NULL) {
313  m_TheLandscape->Warn("TPredator_Population_Manager::PredSampleFile","Could Not Open PredSampleData.txt File");
314  exit(0);
315  }
316 
317  Owl* Op;
318  unsigned int SizeOwl = (unsigned int) TheArray[1].size();
319  unsigned int TotalSize = SizeOwl;
322  fprintf(pref,"%d\t %d\t %d\t %d\t %u\t %u\n", 0,w ,0, h, SizeOwl, TotalSize);
323 
324  for (unsigned i = 0; i < SizeOwl; i++){
325  Op=dynamic_cast<Owl*>(TheArray[1][i]);
326  int Wx = Op->Supply_m_Location_x();
327  int Wy = Op->Supply_m_Location_y();
328  int Wpoly = m_TheLandscape->SupplyPolyRef(Wx, Wy);
329  int Wele = m_TheLandscape->SupplyElementType(Wpoly);
330  int Wveg = m_TheLandscape->SupplyVegType(Wpoly);
331 
332  int Wspecies = Op->SupplySpeciesID();
333  int Wkill = Op->SupplyKill();
334  int WKillEff = Op->SupplyKillEff();
335  int Terr = Op->SupplyTerr();
336  int HomeR = Op->SupplyHomeRange();
337 
338  fprintf(pref,"%d\t",year);
339  fprintf(pref,"%d\t",month);
340  fprintf(pref,"%d\t",dayinMo);
341  fprintf(pref,"%d\t",today);
342 
343  fprintf(pref,"%d\t",Wspecies);
344  fprintf(pref,"%d\t",Wkill);
345  fprintf(pref,"%d\t",WKillEff);
346  fprintf(pref,"%d\t",Terr);
347  fprintf(pref,"%d\t",HomeR);
348 
349  fprintf(pref,"%d\t",Wx);
350  fprintf(pref,"%d\t",Wy);
351  fprintf(pref,"%d\t",Wpoly);
352  fprintf(pref,"%d\t",Wele);
353  fprintf(pref,"%d\t",Wveg);
354  fprintf(pref,"\n");
355  }
356  fclose(pref);
357  }
358 }
359 //-------------------------------------------------------------------------------------------------------
361 {
362  int today = m_TheLandscape->SupplyDayInYear();
363  int year = m_TheLandscape->SupplyYearNumber();
364 
365  if ((cfg_weasel_StartingNo.value()> 0)&& (cfg_owl_StartingNo.value()> 0)){
366  FILE* pref=fopen("PredAutumnOutput.txt","a");
367  if (pref == NULL) {
368  m_TheLandscape->Warn("TPredator_Population_Manager::PredAutumnSample","Could Not Open PredAutumnOutput.txt File");
369  exit(0);
370  }
371 
372  unsigned int SizeWeasel = (unsigned int) TheArray[0].size();
373  unsigned int SizeOwl = (unsigned int) TheArray[1].size();
374  unsigned int TotalSize = SizeWeasel+SizeOwl;
375 
376  fprintf(pref,"%d\t", year);
377  fprintf(pref,"%d\t", today);
378  fprintf(pref,"%d\t", SizeWeasel);
379  fprintf(pref,"%d\t", SizeOwl);
380  fprintf(pref,"%d\t", TotalSize);
381  fprintf(pref,"\n");
382 
383  fclose(pref);
384  }
385 
386  else if (cfg_weasel_StartingNo.value()> 0){
387  unsigned int SizeWeasel = (unsigned int) TheArray[0].size();
388 
389  FILE* pref = fopen("PredAutumnOutput.txt","a");
390  if (pref == NULL) {
391  m_TheLandscape->Warn("TPredator_Population_Manager::PredAutumnSample","Could Not Open PredAutumnOutput.txt File");
392  exit(0);
393  }
394  fprintf(pref,"%d\t", year);
395  fprintf(pref,"%d\t", today);
396  fprintf(pref,"%d\t", SizeWeasel);
397  fprintf(pref,"%d\t", 0);
398  fprintf(pref,"%d\t", SizeWeasel);
399  fprintf(pref,"\n");
400 
401  fclose(pref);
402  }
403 
404  else if (cfg_owl_StartingNo.value()> 0) {
405  unsigned int SizeOwl = (unsigned int)TheArray[1].size();
406 
407  FILE* pref = fopen("PredAutumnOutput.txt","a");
408  if (pref == NULL) {
409  m_TheLandscape->Warn("TPredator_Population_Manager::PredAutumnSample","Could Not Open PredAutumnOutput.txt File");
410  exit(0);
411  }
412  fprintf(pref,"%d\t", year);
413  fprintf(pref,"%d\t", today);
414  fprintf(pref,"%d\t", 0);
415  fprintf(pref,"%d\t", SizeOwl);
416  fprintf(pref,"%d\t", SizeOwl);
417  fprintf(pref,"\n");
418 
419  fclose(pref);
420  }
421 }
422 //-------------------------------------------------------------------------------------------------------
424 {
425  int today = m_TheLandscape->SupplyDayInYear();
426  int year = m_TheLandscape->SupplyYearNumber();
427 
428  if ((cfg_weasel_StartingNo.value())&& (cfg_owl_StartingNo.value()> 0)){
429  unsigned int SizeWeasel = (unsigned int) TheArray[0].size();
430  unsigned int SizeOwl = (unsigned int) TheArray[1].size();
431  unsigned int TotalSize = SizeWeasel+SizeOwl;
432 
433  FILE* pref=fopen("PredSpringOutput.txt","a");
434  if (pref == NULL) {
435  m_TheLandscape->Warn("TPredator_Population_Manager::PredSpringSample","Could Not Open PredSpringOutput.txt File");
436  exit(0);
437  }
438  fprintf(pref,"%d\t", year);
439  fprintf(pref,"%d\t", today);
440  fprintf(pref,"%d\t", SizeWeasel);
441  fprintf(pref,"%d\t", SizeOwl);
442  fprintf(pref,"%d\t", TotalSize);
443  fprintf(pref,"\n");
444 
445  fclose(pref);
446  }
447 
448  else if (cfg_weasel_StartingNo.value()> 0){
449  unsigned int SizeWeasel = (unsigned int) TheArray[0].size();
450 
451  FILE* pref=fopen("PredSpringOutput.txt","a");
452  if (pref == NULL) {
453  m_TheLandscape->Warn("TPredator_Population_Manager::PredSpringSample","Could Not Open PredSpringOutput.txt File");
454  exit(0);
455  }
456  fprintf(pref,"%d\t", year);
457  fprintf(pref,"%d\t", today);
458  fprintf(pref,"%d\t", SizeWeasel);
459  fprintf(pref,"%d\t", 0);
460  fprintf(pref,"%d\t", SizeWeasel);
461  fprintf(pref,"\n");
462 
463  fclose(pref);
464  }
465 
466  else if (cfg_owl_StartingNo.value()> 0) {
467  unsigned int SizeOwl = (unsigned int) TheArray[1].size();
468 
469  FILE* pref=fopen("PredSpringOutput.txt","a");
470  if (pref == NULL) {
471  m_TheLandscape->Warn("TPredator_Population_Manager::PredSpringSample","Could Not Open PredSpringOutput.txt File");
472  exit(0);
473  }
474  fprintf(pref,"%d\t", year);
475  fprintf(pref,"%d\t", today);
476  fprintf(pref,"%d\t", 0);
477  fprintf(pref,"%d\t", SizeOwl);
478  fprintf(pref,"%d\t", SizeOwl);
479  fprintf(pref,"\n");
480 
481  fclose(pref);
482  }
483 }
484 
485 //-------------------------------------------------------------------------------------------------------
487 {
488  int today = m_TheLandscape->SupplyDayInYear();
489  int year = m_TheLandscape->SupplyYearNumber();
490 
491  if ((cfg_weasel_StartingNo.value())&& (cfg_owl_StartingNo.value()> 0)){
492  unsigned int SizeWeasel = (unsigned int) TheArray[0].size();
493  unsigned int SizeOwl = (unsigned int) TheArray[1].size();
494  unsigned int TotalSize = SizeWeasel+SizeOwl;
495 
496  FILE* pref=fopen("PredSpringAutumnOutput.txt","a");
497  if (pref == NULL) {
498  m_TheLandscape->Warn("TPredator_Population_Manager::PredSpringAutumnSample","Could Not Open PredSpringAutumnOutput.txt File");
499  exit(0);
500  }
501 
502  fprintf(pref,"%d\t", year);
503  fprintf(pref,"%d\t", today);
504  fprintf(pref,"%d\t", SizeWeasel);
505  fprintf(pref,"%d\t", SizeOwl);
506  fprintf(pref,"%d\t", TotalSize);
507  fprintf(pref,"\n");
508 
509  fclose(pref);
510  }
511 
512  else if (cfg_weasel_StartingNo.value()> 0){
513  unsigned int SizeWeasel = (unsigned int) TheArray[0].size();
514 
515  FILE* pref=fopen("PredSpringAutumnOutput.txt","a");
516  if (pref == NULL) {
517  m_TheLandscape->Warn("TPredator_Population_Manager::PredSpringAutumnSample","Could Not Open PredSpringAutumnOutput.txt File");
518  exit(0);
519  }
520  fprintf(pref,"%d\t", year);
521  fprintf(pref,"%d\t", today);
522  fprintf(pref,"%d\t", SizeWeasel);
523  fprintf(pref,"%d\t", 0);
524  fprintf(pref,"%d\t", SizeWeasel);
525  fprintf(pref,"\n");
526 
527  fclose(pref);
528  }
529  else if (cfg_owl_StartingNo.value()> 0) {
530  unsigned int SizeOwl = (unsigned int) TheArray[1].size();
531 
532  FILE* pref=fopen("PredSpringAutumnOutput.txt","a");
533  if (pref == NULL) {
534  m_TheLandscape->Warn("TPredator_Population_Manager::PredSpringAutumnSample","Could Not Open PredSpringAutumnOutput.txt File");
535  exit(0);
536  }
537  fprintf(pref,"%d\t", year);
538  fprintf(pref,"%d\t", today);
539  fprintf(pref,"%d\t", 0);
540  fprintf(pref,"%d\t", SizeOwl);
541  fprintf(pref,"%d\t", SizeOwl);
542  fprintf(pref,"\n");
543 
544  fclose(pref);
545  }
546 }
547 
548 
549 
550 //---------------------------------------------------------------------------------------
551 //---------------------------------------------------------------------------------------
552 
554 {
555  DoFirst();
556  // begin step actions ...
557  // set all stepdone to false.... is this really necessary??
558  int today = m_TheLandscape->SupplyDayInYear();
560 
561  if (cfg_PredSampleDataUsed.value() ){
562  if (today==cfg_pred_first_sample_day.value() || today ==cfg_pred_second_sample_day.value())
563  {
564  PredSampleFile();
566  }
567  if (today == cfg_pred_first_sample_day.value())
568  {
570  }
571  if (today == cfg_pred_second_sample_day.value())
572  {
574  }
575  }
576 
577  if (today==364 ) {
578  FILE* pref = fopen("PredProbe.txt","a");
579  if (!pref) {
580  m_TheLandscape->Warn("Predator_Population_Manager Destructor","Could Not Open PredProbe.txt File");
581  exit(0);
582  }
583  if ((TheArray[0].size()> 0)&& (TheArray[1].size()> 0)){
584  unsigned int PredNo0 = (unsigned int) TheArray[0].size();
585  unsigned int PredNo1 = (unsigned int) TheArray[1].size();
586  fprintf(pref,"%d\t%u\t%u\t%u\t%u\n", Y, 0, PredNo0, 1, PredNo1);
587  }
588  else if (TheArray[0].size()> 0){
589  unsigned int PredNo0 = (unsigned int) TheArray[0].size();
590  fprintf(pref,"%d\t%u\t%u\n", Y, 0, PredNo0);
591  }
592  else if (TheArray[1].size()> 0) {
593  unsigned int PredNo1 = (unsigned int) TheArray[1].size();
594  fprintf(pref,"%d\t%u\t%u\n", Y, 1, PredNo1);
595  }
596  fclose(pref);
597  }
598 // cal
599  for (unsigned listindex=0; listindex<TheArray.size(); listindex++)
600  {
601  for (unsigned j=0; j<TheArray[listindex].size(); j++)
602  {
603  TheArray[listindex][j]->SetStepDone(false);
604  }
605  }
606  // call the begin-step-method of all objects
607  for (unsigned listindex=0; listindex<TheArray.size();listindex++)
608  {
609  for (unsigned j=0; j<TheArray[listindex].size(); j++)
610  TheArray[listindex][j]->BeginStep();
611  }
612  DoBefore();
613  // call the step-method of all objects
614  do
615  {
616  for (unsigned listindex=0; listindex<TheArray.size();listindex++)
617  {
618  for (unsigned j=0; j<TheArray[listindex].size(); j++)
619  {
620  TheArray[listindex][j]->Step();
621  }
622  } // for listindex
623  } while (!StepFinished());
624  DoAfter();
625  // call the end-step-method of all objects
626  for (unsigned listindex=0; listindex<TheArray.size();listindex++)
627  {
628  for (unsigned j=0; j<TheArray[listindex].size(); j++)
629  {
630  TheArray[listindex][j]->EndStep();
631  }
632  }
633  // ----------------
634  // end of this step actions
635 
636  // For each animal list
637  for (unsigned listindex=0; listindex<TheArray.size();listindex++)
638  {
639  // Must check each object in the list for m_CurrentStateNo==-1
640  int TAend=(int)TheArray[listindex].size()-1;
641  for (int j=TAend; j>=0; j--) // Search backwards is more efficicent
642  {
643  if (TheArray[listindex][j]->GetCurrentStateNo() == -1) // code for kill it
644  {
645  delete TheArray[listindex][j];
646  TheArray[listindex].erase(TheArray[listindex].begin()+j);
647  }
648  }
649  }
650  DoLast();
651 }
652 //---------------------------------------------------------------------------
653 
654 // returns true if and only if all objects have finished the current step
656 {
657  for (unsigned listindex=0; listindex<TheArray.size();listindex++)
658  {
659  for (unsigned j=0; j<TheArray[listindex].size(); j++)
660  {
661  if (TheArray[listindex][j]->GetStepDone() == false)
662  {
663  return false;
664  }
665  }
666  }
667  return true;
668 }
669 //---------------------------------------------------------------------------
670 
671 bool TPredator_Population_Manager::InOtherTerritory(unsigned sp, int x, int y,
672  TPredator* p_Pred)
673 {
674  // Go through sp species and see if a territory at x,y will overlap with
675  // theirs
676  for (unsigned i=0; i<TheArray[sp].size(); i++)
677  {
678  TPredator* APredator=(TPredator *)TheArray[sp][i];
679  if (APredator->OverlapMyTerritory(x,y))
680  {
681  if (APredator!=p_Pred) return true;
682  }
683  }
684  return false;
685 }
686 //---------------------------------------------------------------------------
687 
688 
689 //---------------------------------------------------------------------------
690 // TPREDATOR CODE
691 //---------------------------------------------------------------------------
692 
697  Landscape* p_L, TPredator_Population_Manager* p_PPM) : TAnimal(p_x,p_y,p_L)
698 {
702  m_FailureCount=0;
703  m_NoFailuresBeforeDispersal=5; // Default
705  m_Prey = ThePrey;
708  m_HomeRange=0;
709  m_HaveTerritory=false;
710  m_SearchArea=0;
711  m_DispersalMax=0;
714  PreyResponse1=0;
715  PreyResponse2=0;
716 }
717 //---------------------------------------------------------------------------
718 
720 {
721 
722 }
723 
724 //---------------------------------------------------------------------------
725 
727 {
728  unsigned kills=0;
729  // count days since last kill
730  // Takes the Search_x, Search_y, SearchArea. Applies KillEfficiency to
731  // all voles defined by this square
733  //int s=CurrentPrey->size(); // **CJT** to help with debug
734  for (unsigned i=0; i<CurrentPrey->size(); i++)
735  {
736  if (random(1000)<m_KillEfficiency)
737  {
738  (*CurrentPrey)[i]->OnKilled();
739  kills++;
740  }
741  }
742  // Must tidy up here because m_Prey cannot know when to do it
743  CurrentPrey->clear();
744  delete CurrentPrey;
745  // record the kills
746  m_kills_this_season+=kills;
747  return kills;
748 }
749 
750 
751 //---------------------------------------------------------------------------
752 
754 {
755  // Can relocate search_x & search_y to be up somewhere in the homerange
756  // but must have all the square in the HomeRange
757  // 1. Drift a bit
758  m_Location_x+=random(3)-1;
759  m_Location_y+=random(3)-1;
762  // 2. determine search area
763  int max_dist=m_HomeRange-m_SearchArea;
764  m_Search_x=(m_Location_x+random(max_dist))%SimW;
765  m_Search_y=(m_Location_y+random(max_dist))%SimH;
766 }
767 
768 //---------------------------------------------------------------------------
769 
770 bool TPredator::OverlapMyTerritory(unsigned x, unsigned y)
771 {
772  // ensure we can't go negative
773  x+=SimW;
774  y+=SimH;
775  unsigned mx = m_Location_x+SimW;
776  unsigned my = m_Location_y+SimH;
777  // most likely that it is not in so test for false
778  if (x<mx-m_HomeRange) return false;
779  else if (x>=mx+m_HomeRange) return false;
780  else if (y<my-m_HomeRange) return false;
781  else if (y>=my+m_HomeRange) return false;
782  else return true;
783 }
784 
785 //---------------------------------------------------------------------------
786 
788 {
789 
793  bool found=false;
794  unsigned Count=0;
795  while ((!found)&&(Count<100))
796  {
797  // Simple random walk
798  Count++;
802  m_Location_y,this))
803  {
804  m_HaveTerritory=true;
805  found=true;
806  }
807  }
808 }
809 
810 
811 //---------------------------------------------------------------------------
812 // WEASEL CODE
813 //---------------------------------------------------------------------------
814 
815 
816 Weasel::Weasel(Vole_Population_Manager* ThePrey, int p_x, int p_y,
818  : TPredator(ThePrey,p_x,p_y,p_L,p_PPM)
819 {
820  SpeciesID=0;
826  PreyResponse1=1;
827  PreyResponse2=1;
828  SpeciesID=0;
829 }
830 //---------------------------------------------------------------------------
831 
832 
834 {
835  //Nothing to do
836 }
837 //---------------------------------------------------------------------------
838 
840 {
841  int day= m_OurLandscape->SupplyDayInYear();
842  if (day==weasel_breed_day)
843  {
845  for (int k=0; k<noToMake; k++)
846  {
847  // make a new weasel
848  struct_Predator* sp;
849  sp = new struct_Predator;
851  sp->L = m_OurLandscape;
852  sp->x = m_Location_x;
853  sp->y = m_Location_y;
854  m_OurPopulationManager->CreateObjects(0,NULL,sp,1); // 0 = weasel
855  delete sp;
856  }
857  }
858  else if (day==364)
859  {
861  {
863  {
865  KillThis();
866  }
867  }
868  m_kills_this_season=0; // reset the count
869  }
870 }
871 //---------------------------------------------------------------------------
872 
874 {
875  if (m_StepDone || m_CurrentStateNo == -1) return;
876  switch (CurrentPState)
877  {
878  case tops_InitialState: // Initial state
880  m_HaveTerritory=false;
881  break;
882  case tops_Hunting:
884  m_StepDone=true;
885  break;
886  case tops_Dispersal:
887  st_Dispersal();
889  m_StepDone=true;
890  break;
891  case tops_Movement:
892  st_Movement();
893  if (st_Hunting()<PreyResponse2) // alter this figure to increase functional response
894  m_FailureCount++;
895  else m_FailureCount=0;
897  {
898  m_HaveTerritory=false;
900  }
902  m_StepDone=true;
903  break;
904  default:
905  m_OurLandscape->Warn("Weasel::Step()","unknown state - default");
906  exit(1);
907  }
908 }
909 //---------------------------------------------------------------------------
910 
911 
912 //---------------------------------------------------------------------------
913 // OWL CODE
914 //---------------------------------------------------------------------------
915 
916 
917 Owl::Owl(Vole_Population_Manager* ThePrey, int p_x, int p_y,
919  : TPredator(ThePrey,p_x,p_y,p_L,p_PPM)
920 {
921  SpeciesID=1;
922  m_KillEfficiency=250; // 25%
923  m_HomeRange=800;
924  m_SearchArea=50;
925  m_DispersalMax=1000;
927  PreyResponse1=1;
928  PreyResponse2=1;
929  SpeciesID=1;
930 }
931 //---------------------------------------------------------------------------
932 
934 {
935  int day= m_OurLandscape->SupplyDayInYear();
936  if (day==owl_breed_day)
937  {
939  for (int k=0; k<noToMake; k++)
940  {
941  // make a new owl
942  struct_Predator* sp;
943  sp = new struct_Predator;
945  sp->L = m_OurLandscape;
946  sp->x = m_Location_x;
947  sp->y = m_Location_y;
948  m_OurPopulationManager->CreateObjects(OWL,NULL,sp,1); // 1 = owl
949  delete sp;
950  }
951  }
952  else if (day==364)
953  {
955  {
957  {
959  KillThis();
960  }
961  }
962  m_kills_this_season=0; // reset the count
963  }
964 }
965 //---------------------------------------------------------------------------
966 
967 void Owl::Step()
968 {
969  if (m_StepDone || m_CurrentStateNo == -1) return;
970  switch (CurrentPState)
971  {
972  case tops_InitialState: // Initial state
974  m_HaveTerritory=false;
975  break;
976  case tops_Hunting:
978  m_StepDone=true;
979  break;
980  case tops_Dispersal:
981  st_Dispersal();
983  m_StepDone=true;
984  break;
985  case tops_Movement:
986  st_Movement();
987  if (st_Hunting()<PreyResponse2) // alter this figure to increase functional response
988  m_FailureCount++;
989  else m_FailureCount=0;
991  {
992  m_HaveTerritory=false;
994  }
996  m_StepDone=true;
997  break;
998  default:
999  m_OurLandscape->Warn("Owl::Step()","unknown state - default");
1000  exit(1);
1001  }
1002 }
1003 //---------------------------------------------------------------------------
1004 
1006 {
1007  //Nothing to do
1008 }
1009 //---------------------------------------------------------------------------
1010 
1011 
cfg_weasel_breed_threshold
static CfgInt cfg_weasel_breed_threshold("WEASEL_BT", CFG_CUSTOM, 5)
TPredator
The base class for predators encompsassing all their general behaviours.
Definition: Predators.h:87
owl_breed_threshold
int owl_breed_threshold
Definition: Predators.cpp:73
cfg_owl_StartingNo
static CfgInt cfg_owl_StartingNo("OWL_START_NO", CFG_CUSTOM, 0)
TAnimal::KillThis
virtual void KillThis()
Definition: PopulationManager.h:219
tops_Dispersal
Definition: Predators.h:57
weasel_StartingNo
int weasel_StartingNo
Definition: Predators.cpp:79
Population_Manager::RipleysOutputPrb
FILE * RipleysOutputPrb
Definition: PopulationManager.h:582
OWL
#define OWL
Definition: Predators.cpp:49
Weasel::~Weasel
virtual ~Weasel()
Definition: Predators.cpp:833
Landscape::SupplyVegType
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Definition: Landscape.h:1321
Landscape::SupplyElementType
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
Definition: Landscape.h:1110
cfg_weasel_kill_efficiency
static CfgInt cfg_weasel_kill_efficiency("WEASEL_KILL_EFF", CFG_CUSTOM, 250)
cfg_owl_breed_threshold
static CfgInt cfg_owl_breed_threshold("OWL_BT", CFG_CUSTOM, 5000000)
cfg_owl_breed_day
static CfgInt cfg_owl_breed_day("OWL_BD", CFG_CUSTOM, 120)
Population_Manager::TheArray
vector< TListOfAnimals > TheArray
Definition: PopulationManager.h:534
Population_Manager::m_population_type
TTypesOfPopulation m_population_type
Definition: PopulationManager.h:580
TPredator::OverlapMyTerritory
bool OverlapMyTerritory(unsigned x, unsigned y)
Definition: Predators.cpp:770
TPredator_Population_Manager::DoFirst
virtual void DoFirst()
Definition: Predators.h:167
TPredator_Population_Manager
The class to handle all predator population related matters.
Definition: Predators.h:145
Population_Manager::ReallyBigOutputPrb
FILE * ReallyBigOutputPrb
Definition: PopulationManager.h:595
cfg_weasel_breed_day
static CfgInt cfg_weasel_breed_day("WEASEL_BD", CFG_CUSTOM, 115)
struct_Predator::y
int y
Definition: Predators.h:69
TAnimal::m_OurLandscape
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
TPredator::SupplyKill
int SupplyKill()
Definition: Predators.h:135
TPredator_Population_Manager::PredSpringSample
void PredSpringSample()
Definition: Predators.cpp:423
TPredator_Population_Manager::supply_no_inds
unsigned supply_no_inds(unsigned list)
Definition: Predators.h:157
TPredator_Population_Manager::DoAfter
virtual void DoAfter()
Definition: Predators.h:169
TPredator::st_Movement
virtual void st_Movement()
Definition: Predators.cpp:753
struct_Predator::PM
TPredator_Population_Manager * PM
Definition: Predators.h:72
TPredator_Population_Manager::Run
virtual void Run(int)
Definition: Predators.cpp:553
owl_death_threshold
int owl_death_threshold
Definition: Predators.cpp:75
owl_breed_day
int owl_breed_day
Definition: Predators.cpp:77
TPredator::PreyResponse2
int PreyResponse2
Definition: Predators.h:109
TPredator_Population_Manager::inc_inds
void inc_inds(unsigned list)
Definition: Predators.h:155
Landscape::SupplyMonth
int SupplyMonth(void)
Definition: Landscape.h:1601
TPredator_Population_Manager::PredAutumnSample
void PredAutumnSample()
Definition: Predators.cpp:360
cfg_PredMortalityDataUsed
static CfgBool cfg_PredMortalityDataUsed("PRED_MORTALITY_DATA_USED", CFG_CUSTOM, false)
TAnimal::Supply_m_Location_x
int Supply_m_Location_x()
Definition: PopulationManager.h:213
Owl::Owl
Owl(Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
Definition: Predators.cpp:917
TPredator_Population_Manager::m_no_individuals
unsigned m_no_individuals[2]
Definition: Predators.h:163
struct_Predator::L
Landscape * L
Definition: Predators.h:71
struct_Predator
Used for creation of a new predator object.
Definition: Predators.h:65
Owl::BeginStep
virtual void BeginStep(void)
BeingStep behaviour - must be implemented in descendent classes.
Definition: Predators.cpp:933
Owl::Step
virtual void Step(void)
Step behaviour - must be implemented in descendent classes.
Definition: Predators.cpp:967
TPredator::SupplySpeciesID
unsigned SupplySpeciesID()
Definition: Predators.h:134
Population_Manager::SimW
int SimW
Definition: PopulationManager.h:511
cfg_weasel_death_threshold
static CfgInt cfg_weasel_death_threshold("WEASEL_DT", CFG_CUSTOM, 10)
weasel_breed_day
int weasel_breed_day
Definition: Predators.cpp:76
Owl
The Owl class is one of two current implementations of TPredator.
Definition: Predators.h:208
TPredator_Population_Manager::dec_inds
void dec_inds(unsigned list)
Definition: Predators.h:156
Weasel
The Weasel class is one of two current implementations of TPredator.
Definition: Predators.h:187
TOP_Predators
Definition: PopulationManager.h:76
TPredator::m_Search_x
int m_Search_x
Definition: Predators.h:110
TPredator_Population_Manager::PredSpringAutumnSample
void PredSpringAutumnSample()
Definition: Predators.cpp:486
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:112
tops_Movement
Definition: Predators.h:58
TPredator::SupplyKillEff
int SupplyKillEff()
Definition: Predators.h:137
Weasel::Step
virtual void Step(void)
Step behaviour - must be implemented in descendent classes.
Definition: Predators.cpp:873
TPredator::m_SearchArea
unsigned m_SearchArea
Definition: Predators.h:106
TPredator_Population_Manager::DoLast
virtual void DoLast()
Definition: Predators.h:170
Landscape::SupplyDayInMonth
int SupplyDayInMonth(void)
Definition: Landscape.h:1606
TPredator::st_Hunting
virtual int st_Hunting()
Definition: Predators.cpp:726
Landscape::SupplySimAreaHeight
int SupplySimAreaHeight(void)
Definition: Landscape.h:1637
Vole_Population_Manager::SupplyVoleList
vector< Vole_Base * > * SupplyVoleList(unsigned x, unsigned y, unsigned range)
Definition: VolePopulationManager.cpp:3289
Landscape::SupplySimAreaWidth
int SupplySimAreaWidth(void)
Definition: Landscape.h:1632
cfg_weasel_NoFailuresBeforeDispersal
static CfgInt cfg_weasel_NoFailuresBeforeDispersal("WEASEL_FAILURES", CFG_CUSTOM, 10)
TAnimal::m_Location_y
int m_Location_y
Definition: PopulationManager.h:228
TPredator::SimH
int SimH
Definition: Predators.h:113
TPredator::m_KillEfficiency
int m_KillEfficiency
Definition: Predators.h:118
cfg_weasel_DispersalMax
static CfgInt cfg_weasel_DispersalMax("WEASEL_DISPERSAL_MAX", CFG_CUSTOM, 200)
TAnimal
The base class for all ALMaSS animal classes.
Definition: PopulationManager.h:205
cfg_weasel_search_area
static CfgInt cfg_weasel_search_area("WEASEL_SEARCH_AREA", CFG_CUSTOM, 100)
TPredator::st_Dispersal
virtual void st_Dispersal()
Definition: Predators.cpp:787
TPredator::PreyResponse1
int PreyResponse1
Definition: Predators.h:108
Population_Manager
Base class for all population managers.
Definition: PopulationManager.h:424
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Definition: Landscape.h:1596
weasel_death_threshold
int weasel_death_threshold
Definition: Predators.cpp:74
TPredator::SupplyTerr
bool SupplyTerr()
Definition: Predators.h:136
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
Landscape::SupplyYearNumber
int SupplyYearNumber(void)
Definition: Landscape.h:1616
TPredator::m_FailureCount
unsigned m_FailureCount
Definition: Predators.h:114
Owl::~Owl
virtual ~Owl()
Definition: Predators.cpp:1005
TPredator::m_Search_y
int m_Search_y
Definition: Predators.h:111
TPredator::m_Prey
Vole_Population_Manager * m_Prey
Definition: Predators.h:119
Vole_Population_Manager
The class to handle all vole population related matters.
Definition: VolePopulationManager.h:151
cfg_owl_death_threshold
static CfgInt cfg_owl_death_threshold("OWL_DT", CFG_CUSTOM,-1)
TPredator_Population_Manager::CreateObjects
void CreateObjects(int ob_type, TAnimal *pvo, struct_Predator *data, int number)
Definition: Predators.cpp:137
TPredator::CurrentPState
TTypeOfPredatorState CurrentPState
Definition: Predators.h:103
Population_Manager::m_TheLandscape
Landscape * m_TheLandscape
Definition: PopulationManager.h:515
TPredator::m_HaveTerritory
bool m_HaveTerritory
Definition: Predators.h:117
TPredator_Population_Manager::~TPredator_Population_Manager
virtual ~TPredator_Population_Manager(void)
Definition: Predators.cpp:83
TPredator::m_OurPopulationManager
TPredator_Population_Manager * m_OurPopulationManager
Definition: Predators.h:120
TPredator::SpeciesID
unsigned SpeciesID
Definition: Predators.h:104
Population_Manager::SimH
int SimH
Definition: PopulationManager.h:511
TPredator::m_DispersalMax
unsigned m_DispersalMax
Definition: Predators.h:105
cfg_weasel_home_range
static CfgInt cfg_weasel_home_range("WEASEL_HOME_RANGE", CFG_CUSTOM, 250)
tops_InitialState
Definition: Predators.h:55
TPredator_Population_Manager::InOtherTerritory
bool InOtherTerritory(unsigned sp, int p_x, int p_y, TPredator *p_Pred)
Definition: Predators.cpp:671
TAnimal::Supply_m_Location_y
int Supply_m_Location_y()
Definition: PopulationManager.h:216
TPredator::TPredator
TPredator(Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
Definition: Predators.cpp:696
tops_Hunting
Definition: Predators.h:56
TPredator::m_HomeRange
unsigned m_HomeRange
Definition: Predators.h:116
cfg_pred_second_sample_day
static CfgInt cfg_pred_second_sample_day("PRED_SAMPLE_FILE_DAY_TWO", CFG_CUSTOM, 287)
TPredator::SupplyHomeRange
int SupplyHomeRange()
Definition: Predators.h:138
TPredator_Population_Manager::StepFinished
virtual bool StepFinished()
Overrides the population manager StepFinished - there is no chance that hunters do not finish a step ...
Definition: Predators.cpp:655
TPredator::~TPredator
~TPredator()
Definition: Predators.cpp:719
Weasel::BeginStep
virtual void BeginStep(void)
BeingStep behaviour - must be implemented in descendent classes.
Definition: Predators.cpp:839
TPredator_Population_Manager::DoBefore
virtual void DoBefore()
Definition: Predators.h:168
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
TPredator_Population_Manager::PredSampleFile
void PredSampleFile()
Definition: Predators.cpp:161
weasel_breed_threshold
int weasel_breed_threshold
Definition: Predators.cpp:72
WEASEL
#define WEASEL
Definition: Predators.cpp:48
Weasel::Weasel
Weasel(Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
Definition: Predators.cpp:816
TPredator_Population_Manager::TPredator_Population_Manager
TPredator_Population_Manager(Landscape *L, Vole_Population_Manager *VPM)
Definition: Predators.cpp:89
cfg_PredSampleDataUsed
static CfgBool cfg_PredSampleDataUsed("PRED_SAMPLE_DATA_USED", CFG_CUSTOM, false)
TPredator::m_NoFailuresBeforeDispersal
unsigned m_NoFailuresBeforeDispersal
Definition: Predators.h:115
struct_Predator::x
int x
Definition: Predators.h:68
TPredator_Population_Manager::m_Prey
Vole_Population_Manager * m_Prey
Definition: Predators.h:161
cfg_weasel_StartingNo
static CfgInt cfg_weasel_StartingNo("WEASEL_START_NO", CFG_CUSTOM, 0)
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: Landscape.h:1579
TAnimal::m_Location_x
int m_Location_x
Definition: PopulationManager.h:225
TPredator::SimW
int SimW
Definition: Predators.h:112
Landscape::SupplyPolyRef
int SupplyPolyRef(int a_x, int a_y)
Definition: Landscape.h:1488
TPredator::CurrentPrey
vector< Vole_Base * > * CurrentPrey
Definition: Predators.h:121
TPredator::m_kills_this_season
int m_kills_this_season
Definition: Predators.h:107
cfg_pred_first_sample_day
static CfgInt cfg_pred_first_sample_day("PRED_SAMPLE_FILE_DAY_ONE", CFG_CUSTOM, 109)
owl_StartingNo
int owl_StartingNo
Definition: Predators.cpp:78