Saturday, February 28, 2015

Triangle Triplets

   Roll three dice and imagine that the three top numbers represent ‘lengths’. Can the three lengths form a triangle? Most people, without thinking, say “yes.’ But the answer is that not all whole numbers, taken as triplets, form triangles. For example, the whole numbers 2, 3, and 6 do not form a triangle but 3, 5, and 6 do form a triangle. This is easily seen by studying the following diagram.
   This becomes an interesting programming problem. There are 216 (6 x 6 x 6) possible number triplets formed by rolling ordinary, six-sided dice. Those combinations can be checked by hand (a laborious but doable activity) but what if the dice are icosahedrons like those used in Dungeons and Dragons. That’s 8 thousand combinations!
   My Scratch project Triangle Triplets quickly computes which number triplets do form triangles for 4, 6, 8, 12, and 20-sided dice. The program also counts equilateral, scalene, and isosceles triangles for each set of three dice. Using this data one can compute the probability of the number triplets forming a triangle, an equilateral triangle, a scalene triangle, or an isosceles triangle.
   You can view and download this Scratch project by clicking on this link.
   The problem has quite a history and a copy of the mathematics underlying the problem and an annotated Scratch algorithm can be had on request by sending an email to

Saturday, February 21, 2015

Robot Turtles - A Board game that Teaches Programming

   I was excited to recently find a board game that claims to teach fundamental programming concepts to very young children. It’s called Robot Turtles. The feature that I found most attractive and perhaps unique in the game is that Robot Turtles is designed for adults to play with kids. Sure, Robot Turtles could be an APP, but touching and swiping an APP is a solitary experience.
   The idea of a ‘turtle’ as a programmable object originated with Dr. Seymour Papert in the early 1970s. At that time he was a researcher working in the Artificial Intelligence Lab at the Massachusetts Institute of Technology. You can trace the evolution of Logo from Papert’s original mainframe LISP version to Apple and Atari Logo in 1980s to Starlogo in the 1990s and to Scratch (, its latest incarnation.
   A grownup is the Turtle Mover and controls the movement of the game pieces. This keeps the game moving and removes the errors youngsters might make in counting positions on the board.
Each youngster is a Turtle Master and controls the action cards.
The goal is for each Turtle Master to use their set of action cards to get their turtle from the start position to the colored gem that matches the color of their turtle.
   The path between the Start position and the jewel can be blocked by walls of ice, stone, or even wooden crates. Fortunately, each turtle can carry a laser to blast through these walls.
   Here’s what a typical game board looks like.
   Robot Turtles is a great introduction to Scratch Jr
a free programming language for five to seven year olds.
  Robot Turtles sells for around thirty dollars but check Amazon for the latest price.