Skip to content

Commit f79680b

Browse files
committed
chore(quality): Implement algo-keeper bot changes
1 parent a052365 commit f79680b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: cellular_automata/wa_tor.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Entity:
4848
True
4949
"""
5050

51-
def __init__(self, prey: bool, coords: tuple[int, int]):
51+
def __init__(self, prey: bool, coords: tuple[int, int]) -> None:
5252
self.prey = prey
5353
# The (row, col) pos of the entity
5454
self.coords = coords
@@ -205,8 +205,8 @@ def balance_predators_and_prey(self) -> None:
205205
shuffle(entities)
206206

207207
if len(entities) >= MAX_ENTITIES - MAX_ENTITIES / 10:
208-
prey = list(filter(lambda m: m.prey is True, entities))
209-
predators = list(filter(lambda m: m.prey is True, entities))
208+
prey = list(filter(lambda entity: entity.prey is True, entities))
209+
predators = list(filter(lambda entity: entity.prey is True, entities))
210210

211211
prey_count, predator_count = len(prey), len(predators)
212212

@@ -471,7 +471,7 @@ def run(self, *, iteration_count: int) -> None:
471471
472472
>>> wt = WaTor(WIDTH, HEIGHT)
473473
>>> wt.run(iteration_count=PREDATOR_INITIAL_ENERGY_VALUE - 1)
474-
>>> len(list(filter(lambda m: m.prey is False,
474+
>>> len(list(filter(lambda entity: entity.prey is False,
475475
... wt.get_entities()))) >= PREDATOR_INITIAL_COUNT
476476
True
477477
"""
@@ -567,7 +567,7 @@ def display_visually(wt: WaTor, iter_number: int, *, colour: bool = True) -> Non
567567
output += "\n"
568568

569569
entities = wt.get_entities()
570-
prey_count = len(list(filter(lambda m: m.prey is True, entities)))
570+
prey_count = len(list(filter(lambda entity: entity.prey is True, entities)))
571571

572572
print(
573573
f"{output}\n Iteration: {iter_number} | Prey count: {prey_count} | "

0 commit comments

Comments
 (0)