CSharp Skeleton Code
I'm having trouble uploading the actual .cs file, so you can copy it from here and paste it into your project .cs file.
1 // Skeleton Program code for the AQA A Level Paper 1 2017 examination
2 // this code whould be used in conjunction with the Preliminary Material
3 // written by the AQA Programmer Team
4 // developed in the Visual Studio 2008 programming environment
5
6
7 using System;
8
9 namespace PredatorPrey
10 {
11 class Program
12 {
13 static void Main(string[] args)
14 {
15 Simulation Sim;
16 int MenuOption;
17 int LandscapeSize;
18 int InitialWarrenCount;
19 int InitialFoxCount;
20 int Variability;
21 bool FixedInitialLocations;
22 do
23 {
24 Console.WriteLine("Predator Prey Simulation Main Menu");
25 Console.WriteLine();
26 Console.WriteLine("1. Run simulation with default settings");
27 Console.WriteLine("2. Run simulation with custom settings");
28 Console.WriteLine("3. Exit");
29 Console.WriteLine();
30 Console.Write("Select option: ");
31 MenuOption = Convert.ToInt32(Console.ReadLine());
32 if ((MenuOption == 1) || (MenuOption == 2))
33 {
34 if (MenuOption == 1)
35 {
36 LandscapeSize = 15;
37 InitialWarrenCount = 5;
38 InitialFoxCount = 5;
39 Variability = 0;
40 FixedInitialLocations = true;
41 }
42 else
43 {
44 Console.Write("Landscape Size: ");
45 LandscapeSize = Convert.ToInt32(Console.ReadLine());
46 Console.Write("Initial number of warrens: ");
47 InitialWarrenCount = Convert.ToInt32(Console.ReadLine());
48 Console.Write("Initial number of foxes: ");
49 InitialFoxCount = Convert.ToInt32(Console.ReadLine());
50 Console.Write("Randomness variability (percent): ");
51 Variability = Convert.ToInt32(Console.ReadLine());
52 FixedInitialLocations = false;
53 }
54 Sim = new Simulation(LandscapeSize, InitialWarrenCount, InitialFoxCount, Variability, FixedInitialLocations);
55 }
56 } while (MenuOption != 3);
57 Console.ReadKey();
58 }
59 }
60
61 class Location
62 {
63 public Fox Fox;
64 public Warren Warren;
65
66 public Location()
67 {
68 Fox = null;
69 Warren = null;
70 }
71 }
72
73 class Simulation
74 {
75 private Location[,] Landscape;
76 private int TimePeriod = 0;
77 private int WarrenCount = 0;
78 private int FoxCount = 0;
79 private bool ShowDetail = false;
80 private int LandscapeSize;
81 private int Variability;
82 private static Random Rnd = new Random();
83
84 public Simulation(int LandscapeSize, int InitialWarrenCount, int InitialFoxCount, int Variability, bool FixedInitialLocations)
85 {
86 int menuOption;
87 int x;
88 int y;
89 string viewRabbits;
90 this.LandscapeSize = LandscapeSize;
91 this.Variability = Variability;
92 Landscape = new Location[LandscapeSize, LandscapeSize];
93 CreateLandscapeAndAnimals(InitialWarrenCount, InitialFoxCount, FixedInitialLocations);
94 DrawLandscape();
95 do
96 {
97 Console.WriteLine();
98 Console.WriteLine("1. Advance to next time period showing detail");
99 Console.WriteLine("2. Advance to next time period hiding detail");
100 Console.WriteLine("3. Inspect fox");
101 Console.WriteLine("4. Inspect warren");
102 Console.WriteLine("5. Exit");
103 Console.WriteLine();
104 Console.Write("Select option: ");
105 menuOption = Convert.ToInt32(Console.ReadLine());
106 if (menuOption == 1)
107 {
108 TimePeriod++;
109 ShowDetail = true;
110 AdvanceTimePeriod();
111 }
112 if (menuOption == 2)
113 {
114 TimePeriod++;
115 ShowDetail = false;
116 AdvanceTimePeriod();
117 }
118 if (menuOption == 3)
119 {
120 x = InputCoordinate('x');
121 y = InputCoordinate('y');
122 if (Landscape[x, y].Fox != null)
123 {
124 Landscape[x, y].Fox.Inspect();
125 }
126 }
127 if (menuOption == 4)
128 {
129 x = InputCoordinate('x');
130 y = InputCoordinate('y');
131 if (Landscape[x, y].Warren != null)
132 {
133 Landscape[x, y].Warren.Inspect();
134 Console.Write("View individual rabbits (y/n)?");
135 viewRabbits = Console.ReadLine();
136 if (viewRabbits == "y") {
137 Landscape[x, y].Warren.ListRabbits();
138 }
139 }
140 }
141 } while (((WarrenCount > 0) || (FoxCount > 0)) && (menuOption != 5));
142 Console.ReadKey();
143 }
144
145 private int InputCoordinate(char Coordinatename)
146 {
147 int Coordinate;
148 Console.Write(" Input " + Coordinatename + " coordinate: ");
149 Coordinate = Convert.ToInt32(Console.ReadLine());
150 return Coordinate;
151 }
152
153 private void AdvanceTimePeriod()
154 {
155 int NewFoxCount = 0;
156 if (ShowDetail)
157 {
158 Console.WriteLine();
159 }
160 for (int x = 0; x < LandscapeSize; x++)
161 {
162 for (int y = 0; y < LandscapeSize; y++)
163 {
164 if (Landscape[x, y].Warren != null)
165 {
166 if (ShowDetail)
167 {
168 Console.WriteLine("Warren at (" + x + "," + y + "):");
169 Console.Write(" Period Start: ");
170 Landscape[x, y].Warren.Inspect();
171 }
172 if (FoxCount > 0)
173 {
174 FoxesEatRabbitsInWarren(x, y);
175 }
176 if (Landscape[x, y].Warren.NeedToCreateNewWarren())
177 {
178 CreateNewWarren();
179 }
180 Landscape[x, y].Warren.AdvanceGeneration(ShowDetail);
181 if (ShowDetail)
182 {
183 Console.Write(" Period End: ");
184 Landscape[x, y].Warren.Inspect();
185 Console.ReadKey();
186 }
187 if (Landscape[x, y].Warren.WarrenHasDiedOut())
188 {
189 Landscape[x, y].Warren = null;
190 WarrenCount--;
191 }
192 }
193 }
194 }
195 for (int x = 0; x < LandscapeSize; x++)
196 {
197 for (int y = 0; y < LandscapeSize; y++)
198 {
199 if (Landscape[x, y].Fox != null)
200 {
201 if (ShowDetail)
202 {
203 Console.WriteLine("Fox at (" + x + "," + y + "): ");
204 }
205 Landscape[x, y].Fox.AdvanceGeneration(ShowDetail);
206 if (Landscape[x, y].Fox.CheckIfDead())
207 {
208 Landscape[x, y].Fox = null;
209 FoxCount--;
210 }
211 else
212 {
213 if (Landscape[x, y].Fox.ReproduceThisPeriod())
214 {
215 if (ShowDetail) {
216 Console.WriteLine(" Fox has reproduced. ");
217 }
218 NewFoxCount++;
219 }
220 if (ShowDetail) {
221 Landscape[x, y].Fox.Inspect();
222 }
223 Landscape[x, y].Fox.ResetFoodConsumed();
224 }
225 }
226 }
227 }
228 if (NewFoxCount > 0)
229 {
230 if (ShowDetail)
231 {
232 Console.WriteLine("New foxes born: ");
233 }
234 for (int f = 0; f < NewFoxCount; f++) {
235 CreateNewFox();
236 }
237 }
238 if (ShowDetail) {
239 Console.ReadKey();
240 }
241 DrawLandscape();
242 Console.WriteLine();
243 }
244
245 private void CreateLandscapeAndAnimals(int InitialWarrenCount, int InitialFoxCount, bool FixedInitialLocations)
246 {
247 for (int x = 0; x < LandscapeSize; x++)
248 {
249 for (int y = 0; y < LandscapeSize; y++)
250 {
251 Landscape[x, y] = new Location();
252 }
253 }
254 if (FixedInitialLocations)
255 {
256 Landscape[1, 1].Warren = new Warren(Variability, 38);
257 Landscape[2, 8].Warren = new Warren(Variability, 80);
258 Landscape[9, 7].Warren = new Warren(Variability, 20);
259 Landscape[10, 3].Warren = new Warren(Variability, 52);
260 Landscape[13, 4].Warren = new Warren(Variability, 67);
261 WarrenCount = 5;
262 Landscape[2, 10].Fox = new Fox(Variability);
263 Landscape[6, 1].Fox = new Fox(Variability);
264 Landscape[8, 6].Fox = new Fox(Variability);
265 Landscape[11, 13].Fox = new Fox(Variability);
266 Landscape[12, 4].Fox = new Fox(Variability);
267 FoxCount = 5;
268 }
269 else
270 {
271 for (int w = 0; w < InitialWarrenCount; w++)
272 {
273 CreateNewWarren();
274 }
275 for (int f = 0; f < InitialFoxCount; f++)
276 {
277 CreateNewFox();
278 }
279 }
280 }
281
282 private void CreateNewWarren()
283 {
284 int x, y;
285 do
286 {
287 x = Rnd.Next(0, LandscapeSize);
288 y = Rnd.Next(0, LandscapeSize);
289 } while (Landscape[x, y].Warren != null);
290 if (ShowDetail)
291 {
292 Console.WriteLine("New Warren at (" + x + "," + y + ")");
293 }
294 Landscape[x, y].Warren = new Warren(Variability);
295 WarrenCount++;
296 }
297
298 private void CreateNewFox()
299 {
300 int x, y;
301 do
302 {
303 x = Rnd.Next(0, LandscapeSize);
304 y = Rnd.Next(0, LandscapeSize);
305 } while (Landscape[x, y].Fox != null);
306 if (ShowDetail) {
307 Console.WriteLine(" New Fox at (" + x + "," + y + ")");
308 }
309 Landscape[x, y].Fox = new Fox(Variability);
310 FoxCount++;
311 }
312
313 private void FoxesEatRabbitsInWarren(int WarrenX, int WarrenY)
314 {
315 int FoodConsumed;
316 int PercentToEat;
317 double Dist;
318 int RabbitsToEat;
319 int RabbitCountAtStartOfPeriod = Landscape[WarrenX, WarrenY].Warren.GetRabbitCount();
320 for (int FoxX = 0; FoxX < LandscapeSize; FoxX++)
321 {
322 for (int FoxY = 0; FoxY < LandscapeSize; FoxY++)
323 {
324 if (Landscape[FoxX, FoxY].Fox != null)
325 {
326 Dist = DistanceBetween(FoxX, FoxY, WarrenX, WarrenY);
327 if (Dist <= 3.5)
328 {
329 PercentToEat = 20;
330 }
331 else if (Dist <= 7)
332 {
333 PercentToEat = 10;
334 }
335 else
336 {
337 PercentToEat = 0;
338 }
339 RabbitsToEat = (int)Math.Round((double)(PercentToEat * RabbitCountAtStartOfPeriod / 100.0));
340 FoodConsumed = Landscape[WarrenX, WarrenY].Warren.EatRabbits(RabbitsToEat);
341 Landscape[FoxX, FoxY].Fox.GiveFood(FoodConsumed);
342 if (ShowDetail)
343 {
344 Console.WriteLine(" " + FoodConsumed + " rabbits eaten by fox at (" + FoxX + "," + FoxY + ").");
345 }
346 }
347 }
348 }
349 }
350
351 private double DistanceBetween(int x1, int y1, int x2, int y2)
352 {
353 return Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2));
354 }
355
356 private void DrawLandscape()
357 {
358 Console.WriteLine();
359 Console.WriteLine("TIME PERIOD: " + TimePeriod);
360 Console.WriteLine();
361 Console.Write(" ");
362 for (int x = 0; x < LandscapeSize; x++)
363 {
364 if (x < 10)
365 {
366 Console.Write(" ");
367 }
368 Console.Write(x + " |");
369 }
370 Console.WriteLine();
371 for (int x = 0; x <= LandscapeSize * 4 + 3; x++)
372 {
373 Console.Write("-");
374 }
375 Console.WriteLine();
376 for (int y = 0; y < LandscapeSize; y++)
377 {
378 if (y < 10) {
379 Console.Write(" ");
380 }
381 Console.Write(" " + y + "|");
382 for (int x = 0; x < LandscapeSize; x++)
383 {
384 if (Landscape[x, y].Warren != null)
385 {
386 if (Landscape[x, y].Warren.GetRabbitCount() < 10)
387 {
388 Console.Write(" ");
389 }
390 Console.Write(Landscape[x, y].Warren.GetRabbitCount());
391 }
392 else
393 {
394 Console.Write(" ");
395 }
396 if (Landscape[x, y].Fox != null)
397 {
398 Console.Write("F");
399 }
400 else
401 {
402 Console.Write(" ");
403 }
404 Console.Write("|");
405 }
406 Console.WriteLine();
407 }
408 }
409 }
410
411 class Warren
412 {
413 private const int MaxRabbitsInWarren = 99;
414 private Rabbit[] Rabbits;
415 private int RabbitCount = 0;
416 private int PeriodsRun = 0;
417 private bool AlreadySpread = false;
418 private int Variability;
419 private static Random Rnd = new Random();
420
421 public Warren(int Variability)
422 {
423 this.Variability = Variability;
424 Rabbits = new Rabbit[MaxRabbitsInWarren];
425 RabbitCount = (int)(CalculateRandomValue((int)(MaxRabbitsInWarren / 4), this.Variability));
426 for (int r = 0; r < RabbitCount; r++)
427 {
428 Rabbits[r] = new Rabbit(Variability);
429 }
430 }
431
432 public Warren(int Variability, int rabbitCount)
433 {
434 this.Variability = Variability;
435 this.RabbitCount = rabbitCount;
436 Rabbits = new Rabbit[MaxRabbitsInWarren];
437 for (int r = 0; r < RabbitCount; r++)
438 {
439 Rabbits[r] = new Rabbit(Variability);
440 }
441 }
442
443 private double CalculateRandomValue(int BaseValue, int Variability)
444 {
445 return BaseValue - (BaseValue * Variability / 100) + (BaseValue * Rnd.Next(0, (Variability * 2) + 1) / 100);
446 }
447
448 public int GetRabbitCount()
449 {
450 return RabbitCount;
451 }
452
453 public bool NeedToCreateNewWarren()
454 {
455 if ((RabbitCount == MaxRabbitsInWarren) && (!AlreadySpread))
456 {
457 AlreadySpread = true;
458 return true;
459 }
460 else
461 {
462 return false;
463 }
464 }
465
466 public bool WarrenHasDiedOut()
467 {
468 if (RabbitCount == 0)
469 {
470 return true;
471 }
472 else
473 {
474 return false;
475 }
476 }
477
478 public void AdvanceGeneration(bool ShowDetail)
479 {
480 PeriodsRun++;
481 if (RabbitCount > 0)
482 {
483 KillByOtherFactors(ShowDetail);
484 }
485 if (RabbitCount > 0)
486 {
487 AgeRabbits(ShowDetail);
488 }
489 if ((RabbitCount > 0) && (RabbitCount <= MaxRabbitsInWarren))
490 {
491 if (ContainsMales())
492 {
493 MateRabbits(ShowDetail);
494 }
495 }
496 if ((RabbitCount == 0) && (ShowDetail))
497 {
498 Console.WriteLine(" All rabbits in warren are dead");
499 }
500 }
501
502 public int EatRabbits(int RabbitsToEat)
503 {
504 int DeathCount = 0;
505 int RabbitNumber;
506 if (RabbitsToEat > RabbitCount)
507 {
508 RabbitsToEat = RabbitCount;
509 }
510 while (DeathCount < RabbitsToEat)
511 {
512 RabbitNumber = Rnd.Next(0, RabbitCount);
513 if (Rabbits[RabbitNumber] != null)
514 {
515 Rabbits[RabbitNumber] = null;
516 DeathCount++;
517 }
518 }
519 CompressRabbitList(DeathCount);
520 return RabbitsToEat;
521 }
522
523 private void KillByOtherFactors(bool ShowDetail)
524 {
525 int DeathCount = 0;
526 for (int r = 0; r < RabbitCount; r++)
527 {
528 if (Rabbits[r].CheckIfKilledByOtherFactor())
529 {
530 Rabbits[r] = null;
531 DeathCount++;
532 }
533 }
534 CompressRabbitList(DeathCount);
535 if (ShowDetail)
536 {
537 Console.WriteLine(" " + DeathCount + " rabbits killed by other factors.");
538 }
539 }
540
541 private void AgeRabbits(bool ShowDetail)
542 {
543 int DeathCount = 0;
544 for (int r = 0; r < RabbitCount; r++)
545 {
546 Rabbits[r].CalculateNewAge();
547 if (Rabbits[r].CheckIfDead())
548 {
549 Rabbits[r] = null;
550 DeathCount++;
551 }
552 }
553 CompressRabbitList(DeathCount);
554 if (ShowDetail)
555 {
556 Console.WriteLine(" " + DeathCount + " rabbits die of old age.");
557 }
558 }
559
560 private void MateRabbits(bool ShowDetail)
561 {
562 int Mate = 0;
563 int Babies = 0;
564 double CombinedReproductionRate;
565 for (int r = 0; r < RabbitCount; r++)
566 {
567 if ((Rabbits[r].IsFemale()) && (RabbitCount + Babies < MaxRabbitsInWarren))
568 {
569 do
570 {
571 Mate = Rnd.Next(0, RabbitCount);
572 } while ((Mate == r) || (Rabbits[Mate].IsFemale()));
573 CombinedReproductionRate = (Rabbits[r].GetReproductionRate() + Rabbits[Mate].GetReproductionRate()) / 2;
574 if (CombinedReproductionRate >= 1)
575 {
576 Rabbits[RabbitCount + Babies] = new Rabbit(Variability, CombinedReproductionRate);
577 Babies++;
578 }
579 }
580 }
581 RabbitCount = RabbitCount + Babies;
582 if (ShowDetail)
583 {
584 Console.WriteLine(" " + Babies + " baby rabbits born.");
585 }
586 }
587
588 private void CompressRabbitList(int DeathCount)
589 {
590 if (DeathCount > 0)
591 {
592 int ShiftTo = 0;
593 int ShiftFrom = 0;
594 while (ShiftTo < RabbitCount - DeathCount)
595 {
596 while (Rabbits[ShiftFrom] == null)
597 {
598 ShiftFrom++;
599 }
600 if (ShiftTo != ShiftFrom)
601 {
602 Rabbits[ShiftTo] = Rabbits[ShiftFrom];
603 }
604 ShiftTo++;
605 ShiftFrom++;
606 }
607 RabbitCount = RabbitCount - DeathCount;
608 }
609 }
610
611 private bool ContainsMales()
612 {
613 bool Males = false;
614 for (int r = 0; r < RabbitCount; r++)
615 {
616 if (!Rabbits[r].IsFemale())
617 {
618 Males = true;
619 }
620 }
621 return Males;
622 }
623
624 public void Inspect()
625 {
626 Console.WriteLine("Periods Run " + PeriodsRun + " Size " + RabbitCount);
627 }
628
629 public void ListRabbits()
630 {
631 if (RabbitCount > 0)
632 {
633 for (int r = 0; r < RabbitCount; r++)
634 {
635 Rabbits[r].Inspect();
636 }
637 }
638 }
639 }
640
641 class Animal
642 {
643 protected double NaturalLifespan;
644 protected int ID;
645 protected static int NextID = 1;
646 protected int Age = 0;
647 protected double ProbabilityOfDeathOtherCauses;
648 protected bool IsAlive;
649 protected static Random Rnd = new Random();
650
651 public Animal(int AvgLifespan, double AvgProbabilityOfDeathOtherCauses, int Variability)
652 {
653 NaturalLifespan = AvgLifespan * CalculateRandomValue(100, Variability) / 100;
654 ProbabilityOfDeathOtherCauses = AvgProbabilityOfDeathOtherCauses * CalculateRandomValue(100, Variability) / 100;
655 IsAlive = true;
656 ID = NextID;
657 NextID++;
658 }
659
660 public virtual void CalculateNewAge()
661 {
662 Age++;
663 if (Age >= NaturalLifespan)
664 {
665 IsAlive = false;
666 }
667 }
668
669 public virtual bool CheckIfDead()
670 {
671 return !IsAlive;
672 }
673
674 public virtual void Inspect()
675 {
676 Console.Write(" ID " + ID + " ");
677 Console.Write("Age " + Age + " ");
678 Console.Write("LS " + NaturalLifespan + " ");
679 Console.Write("Pr dth " + Math.Round(ProbabilityOfDeathOtherCauses, 2) + " ");
680 }
681
682 public virtual bool CheckIfKilledByOtherFactor()
683 {
684 if (Rnd.Next(0, 100) < ProbabilityOfDeathOtherCauses * 100)
685 {
686 IsAlive = false;
687 return true;
688 }
689 else
690 {
691 return false;
692 }
693 }
694
695 protected virtual double CalculateRandomValue(int BaseValue, int Variability)
696 {
697 return BaseValue - (BaseValue * Variability / 100) + (BaseValue * Rnd.Next(0, (Variability * 2) + 1) / 100);
698 }
699 }
700
701 class Fox : Animal
702 {
703 private int FoodUnitsNeeded = 10;
704 private int FoodUnitsConsumedThisPeriod = 0;
705 private const int DefaultLifespan = 7;
706 private const double DefaultProbabilityDeathOtherCauses = 0.1;
707
708 public Fox(int Variability)
709 : base(DefaultLifespan, DefaultProbabilityDeathOtherCauses, Variability)
710 {
711 FoodUnitsNeeded = (int)(10 * base.CalculateRandomValue(100, Variability) / 100);
712 }
713
714 public void AdvanceGeneration(bool ShowDetail)
715 {
716 if (FoodUnitsConsumedThisPeriod == 0)
717 {
718 IsAlive = false;
719 if (ShowDetail)
720 {
721 Console.WriteLine(" Fox dies as has eaten no food this period.");
722 }
723 }
724 else
725 {
726 if (CheckIfKilledByOtherFactor())
727 {
728 IsAlive = false;
729 if (ShowDetail)
730 {
731 Console.WriteLine(" Fox killed by other factor.");
732 }
733 }
734 else
735 {
736 if (FoodUnitsConsumedThisPeriod < FoodUnitsNeeded)
737 {
738 CalculateNewAge();
739 if (ShowDetail)
740 {
741 Console.WriteLine(" Fox ages further due to lack of food.");
742 }
743 }
744 CalculateNewAge();
745 if (!IsAlive)
746 {
747 if (ShowDetail)
748 {
749 Console.WriteLine(" Fox has died of old age.");
750 }
751 }
752 }
753 }
754 }
755
756 public void ResetFoodConsumed()
757 {
758 FoodUnitsConsumedThisPeriod = 0;
759 }
760
761 public bool ReproduceThisPeriod()
762 {
763 const double ReproductionProbability = 0.25;
764 if (Rnd.Next(0, 100) < ReproductionProbability * 100)
765 {
766 return true;
767 }
768 else
769 {
770 return false;
771 }
772 }
773
774 public void GiveFood(int FoodUnits)
775 {
776 FoodUnitsConsumedThisPeriod = FoodUnitsConsumedThisPeriod + FoodUnits;
777 }
778
779 public override void Inspect()
780 {
781 base.Inspect();
782 Console.Write("Food needed " + FoodUnitsNeeded + " ");
783 Console.Write("Food eaten " + FoodUnitsConsumedThisPeriod + " ");
784 Console.WriteLine();
785 }
786 }
787
788 class Rabbit : Animal
789 {
790 enum Genders
791 {
792 Male,
793 Female
794 }
795 private double ReproductionRate;
796 private const double DefaultReproductionRate = 1.2;
797 private const int DefaultLifespan = 4;
798 private const double DefaultProbabilityDeathOtherCauses = 0.05;
799 private Genders Gender;
800
801 public Rabbit(int Variability)
802 : base(DefaultLifespan, DefaultProbabilityDeathOtherCauses, Variability)
803 {
804 ReproductionRate = DefaultReproductionRate * CalculateRandomValue(100, Variability) / 100;
805 if (Rnd.Next(0, 100) < 50)
806 {
807 Gender = Genders.Male;
808 }
809 else
810 {
811 Gender = Genders.Female;
812 }
813 }
814
815 public Rabbit(int Variability, double ParentsReproductionRate)
816 : base(DefaultLifespan, DefaultProbabilityDeathOtherCauses, Variability)
817 {
818 ReproductionRate = ParentsReproductionRate * CalculateRandomValue(100, Variability) / 100;
819 if (Rnd.Next(0, 100) < 50)
820 {
821 Gender = Genders.Male;
822 }
823 else
824 {
825 Gender = Genders.Female;
826 }
827 }
828
829 public override void Inspect()
830 {
831 base.Inspect();
832 Console.Write("Rep rate " + Math.Round(ReproductionRate, 1) + " ");
833 Console.WriteLine("Gender " + Gender + " ");
834 }
835
836 public bool IsFemale()
837 {
838 if (Gender == Genders.Female)
839 {
840 return true;
841 }
842 else
843 {
844 return false;
845 }
846 }
847
848 public double GetReproductionRate()
849 {
850 return ReproductionRate;
851 }
852 }
853 }