MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / get_entities

Method get_entities

cellular_automata/wa_tor.py:173–181  ·  view source on GitHub ↗

Returns a list of all the entities within the planet. >>> wt = WaTor(WIDTH, HEIGHT) >>> len(wt.get_entities()) == PREDATOR_INITIAL_COUNT + PREY_INITIAL_COUNT True

(self)

Source from the content-addressed store, hash-verified

171 return
172
173 def get_entities(self) -> list[Entity]:
174 """
175 Returns a list of all the entities within the planet.
176
177 >>> wt = WaTor(WIDTH, HEIGHT)
178 >>> len(wt.get_entities()) == PREDATOR_INITIAL_COUNT + PREY_INITIAL_COUNT
179 True
180 """
181 return [entity for column in self.planet for entity in column if entity]
182
183 def balance_predators_and_prey(self) -> None:
184 """

Callers 4

move_and_reproduceMethod · 0.95
runMethod · 0.95
visualiseFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected