Jonathan. Frech’s WebBlog

𝜋 Gen­er­a­tor (#2)

Jonathan Frech,

Using Python and Pygame I created a pro­gram which approximates 𝜋. On the square screen points will ran­dom­ly ap­pear. Based on the distance to the center the points get a dif­fer­ent color. Divided into two groups (the red points and the gray points) the pro­gram can roughly estimate 𝜋.

How it calculates

Source code: pi-gen­er­a­tor.py