Portage d’un script de https://workshop.numworks.com/python/vef03715/
from turtle import * from random import randint colormode(255) try: get_keys() os = (192,53,53) except: os = (255,183,52) def n(x,y): if -70<x<-60 and -80<y<80: return True if -110<x<-70 and -3.75*x-333-15<y<-3.75*x-333: return True if -120<x<-110 and -80<y<80: return True return False def s(x,y): if -30<x<30 and -80<y<-70: return True if -30<x<-20 and 5<y<70: return True if -30<x<30 and -5<y<5: return True if 20<x<30 and -70<y<-5: return True if -30<x<30 and 70<y<80: return True return False def i(x,y): if 60<x<120 and -80<y<-70: return True if 85<x<95 and -80<y<80: return True if 60<x<120 and 70<y<80: return True return False def nsi(): global os xmax=140 ymax=100 speed(0) while True: forward(1) p=position() x,y=p[0],p[1] if n(x,y) or s(x,y) or i(x,y): color(os) else: color(42,42,42) if x >= xmax or x <= -xmax or y <= -ymax or y >= ymax: left(randint(90,180)) nsi()