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()