Buffon's Needle

The question posed by Georges-Louis Leclerc, Comte de Buffon, in the 1700s: If you repeatedly and randomly drop a needle on a plane of parallel lines, what percentage of the time would the needle touch a line? Assume needle x-y position and angle orientation are random. The classic question presumes that the spacing between any adjacent parallel lines is equal to the length of the needle, but the question may be extended for any ratio of needle length:line spacing. I was well into making this simulation when it finally occurred to me to confirm that there already exist pllllllenty of Buffon's Needle simulations in GeoGebra. But I still wanted to finish this one to suit my preferences for use in my classroom:
    • Allow the user to vary the needle length: line spacing ratio (using the "Needle length" input box).
    • Give the option of leaving a "trace" of previous needle positions or not.
    • Color code green when the needle hits a line and red when the needle fails to hit a line.
    • Offer a button to "Drop once" a single needle at a time, and a button to "Start drop" the needle repeatedly for as long as desired. Once "Start drop" is activated, a slider is offered to vary the drop rate.
    • Encourage the user to speculate the percentage for any needle length: line spacing ratio before running the simulation. Therefore, unlike most/all other simulations I've seen, I don't present the "final equation" that results from the probability/calculus analysis at all. That may arise during a classroom discussion, or via other internet resources.