A Monte Carlo method to estimate \(\pi\) (Pi) by dropping sticks on a floor.
Imagine a floor with parallel lines spaced distance \(D\) apart. You drop a needle of length \(L\) onto the floor.
For this simulation, we set the needle length equal to the line spacing (\(L = D\)).
The probability \(P\) that the needle crosses a line is:
\(P = \frac{2}{\pi}\)
This means if we drop \(N\) sticks and count \(H\) hits (crossings), we can approximate \(\pi\):
\(\pi \approx \frac{2N}{H}\)
As \(N\) gets larger, the approximation gets closer to the real value of \(\pi = 3.14159...\)