## Wednesday, November 4, 2015

### Scratch and Binomial Walks

I am at the #bit15 conference and attended the Coding and Math session with @georgegadanidis.  We learned a little Scratch programming.

We did the requisite square and circle creation tasks.  He had some nice connections to higher level math - including extending a two coin toss scenario to the binomial theorem.  At that point, I worked on my program to make the cat do a binomial walk - not realizing that he would have that example later.  I have shared my project at https://scratch.mit.edu/projects/86529699/ and embedded it below:

The cat should start moving when you click the green flag.  In the offline Scratch editor, you can export the list of horizontal positions where 0 is the centre.  I then imported it into Fathom to make a histogram.

Looks pretty binomial to me!

I am using Twitter as part of our #mmmmECOO presentation - my handle is @rossisen.

Markus said...

The comments won't let me put in an iframe here, but you can see my scratch here:

Serpinsky Cat

That's very cool Ross. I played with scratch and was able to get a fun version of the Serpinsky Triangle. The process is quite simple:

1 - Take 3 points in a plane to form a triangle.
2 - Randomly select any point inside the triangle and consider that your current position.
3 - Randomly select any one of the 3 vertex points.
4 - Move half the distance from your current position to the selected vertex.
5 - Plot the current position.
6 - Repeat from step 3.

I was able to do this in scratch and ended up assigning colours to each of the three quadrants. Why the white areas of zero probability emerge is an interesting question that could merit some further investigation in a classroom. The code is easily tweaked to see different results in the picture that emerges.

uptergroveGreg said...

Very cool Ross ! I have discovered, with the help of some friends, that not only is Scratch very cool, but it is so cool that some very bright people have taken it and extended it to do even MORE cool things !

In particular, Snap! (the programming language formerly known as BYOB - Build Your Own Blocks) is an extension of Scratch which adds the ability to handle lists, class procedures, and continuations. You can import custom tools and libraries of blocks - so much power! According to the home page, you can use Snap! with a Sphero (look out BB8), Wiimotes, even Arduinos!

THEN ... it appears that someone went even further ... the Scribble program is designed for creating Generative Art. It incorporates all the power of Scratch AND Snap! apparently, including some basic Shape block primitives with fill colour options, and the ability to add Text to the screen - two items missing from the original Scratch implementation. The YouTube playlist for Scribble Tutorials can be found at https://www.youtube.com/playlist?list=PL0AED85D243B7310B&feature=plcp

So many cool learning opportunities and programming tools ... so little time. Thanks for sharing Ross.

Ross Isenegger said...

A simple example that uses both the filling of shapes and writing text is at http://screencast.com/t/xp7e1bxw

Ross Isenegger said...

It turns out the Scribble can be used online - http://aidanlane.github.io/snapapps/scribble.html

Bernd Meyer said...

There is also a list of more complete materials for scribble as well as materials for related languages for robotics and agent-based simulation at: http://www.flipt.org

Bernd Meyer said...

There is also a list of more complete materials for scribble as well as materials for related languages for robotics and agent-based simulation at: http://www.flipt org