(graphic program)
from math import *
from tkinter import *
from time import *
wx=1000
wy=1000
f=Tk()
grid=Canvas(f,width=wx,height=wy,bg="black")
grid.pack()
res=10
val=list(range(0,100))
for i in val:
val[i]=list(range(0,100))
for x in range(0,100):
for y in range(0,100):
val[x][y]="black"
ax=50
ay=50
ad=1
while True:
if ad<1:
ad=4
continue
if ad==1:
ax=ax+1
if ad==2:
ay=ay+1
if ad==3:
ax=ax-1
if ad==4:
ay=ay-1
if ad>4:
ad=1
continue
if val[ax][ay]=="black":
val[ax][ay]="white"
grid.create_rectangle(res*ax,res*ay,res*ax+res,res*ay+res,outline="",fill=val[ax][ay])
grid.update()
ad=ad+1
elif val[ax][ay]=="white":
val[ax][ay]="black"
grid.create_rectangle(res*ax,res*ay,res*ax+res,res*ay+res,outline="",fill=val[ax][ay])
grid.update()
ad=ad-1
grid.mainloop()