aUCBLogo Demos and Tests / daniel_approx
to daniel_approx
cs hT
aprox2 100000
end
to aprox2 :puntos
dentro=0
repeat :puntos
[ x=200-random 400
y=200-random 400
d=Norm list x y
ifElse 200 < d
[ setPixelXY x y 4
][ setPixelXY x y 2
dentro=:dentro+1
]
]
area=(:dentro/:puntos)*200*200
print Sentence [area aprox:] :area
print Sentence [pi aprox:] :area/(100*100)
end
to distance_old :point
if NumberP :point [stop]
localmake "dx (Item 1 Pos) - (Item 1 :point)
localmake "dy (Item 2 Pos) - (Item 2 :point)
output Sqrt (:dx*:dx + :dy*:dy)
end