From 5d862bfd505b238ba9573cafffaea2f11ea41101 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 16 Jun 2025 15:55:14 -0500 Subject: [PATCH] Add tick count for behavioral model mutation and reduce initial cell spawn count --- core/simulation_engine.py | 2 +- world/objects.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/simulation_engine.py b/core/simulation_engine.py index 4a81638..13f8342 100644 --- a/core/simulation_engine.py +++ b/core/simulation_engine.py @@ -41,7 +41,7 @@ class SimulationEngine: if FOOD_SPAWNING: world.add_object(FoodObject(Position(x=random.randint(-100, 100), y=random.randint(-100, 100)))) - for _ in range(10): + for _ in range(1): world.add_object(DefaultCell(Position(x=random.randint(-100, 100), y=random.randint(-100, 100)), Rotation(angle=0))) return world diff --git a/world/objects.py b/world/objects.py index 0e07cf6..2ec8f4b 100644 --- a/world/objects.py +++ b/world/objects.py @@ -258,6 +258,8 @@ class DefaultCell(BaseEntity): "can_interact": True, } + self.tick_count = 0 + def set_brain(self, behavioral_model: CellBrain) -> None: self.behavioral_model = behavioral_model @@ -270,6 +272,10 @@ class DefaultCell(BaseEntity): :param interactable: List of nearby entities (unused). :return: Self. """ + self.tick_count += 1 + if self.tick_count % 2 == 0: + self.behavioral_model = self.behavioral_model.mutate(1) + if interactable is None: interactable = []