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

Method set_planet

cellular_automata/wa_tor.py:132–151  ·  view source on GitHub ↗

Ease of access for testing >>> wt = WaTor(WIDTH, HEIGHT) >>> planet = [ ... [None, None, None], ... [None, Entity(True, coords=(1, 1)), None] ... ] >>> wt.set_planet(planet) >>> wt.planet == planet True >>> wt.width

(self, planet: list[list[Entity | None]])

Source from the content-addressed store, hash-verified

130 self.set_planet(self.planet)
131
132 def set_planet(self, planet: list[list[Entity | None]]) -> None:
133 """
134 Ease of access for testing
135
136 >>> wt = WaTor(WIDTH, HEIGHT)
137 >>> planet = [
138 ... [None, None, None],
139 ... [None, Entity(True, coords=(1, 1)), None]
140 ... ]
141 >>> wt.set_planet(planet)
142 >>> wt.planet == planet
143 True
144 >>> wt.width
145 3
146 >>> wt.height
147 2
148 """
149 self.planet = planet
150 self.width = len(planet[0])
151 self.height = len(planet)
152
153 def add_entity(self, prey: bool) -> None:
154 """

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected