summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spiderworld.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/spiderworld.py b/spiderworld.py
index 6d17602..f998f3a 100644
--- a/spiderworld.py
+++ b/spiderworld.py
@@ -4,10 +4,42 @@ Script to rudementarally model spiders colonising new terrain, and the effect
that could have on increasing the nutrient levels.
"""
+import numpy as np
+
+class Terrain:
+ """ Terrain class represents the terrain over which the model is run. """
+
+ def __init__(self, size_x=10, size_y=10):
+ """ Create a new field of size_x by size_y """
+ self.field = np.zeros(shape=(size_x, size_y))
+
+ def print_terrain(self):
+ """ Display the field """
+ print(self.field)
+
+
+class Critter:
+ """ Basic class for a creature that can appear, modify the terrain, and
+ procreate or die. """
+
+ def __init__(self, nutrient_value=1):
+ self.nutrient_value = nutrient_value
+
+ def expire(self):
+ """ Death of the critter """
+ return self.nutrient_value
+
def main():
""" main function, do stuff """
+ board = Terrain()
+ board.print_terrain()
+
+ spider1 = Critter()
+
+ print("\nSpider1 left", spider1.expire(), "nutrients behind.")
+
if __name__ == '__main__':
main()