from random import *
from decimal import *
from math import *
from turtle import *
delay(0)
tracer(0)
a=1
b=0
u=0
while True:
    x=random()
    y=random()
    b=b+Decimal(1)
    if x*x+y*y<1:
        a=a+Decimal(1)
        color(0,0,1)
    else:
        color(1,0,0)
    up()
    goto(x*400-200,y*400-200)
    down()
    forward(1)
    p=4*a/b
    u=u+p
    print "Pi=",p,"   ",u/b,"   Y=",a,"   X=",b
    
