Saturday, December 21, 2013

A Simple Animation Exercise

   In his book, The Armchair Universe, computer scientist A.K. Dewdney reprints 5 Easy Pieces, one of his Computer Recreations columns published in Scientific American. The first easy piece was to program a moving, segmented caterpillar.
   I first programmed this easy piece in the BASIC programming language. In BASIC, the coordinates of each segment were stored in a 1-dimensional array. To compute the next cycle, the new position for the head was computed and then every segment was moved up one element of the array. Only one new movement computation had to be made per cycle of animation!
   In Scratch, I used the point towards block to simplify the animation.
   The script uses 11 sprites to create a head, a tail, and nine intervening segments. The ‘head’ selects a turn angle between 30º to the left and 30º to the right and then moves 3 steps. Every other sprite ‘points towards’ the sprite in front of it and then moves 3 steps. For example, sprite 4 points towards sprite 3 and moves 3 steps. This simple technique creates the illusion of a crawling caterpillar!       
    Here’s a screenshot of showing how the caterpillar starts in 11 segments.
    The segments soon fit loosely together since they are all travelling at the same speed but after a few reflections off the sides, the segments fit together as is shown in this screenshot.
    The project can be viewed and downloaded by clicking on this link.

Tuesday, December 10, 2013

Jackson Pollack Creates Chaos

Scratch Simulates a Jackson Pollack Painting

The following is taken from:
Order in Pollock's Chaos
Richard P. Taylor
Scientific American
December 2002

   "In a drunken, suicidal state on a stormy March night, Jackson Pollock (1912-1956) laid down the foundation of his masterpiece Blue Poles: Number 11, 1952. He unrolled a large canvas across his windswept barn and, using a wooden stick, dripped the canvas with house-hold paint from an old can."
   Physicist Taylor goes on to explain in his article how his analysis of Pollack's painting revealed that the structure underlying Pollack's random dribbling of paint onto canvas is fractal.
   To view the Scratch construction of a simulated Pollack, click on the following link. To study the scripts, download the Scratch project.

    A free two-page pdf file with a bit more information can be had by sending an email to