## Monday, December 29, 2014

### A Cellular Automaton (Ant) that Counts in Binary

In the previous post I described the update to my original Langton's Ant project.
In this post I describe a new Scratch project that is a variation of Langton's Ant.
A small change in the rules governing Langton's Ant creates an ant that counts in binary!
The Binary Ant builds a vertical pattern that theoretically, goes on forever.
For an introduction to the Binary Ant, click on this video.
I have written a detailed description of the pattern created by the ant and the Scratch code used to model the ant. If you would like a free PDF copy, send your request to grandadscience@gmail.com.

### Updates to My Langton's Ant in Scratch Project

This is an update to my original Langton's Ant project. This update now allows you to experiment with Langton's Ant by placing the ant in a circle, square, triangle, or near a line segment.
As you can see in this screen shot, a circle, triangle, square, and line segment are on the home screen. Click on the green flag and then click on one of the shapes and drag it so that it traps the center of the ant (the small red circle). Or, click on and drag the line segment near to the red dot. Then click on the head of the ant. You will see the ant shrink to size of the grid it will be moving on and then start moving.
How the ant will interact with figures in the plane is any ones guess because there is no way to predict the pattern the ant will create when it interacts with another figure. Changing the Direction the ant starts in is another variable.
Over the years I have collected several interesting and surprising figures created when the ant interacted with one or more figures.

## Monday, December 1, 2014

### Galvanotaxis

In biology, a taxis is the response of an organism to an environmental stimulus.
Galvanotaxis (or electrotaxis) is the movement of an organism in response to an electric field.
If platinum electrodes are inserted into a chamber filled with water containing a culture of paramecium, when an electric current is introduced into the chamber, the paramecia move towards the negative electrode.

I simulated galvanotaxis in Scratch. Click on the play button to watch a video of the Scratch project in action.

A description of the code and how it works is available on request by sending an email to:

## Saturday, November 22, 2014

### Scratch as a Social Community

The Swiss psychologist Jean Piaget theorized that the cognitive development of children goes through four stages: the sensorimotor, the preoperational, the concrete operational, and the formal operational stage. Piaget’s work led to the theory of knowledge called constructivism. The essence of constructivism is that although information, facts, etc. can be transferred from teacher to student, knowledge has to be constructed by the student.

Seymour Papert, the creator of Logo, the first programming language for kids, took the construction idea, tied it to making things, and called it constructionism.

As Edith Ackermann says, “Piaget’s constructivism offers a window into what children are interested in, and able to achieve, at different stages of their development.” She goes on to say, “Papert’s constructionism, in contrast, focuses more on the art of learning, or ‘learning to learn’, and on the significance of making things in learning.”

Logo, through the work of Mitchel Resnick and his group at MIT, has evolved to Scratch.

Dr. Resnick explains the three design criteria used to build Scratch, “Learning lessons from Papert’s experiences of Logo, we’ve designed Scratch to move beyond Logo along three dimensions, making programming more tinkerable, more meaningful, and more social.”

He goes on to describe the social side of Scratch, “Our development of the Scratch programming language has been tightly coupled with development of the Scratch Website and online community. For Scratch to succeed, we feel the language needs to be linked to a community where people can support, collaborate, and critique one another and build on one another’s work.”

That Scratch is a success as a social constructionism community is reflected in its numbers.

As of November 21, 2014, these are the Scratch statistics.

Educators and parents interested in students building their knowledge should take a serious look at Scratch at

and join the community.

Resources:
Ackermann, Edith K. (2001)
Piaget’s Constructivism, Papert’s Constructionism: What’s the difference?
Future of Learning Group
MIT Media Laboratory

Resnick, Mitchel. (2012)
Educational Technology, vol. 52, no. 4, pp. 42-46.

## Sunday, November 9, 2014

### A Line-following Robot in Scratch

