Add tick count for behavioral model mutation and reduce initial cell spawn count
Some checks failed
Build Simulation and Test / Run All Tests (push) Failing after 30s
Some checks failed
Build Simulation and Test / Run All Tests (push) Failing after 30s
This commit is contained in:
parent
eded181c62
commit
5d862bfd50
@ -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
|
||||
|
||||
@ -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 = []
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user