doodles-py/slime-exp/examples/rain.py
James Turk 186c5fac9a
Some checks failed
Python Linting / build (pull_request) Has been cancelled
add 3 files from slime grid experiment
2024-12-16 21:42:03 -06:00

27 lines
699 B
Python

from slime.grid import Grid
from slime.rules import SimpleMapping, Movement, Combine
grid = Grid(10, 10, wrap_y=True)
grid[0, 0, "state"] = 1
grid[1, 1, "state"] = 1
grid[2, 0, "state"] = 1
grid[3, 1, "state"] = 1
grid[4, 0, "state"] = 1
grid[5, 1, "state"] = 1
grid[6, 0, "state"] = 1
grid[7, 1, "state"] = 1
grid[8, 0, "state"] = 1
grid[9, 1, "state"] = 1
# grid.rules.append(SimpleMapping("state", {0: 1, 1: 0}))
# grid.rules.append(Movement("state", 0, 1))
grid.rules.append(
Combine(SimpleMapping("state", {0: 1, 1: 0}), Movement("state", 0, 1))
)
while True:
# grid.render_text("state")
grid.render_text(lambda cell: {0: "|", 1: "-"}[cell["state"]])
input()
grid.step()