# MODELL
"""
Die ersten beiden Klassen bilden das Modell und haben nichts mit der Darstellung zu tun.
Deshalb dürfen diese KEINE print, PyGame usw. Befehle beinhalten.
"""
class World:
"""
Create only one object of this class.
Contains list with all cells that are alive, updated them, ...
"""
def __init__(self,...):
self.cells = [] # saves all cells that are ALIVE
...
def update(self):
pass
....
class Cell:
"""
describes a single cell
"""
def __init__(self,...):
self.x = ... # x coordinate
self.y = ... # y coordinate
self.is_alive = ... # is currently alive
self.stays_alive = ... # will still be alive in next round
self.neighbours = []
....
# VIEW
"""
Die Klasse(n) hier ist für die Darstellung zuständig.
"""
class ConsoleApp: # or PygameApp
pass
# EXECUTE PROGRAM
"""
Könnte etwa wie folgt aussehen:
"""
if __name__ == "__main__":
world = World("static 1") # erstelle Welt mit vordefiniertem Preset, weitere Möglichkeiten: "glider 1", "random", ...
console_app = ConsoleApp(world) # erstelle eine Console App (oder PyGame, ...)
console_app.animate() # führe aus