Buffon’s Needles simulation in Processing

Buffon’s Needle is a famous way to (slowly) estimate \pi.
Here’s a processing.org program to calculate \tau (to keep the math-hipster hatred of \pi-day at a critical point and concave up).

Link to live simulation and code. All variables are easy to change, size of window, length of needle, spacing of lines, etc.


Neat program to write. Funnily enough, the code wasn’t working in the javascript version of processing because javascript didn’t understand the constant TAU. Ha.

note: I got the graph idea at the bottom idea from this sketch, but I never looked at the actual code.

One thought on “Buffon’s Needles simulation in Processing

Leave a Reply

Your email address will not be published. Required fields are marked *