Click the green flag and watch PI get approximated by counting the dots in the circle and in the square. The approximation is supposed to converge to 3.1415, but it doesn't. Meh.
The area of the circle (C) is PI*r^2. The area of the square (S) is (2*r)^2, or 4*r^2. If we divide C by S, we get PI/4 = C/S. In other words, the ratio of C/S is one-fourth PI. We can approximate PI by dividing all the dots that fall in the circle (blue dots) by the total dots in the square (blue and green dots) and multiplying by 4. Here is another explanation: https://academo.org/demos/estimating-pi-monte-carlo/