Automate cellulaire.
# De Fedyna Kevin from kandinsky import set_pixel, get_pixel from ion import keydown fourmis = [160, 111] facing = ((0, 1), (1, 0), (0, -1), (-1, 0)) def move(): global fourmis, facing d = 0 while not keydown(2): if get_pixel(*fourmis) == (248, 252, 248): d = (d - 1) % 4 set_pixel(fourmis[0], fourmis[1], (0,) * 3) else: d = (d + 1) % 4 set_pixel(fourmis[0], fourmis[1], (255,) * 3) fourmis = [fourmis[i] + facing[d][i] for i in range(2)] move()