stochastic simulation, predator/prey

Dependencies:   mbed

Revision:
0:fc1335b7b54f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Bug.h	Mon Dec 23 18:56:56 2019 +0000
@@ -0,0 +1,48 @@
+//
+//  Bug.h
+//  INHERITANCE_AND_POLYMORPHISM
+//
+//  Created by Kristjan Thorsteinsson on 01/04/14.
+//  Copyright (c) 2014 Kristjan Thorsteinsson. All rights reserved.
+//
+
+#ifndef INHERITANCE_AND_POLYMORPHISM_Bug
+#define INHERITANCE_AND_POLYMORPHISM_Bug
+
+//#include <iostream>
+
+#include "World.h"
+#include "Organism.h"
+#include "Counter.h"
+
+class Bug : public Organism, public counter<Bug>
+{
+public:
+    
+    Bug(World* aWorld, int xcoord, int ycoord);
+    // In the given world moves this organism.
+    void move();
+    
+    // Makes this organism breed.
+    void breed();
+    
+    // Returns the type of this organism.
+    OrganismType getType() const;
+    
+    // The character representation of this organism.
+    char representation() const;
+    
+    // The size of this organism.
+    int size() const;
+    // Returns true if organism is dead, false otherwise.
+    bool isDead() const;
+    
+    bool in_range(int xx, int yy);
+    
+private:
+    
+    void generateOffspring(int whereX, int whereY);
+    int starveTicks;
+};
+
+#endif /* defined(__INHERITANCE_AND_POLYMORPHISM__Bug__) */