I recently received a comment in my Scratch Messages box from VauHaEs, a Scratcher in Germany. He liked and complimented one of my shared projects (online at the Scratch web site) so I clicked on his name to view his profile. There, I was able to view all of the projects he had uploaded to the Scratch web site and I was immediately intrigued by his line–robot project
Below is a screenshot of line_robot in action. When the green flag is clicked, an animated robot with two long, stiff arms tracks along the yellow line.
In line­_robot, both the robot and its control are implemented in software, and the software is FREE!  I think this might be important to those that would like to ‘get into robots’ but can’t afford the \$200+ cost of a Lego Mindstorms® kit.
I've written a short description of the code VauHaEs wrote for this project. I remixed his project to simply the coding.
You can request a free PDF of the description of his code by sending an email to

## Sunday, November 2, 2014

### A List of Great Resources that Support Scratch

I recently met with a group of K–12 educators interested in banding together to support the current usage of Scratch in classrooms and to develop strategies as to how to expand the number of teachers that will introduce Scratch to their students. An agenda item asked that everyone report on the Scratch resources they knew were available on the web so that a list could be compiled, distributed, and kept current.
What follows is the list generated from our first meeting. As new resources are discovered, I will update the list.

Scratch Resources You May or May Not Know About

(1) Scratch MIT – http://scratch.mit.edu/

(2) Scratchjr MIT – http://www.scratchjr.org/
Available as a free iPad APP at the App Store
Scratchjr available as Web Browser in 2015

(4) Scratch Education – Now at Harvard – Web Site Called Creative Computing
(3) Both the Guide and Workbook in editable PowerPoint format.

(5) Computational Thinking with Scratch Site
What is computational thinking?
How do I assess the development of CT?
How do I support the development of CT?

(6) One Hour of Coding with Scratch – December 8-14, 2014

(7) Raspberry Pi ­– a \$35 computer (cannibalize old keyboards, monitors, etc.)
Scratch 1.4 is already loaded into the module but so are web browsers for
accessing Scratch 2.0.

(9) Report of a Workshop on The Scope and Nature of Computational Thinking
Committee for the Workshops on Computational Thinking
Computer Science and Telecommunications Board
Division on Engineering and Physical Sciences

(10) This is a Scratch-based curriculum designed for grades eight and up.
Exploring Computer Science

(11)  Exploring Computer Science curriculum and Principled Assessment of Computational Thinking

(12) Computer Science Unplugged
Designed for classrooms that do have computers or access to computers. There are a lot of great ideas that would make great Scratch programming projects.

## Sunday, May 18, 2014

### Parallel Mouse

