from math import * from turtle import * from random import * def ligne(): pendown() setheading(-90) forward(220) penup() def parquet(): penup() speed(10) for i in range(-150,160,50): goto(i,111) ligne() def aiguille(): color(randint(0,255),randint(0,255),randint(0,255)) speed(5) x=randint(-110,110) y=randint(-70,70) angle=randint(-180,180) penup() goto(x,y) setheading(angle) pendown() forward(50) def buffon(n): parquet() for i in range(n): aiguille() hideturtle()