xxxxxxxxxx
Xmin = 0
Xmax = 10
Ymin = -0.1
Ymax = 10.1
peinture = "rgb(125,30,20)"
transparence = 0.5
rectangle([-2,12],20,20)
couleur = "rgb(125,30,20)"
for(var i = 0; i < 11; i++){
droite([0,i],[10,i])
}
var nb = 0
var N = 500
var a = 0.4
for(var i = 0; i < N; i++){
nb = nb+aiguille(a/2)
}
function aiguille(r){
xa = 10*rand()
ya = 10*rand()
var res = 0;
alpha = 2*%PI*rand()
xa1 = r*cos(alpha)+xa
ya1 = r*sin(alpha)+ya
xa2 = r*cos(alpha+%PI)+xa
ya2 = r*sin(alpha+%PI)+ya
couleur = noir
if( Math.abs(Math.floor(ya2)-Math.floor(ya1))>=1){
res = 1
couleur = blanc
}
segment([xa1,ya1],[xa2,ya2])
return res
}