In an earlier post (see Angle Mouse and Other Scratch Geometry Projects (April 15, 2014)
I suggested that coding a geometry concept in Scratch is a higher-level cognitive task than just memorizing a geometric definition.
To illustrate this belief, I shared with readers two Scratch projects, Angle Mouse
and, Perpendicular Mouse
Here is a third example called Parallel Mouse. As the screenshot shows, a mouse (seen in top down view) constructs three pairs of parallel lines. The code that directs the mouse to do this is simple and is a good example of sequencing as a programming skill.
If you view the project in action, the mouse will report that as it draws a line and then goes to a random point on that line, it turns left 90º, lifts the pen, moves forward a given distance, turns right 90º, and then draws the line parallel to the first line.
Asking young students to code parallel lines is a good programming exercise but my project can be taken a step further. It can be generalized in the sense that the mouse can turn through any angle, say angle x.
In figure (a), the mouse has drawn the first line and moved to a random point on the line. In (b), the mouse has turned left through an angle, xº.
In (c), the mouse moves forward a given distance to another point.
Finally, in (d), the mouse turns right xº and is in position to move back and forward to draw the line parallel to the first line.
If the diagram (d) is looked at as parallel lines cut by a transversal, then it can be seen that the corresponding angles are equal! Math texts simply state that fact about corresponding angles whereas the young Scratch programmer, if asked to code a program that constructs parallel lines, can discover that fact for themselves.

## Friday, May 9, 2014

### Count Buffon's Needle Problem

The foundation of probability theory was established in 1654 through a series of letters between Blaise Pascal and Pierre de Fermat. These letters traded solutions to a gambling problem raised by the Chevalier de Méré.
Probability theory grew slowly over time. Approximately one hundred years after Pascal and Fermat solved a gambling problem, Count Buffon analyzed another gambling problem. Surprisingly, his analysis revealed  a close connection between a game involving dropping a needle onto a grid of regularly spaced lines and the number Pi (π).
Gamblers at that time were beginning to realize that understanding the theory underlying any game would allow them to maximize winnings and minimize losses.
Count Buffon was born into a wealthy French family and spent his life pursuing his interests in mathematics, physics, and natural history. His love of nature led him to become curator of French Royal Gardens and Museum.
The simplest case of Buffon’s needle problem is when the separation of the lines, L, equals the length of the needle. The question then becomes what is the probability that a needle dropped on a grid of these equally spaced lines intersects one of the lines?
The needle problem is an early example of what we now call geometrical probability because its solution involves the ratio of two known areas.

View this short video to observe a 1000-needle run of the Buffon Needle simulation. The simulation starts by dropping a single needle three times to show you how it works and then the slider is set to 1000 needles. Check the Approximation to π window in the lower left corner when the simulation ends.

As usual, a free PDF document describing the mathematics and Scratch programming techniques is available on request by sending an email to grandadscience@gmail.com.

## Monday, April 21, 2014

### Bertrand's Random Chord Paradox 1

The Random Chord Probability Problem Scratch project described in the February 30, 2014 post stated that the project was a warm up to Bertrand's famous Random Chord Paradox.
The random chord problem was originally posed by Joseph Bertrand in his work, Calcul des probabilités (1888). Bertrand gave three arguments, all apparently valid, yet yielding three different results.
Given a circle with an inscribed equilateral triangle. What is the probability that a randomly selected chord is longer than the side of the triangle?
Click on the video to see the Scratch simulation of Paradox 1 using the random endpoints method. The code selecs two random points on the circumference of the circle, draws the chord connecting the points, and compares the length of the chord to the length of the side of the equilateral triangle.

At the beginning of the video, the Picks slider is set to one to show how the random chord appears on the circle. The slider is then set to 1000 Picks and, after 1000 random chords have been picked, the Probability Chord > Side slider shows that the experimental probability (Monte Carlo) is 0.339.
On can reasonably conjecture that the theoretical probability is 0.333… or 1/3.
As usual, I have written a document, Bertrand's Random Chord Paradox 1 (PDF), that describes the code used in the project and also presents a theoretical solution to the problem.  To receive a copy of this document, send an email request to grandadscience@gmail.com.

## Tuesday, April 15, 2014

### Angle Mouse and Other Scratch Geometry Projects

Years ago I was asked to teach Benjamin Bloom's Taxonomy of Learning Domains to teachers. If I had to pick the one most important statement in the taxonomy it would be this; the ability to paraphrase is a test of comprehension. In other words, the more ways I can state a concept (paraphrase) the better I understand (comprehend) the concept.
For example, consider the Distance Formula from analytic geometry.
Is the ability to use the above formula in a Scratch program that computes the distance between an ant and the mouse-pointer a test of the programmer's comprehension  of the formula? That is, the Scratch program is a paraphrase of the distance formula. I've answered that question in the affirmative because I know how to express the formula in code that Scratch understands.
Watch this short video that will hopefully convince you that the project is truly a paraphrase of the distance formula. As the mouse-pointer is moved, the distance between it and the ant is continuously updated.

The Ant Chases the Mouse-pointer project can be viewed and downloaded at
Here is a second example. This Scratch project is an effort to dynamically 'explain' the angle concept. The project is dynamic because it actually constructs the requested angle.

http://scratch.mit.edu/projects/16793255/
Now a third and final example. This project is also dynamic in that it constructs the perpendicular to a point chosen at random on a line segment. Watch this short video.

http://scratch.mit.edu/projects/20186064/
What do you think? Is programming (coding) a higher-level cognitive process than just memorizing a definition? As you can probably guess, I answered that question for myself a long time ago and I want learners, of all ages, to share the joy I experience when I successfully code a program.

## Tuesday, April 1, 2014

### The Hopalong Attractor of Dr. Martin

The Hopalong algorithm was introduced to the public by computer scientist A. K. Dewdney as a feature in his Scientific American column, Computer Recreations, in the September 1986 issue.
Dr. Dewdney credited Dr. Barry Martin, then a mathematics professor at Aston University, Birmingham, United Kingdom for the attractor. Dewdney named the attractor Hopalong because it hops from point to point.

Martin's algorithm takes a single seed value and iterates it to produce a wide variety of interesting images.
The equations are:
x = y – SGN(x) * √(ABS(b*x – c))
y = a – x
This series of (x, y) coordinates is specified by an initial point (xo, yo) and three constants a, b, and c.
The following is an example taken from the Scratch program where a = 0.4, b = 1, and c = 0 and the magnification set at 100. The initial point is (0, 0), the origin.

If you would like a description of the Scratch code and a Gallery of Hopalong images just send an email request to

## Sunday, March 30, 2014

### The Random Chord Probability Problem

I am still playing with geometric probability. This Scratch project looks at an experimental (Monte Carlo) method for determining the probability that the chord of a circle, picked at random, is longer than the radius of the circle.
The real purpose of this project is to set the stage for using three additional Scratch programs to explore the Joseph Bertrand Paradox. His paradox indicates that how you select the random chord in a similar circle problem is important and in fact, leads to three different answers!
This video shows the result of running the experiment.

Repeated runs of the program indicate that the theoretical probability is two-thirds.

Detailed descriptions (PDF format) of the code and theoretical solution to the problem can be had by sending an email request to grandadscience@gmail.com

## Saturday, February 8, 2014

### The Area of Texas Using the Monte Carlo Method

In the previous post, the value of Pi was approximated by using the Monte Carlo Method. It might be easy to see that the circle-inscribed-in-a -square method used in the project can be generalized to shapes that are highly irregular, like the shape of Texas.
As I developed the Area of Texas project, I was surprised to learn that Texas is almost square! The east to west distance is 775 miles and the north to south, 765 miles.
Here's the image I used in the Scratch project.
As in the Pi approximation, points are randomly selected in the rectangle. Each point is then tested to determine if it is in Texas.
The sprite used to plot each point is black so the [color black is touching color red] block makes this test a simple one.
The product of the ratio of points in Texas to the total number of randomly selected points times the area of the rectangle is then the Monte Carlo approximation to the area of Texas.
Here's a screenshot of the result for selecting 10,000 random points.
Google Maps gives the area of Texas as 268,820 square miles. The Scratch script approximated the area as 266,853 square miles.
That's a good approximation to the Google value.
You can view, use, and download this project from the Scratch website by clicking on this link.
You can also request a free PDF document containing more detail as to how the script is coded. Send an email request to grandadscience@gmail.com.

## Saturday, January 25, 2014

### The Monte Carlo Method Used to Approximate Pi

The Monte Carlo method is a mathematical technique used to approximate the solution to a problem for which no known method for obtaining an exact solution is known.
This project uses darts thrown at a circle inscribed in a square to illustrate the method. The ratio of the area of a circle inscribed in a square to the area of the square is π/4. If the ratio of the number of darts that land in the circle to the number of darts thrown (assuming all darts hit in the square) is multiplied by 4 then the result approximates the value of Pi. The more darts thrown, the closer the approximation.
Below is a screenshot of the project. The project makes use of the parametric form of the circle equation, random numbers, and the Pythagorean theorem.