stochastic simulation, predator/prey

Dependencies:   mbed

Committer:
manitou
Date:
Mon Dec 23 18:56:56 2019 +0000
Revision:
0:fc1335b7b54f
stochastic simulation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
manitou 0:fc1335b7b54f 1 //
manitou 0:fc1335b7b54f 2 // Ant.h
manitou 0:fc1335b7b54f 3 // INHERITANCE_AND_POLYMORPHISM
manitou 0:fc1335b7b54f 4 //
manitou 0:fc1335b7b54f 5 // Created by Kristjan Thorsteinsson on 01/04/14.
manitou 0:fc1335b7b54f 6 // Copyright (c) 2014 Kristjan Thorsteinsson. All rights reserved.
manitou 0:fc1335b7b54f 7 //
manitou 0:fc1335b7b54f 8
manitou 0:fc1335b7b54f 9 #ifndef INHERITANCE_AND_POLYMORPHISM_Ant
manitou 0:fc1335b7b54f 10 #define INHERITANCE_AND_POLYMORPHISM_Ant
manitou 0:fc1335b7b54f 11
manitou 0:fc1335b7b54f 12 //#include <iostream>
manitou 0:fc1335b7b54f 13 #include "Organism.h"
manitou 0:fc1335b7b54f 14 #include "World.h"
manitou 0:fc1335b7b54f 15 #include "Counter.h"
manitou 0:fc1335b7b54f 16
manitou 0:fc1335b7b54f 17 class Ant : public Organism, public counter<Ant>
manitou 0:fc1335b7b54f 18 {
manitou 0:fc1335b7b54f 19 public:
manitou 0:fc1335b7b54f 20
manitou 0:fc1335b7b54f 21 Ant(World* aWorld, int xcoord, int ycoord);
manitou 0:fc1335b7b54f 22 // In the given world moves this organism.
manitou 0:fc1335b7b54f 23 void move();
manitou 0:fc1335b7b54f 24
manitou 0:fc1335b7b54f 25 // Makes this organism breed.
manitou 0:fc1335b7b54f 26 void breed();
manitou 0:fc1335b7b54f 27
manitou 0:fc1335b7b54f 28 // Returns the type of this organism.
manitou 0:fc1335b7b54f 29 OrganismType getType() const;
manitou 0:fc1335b7b54f 30
manitou 0:fc1335b7b54f 31 // The character representation of this organism.
manitou 0:fc1335b7b54f 32 char representation() const;
manitou 0:fc1335b7b54f 33
manitou 0:fc1335b7b54f 34 // The size of this organism.
manitou 0:fc1335b7b54f 35 int size() const;
manitou 0:fc1335b7b54f 36
manitou 0:fc1335b7b54f 37 bool in_range(int xx, int yy);
manitou 0:fc1335b7b54f 38
manitou 0:fc1335b7b54f 39 private:
manitou 0:fc1335b7b54f 40
manitou 0:fc1335b7b54f 41 void generateOffspring(int whereX, int whereY);
manitou 0:fc1335b7b54f 42 };
manitou 0:fc1335b7b54f 43
manitou 0:fc1335b7b54f 44 #endif /* defined(__INHERITANCE_AND_POLYMORPHISM__Ant__) */