Leo is very excited about the upcoming Pi day, so we took a break from our project to program a game for every chapter of Winnie-the-Pooh, to use the classic “inscribed circle” algorithm to estimate Pi.

We looked up the algorithm in Wikipedia. (I tried to derive it with him, but the algebra is just a little beyond him, at the moment.)

At first I thought that this was going to require hairy (or at least painful) math to figure out whether the random hits were inside the circle or not (HopScotch doesn’t have any trig functions!), but Leo actually came up with a brilliant solution: Just draw a circle, and a square and then use Hopscotch’s built-in “when A hits B” methods to do the counting.

Et, Viola!

(I’m noticing just now that the circle is a little off the center of the square. Actually doing this project precisely in HopScotch is tricky because it’s not great at coordinates and object sizing….but certainly close enough for a 6 year old! 🙂 )

### Like this:

Like Loading...

*Related*