summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Renes <wrenes@gmail.com>2021-04-30 23:41:38 +0200
committerWillem Renes <wrenes@gmail.com>2021-04-30 23:41:38 +0200
commit319ca9ae730ce07561a927c096757048d2f8d669 (patch)
tree5af0b9570a242e09ba9139a30a38ef36099dba4f
parent87cd50ccfd5ed1f75bfb3101efb24fbcc9a6e78c (diff)
downloadSpiderWorld-319ca9ae730ce07561a927c096757048d2f8d669.tar.gz
SpiderWorld-319ca9ae730ce07561a927c096757048d2f8d669.zip
start of Terrain and Critter
-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()