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

Method reset_reproduction_time

cellular_automata/wa_tor.py:62–75  ·  view source on GitHub ↗

>>> e = Entity(True, coords=(0, 0)) >>> e.reset_reproduction_time() >>> e.remaining_reproduction_time == PREY_REPRODUCTION_TIME True >>> e = Entity(False, coords=(0, 0)) >>> e.reset_reproduction_time() >>> e.remaining_reproduction_time == PRED

(self)

Source from the content-addressed store, hash-verified

60 self.alive = True
61
62 def reset_reproduction_time(self) -> None:
63 """
64 >>> e = Entity(True, coords=(0, 0))
65 >>> e.reset_reproduction_time()
66 >>> e.remaining_reproduction_time == PREY_REPRODUCTION_TIME
67 True
68 >>> e = Entity(False, coords=(0, 0))
69 >>> e.reset_reproduction_time()
70 >>> e.remaining_reproduction_time == PREDATOR_REPRODUCTION_TIME
71 True
72 """
73 self.remaining_reproduction_time = (
74 PREY_REPRODUCTION_TIME if self.prey is True else PREDATOR_REPRODUCTION_TIME
75 )
76
77 def __repr__(self) -> str:
78 """

Callers 1

move_and_reproduceMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected