Approximation of PI by the Monte Carlo method using Python and the Pygame library (Still a work in progress.)
Let's take the radius of the circle as r Therefore each side of the square is 2r
The area of the circle is πr² The area of the square is 4r²
If each of the points in the square and circle were to be filled then,
Through this we get
$$\pi = 4 \cdot \frac{number \ of \ points \ in \ circle}{number \ of \ points \ in \ square}