File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -208,14 +208,13 @@ def balance_predators_and_prey(self) -> None:
208
208
209
209
prey_count , predator_count = len (prey ), len (predators )
210
210
211
- if prey_count > predator_count :
212
- for entity in prey [:DELETE_UNBALANCED_ENTITIES ]:
213
- # Purge the first n entities of the prey
214
- self .planet [entity .coords [0 ]][entity .coords [1 ]] = None
215
- else :
216
- for entity in predators [:DELETE_UNBALANCED_ENTITIES ]:
217
- # Purge the first n entities of the predators
218
- self .planet [entity .coords [0 ]][entity .coords [1 ]] = None
211
+ entities_to_purge = (
212
+ prey [:DELETE_UNBALANCED_ENTITIES ]
213
+ if prey_count > predator_count
214
+ else predators [:DELETE_UNBALANCED_ENTITIES ]
215
+ )
216
+ for entity in entities_to_purge :
217
+ self .planet [entity .coords [0 ]][entity .coords [1 ]] = None
219
218
220
219
def get_surrounding_prey (self , entity : Entity ) -> list [Entity ]:
221
220
"""
You can’t perform that action at this time.
0 commit comments