Skip to content

Commit bf422b1

Browse files
Update cellular_automata/wa_tor.py
Co-authored-by: Tianyi Zheng <[email protected]>
1 parent a87d672 commit bf422b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cellular_automata/wa_tor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def balance_predators_and_prey(self) -> None:
203203
shuffle(entities)
204204

205205
if len(entities) >= MAX_ENTITIES - MAX_ENTITIES / 10:
206-
prey = list(filter(lambda entity: entity.prey is True, entities))
206+
prey = [entity for entity in entities if entity.prey]
207207
predators = list(filter(lambda entity: entity.prey is True, entities))
208208

209209
prey_count, predator_count = len(prey), len(predators)

0 commit comments

Comments
 (0)