I already went over a Monte Carlo method for estimating Pi - you know, for Pi-Day (March 14). Well, here is a small addition. This is the same thing done in Scratch.
Click the image to run the scratch app. It is kind of fun to watch.
About Scratch
If you are not familiar with Scratch, basically it is a graphical programming language a lot like the stuff for the Lego robotics. It is free, runs on Windows and Mac OS X, and can be embedded in a webpage as a java applet. Sure, Scratch has some limitations, but it is great for kids. Here is what the code for the pi-estimation program looks like:
If you create an account on Scratch, you can download the code of any project. I like Scratch.

Rhett Allain is an Associate Professor of Physics at Southeastern Louisiana University. He
enjoys teaching and talking about physics. Sometimes he takes things apart and can't
put them back together.
Comments
Do you think that you could include the animation behind a cut? It slows my browser down like crazy every time I load. When I try to search multiple times, I have to reload the main page several times. Thanks!
Posted by: jg | March 12, 2010 9:28 AM
@jg,
Sorry about that - I was sort of worried about that app autorunning. I have replaced it with picture and a link to the scratch website. Hope that fixes it.
Posted by: Rhett Allain
| March 12, 2010 9:37 AM
n=1.851E6
pi=3.1344...
Guess they've been lying to us about that 3.14159 business all this time. ;)
Posted by: ToSeek | March 12, 2010 10:03 AM
@ToSeek,
My wife found the same thing - I suspect it is a problem with Scratch's random number generator. I could be wrong though.
Posted by: Rhett Allain
| March 12, 2010 10:58 AM
WOW! This is the first time I've heard of Scratch. I teach algebra to 8th graders and this is exactly the kind of tool I've been looking for. The possibilities are overwhelming. Thanks for the tip!
Posted by: Andy | March 16, 2010 1:15 AM