mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-18 00:07:00 +00:00
Fix sphinx/build_docs warnings for cellular_automata (#12454)
* updating DIRECTORY.md * Fix sphinx/build_docs warnings for cellular_automata * Fix * Improve --------- Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
This commit is contained in:
parent
4abfce2791
commit
47cd21a110
|
@ -1,9 +1,9 @@
|
|||
"""
|
||||
Wa-Tor algorithm (1984)
|
||||
|
||||
@ https://en.wikipedia.org/wiki/Wa-Tor
|
||||
@ https://beltoforion.de/en/wator/
|
||||
@ https://beltoforion.de/en/wator/images/wator_medium.webm
|
||||
| @ https://en.wikipedia.org/wiki/Wa-Tor
|
||||
| @ https://beltoforion.de/en/wator/
|
||||
| @ https://beltoforion.de/en/wator/images/wator_medium.webm
|
||||
|
||||
This solution aims to completely remove any systematic approach
|
||||
to the Wa-Tor planet, and utilise fully random methods.
|
||||
|
@ -97,8 +97,8 @@ class WaTor:
|
|||
|
||||
:attr time_passed: A function that is called every time
|
||||
time passes (a chronon) in order to visually display
|
||||
the new Wa-Tor planet. The time_passed function can block
|
||||
using time.sleep to slow the algorithm progression.
|
||||
the new Wa-Tor planet. The `time_passed` function can block
|
||||
using ``time.sleep`` to slow the algorithm progression.
|
||||
|
||||
>>> wt = WaTor(10, 15)
|
||||
>>> wt.width
|
||||
|
@ -216,7 +216,7 @@ class WaTor:
|
|||
"""
|
||||
Returns all the prey entities around (N, S, E, W) a predator entity.
|
||||
|
||||
Subtly different to the try_to_move_to_unoccupied square.
|
||||
Subtly different to the `move_and_reproduce`.
|
||||
|
||||
>>> wt = WaTor(WIDTH, HEIGHT)
|
||||
>>> wt.set_planet([
|
||||
|
@ -260,7 +260,7 @@ class WaTor:
|
|||
"""
|
||||
Attempts to move to an unoccupied neighbouring square
|
||||
in either of the four directions (North, South, East, West).
|
||||
If the move was successful and the remaining_reproduction time is
|
||||
If the move was successful and the `remaining_reproduction_time` is
|
||||
equal to 0, then a new prey or predator can also be created
|
||||
in the previous square.
|
||||
|
||||
|
@ -430,7 +430,7 @@ class WaTor:
|
|||
|
||||
def run(self, *, iteration_count: int) -> None:
|
||||
"""
|
||||
Emulate time passing by looping iteration_count times
|
||||
Emulate time passing by looping `iteration_count` times
|
||||
|
||||
>>> wt = WaTor(WIDTH, HEIGHT)
|
||||
>>> wt.run(iteration_count=PREDATOR_INITIAL_ENERGY_VALUE - 1)
|
||||
|
@ -484,11 +484,9 @@ def visualise(wt: WaTor, iter_number: int, *, colour: bool = True) -> None:
|
|||
an ascii code in terminal to clear and re-print
|
||||
the Wa-Tor planet at intervals.
|
||||
|
||||
Uses ascii colour codes to colourfully display
|
||||
the predators and prey.
|
||||
|
||||
(0x60f197) Prey = #
|
||||
(0xfffff) Predator = x
|
||||
Uses ascii colour codes to colourfully display the predators and prey:
|
||||
* (0x60f197) Prey = ``#``
|
||||
* (0xfffff) Predator = ``x``
|
||||
|
||||
>>> wt = WaTor(30, 30)
|
||||
>>> wt.set_planet([
|
||||
|
|
Loading…
Reference in New Issue
Block a user