Thursday, August 27, 2015

The Grecian Urn Problem


   The following problem is one of three problems A. K. Dewdney discussed in his Mathematical Recreations column appearing in the March 1991 issue of Scientific American. The three problems originated with mathematics professor Ross Honsberger, University of Waterloo, Canada.
   A Grecian urn contains 75 white beans and 150 black beans. Next to the urn is pile of 200 black beans.  
   Pick two beans at random from the urn.
   If both beans are black (A), place one on the pile and return the other to the urn.
   If one of the beans is black and the other bean white (B), place the black bean on the pile and drop the white bean, back into the urn.
   If both beans are white (C), discard both white beans, pick a black bean from the pile and drop it into the urn.
   No matter the color of the two beans, every time two beans are picked at random, the number of black and white beans in the urn will decrease by one.
   Question: Will there ever be just one bean in the urn and if, so, what will be its color?
   Not having a Grecian urn and a supply of black and white beans handy, I decided to write a Scratch simulation of the problem. You can view and download the Scratch program by clicking on this link.
https://scratch.mit.edu/projects/67083730/
   You can click on the green flag to run the program to find the answer to the problem. If you don't believe the result, run it again. If you still don't believe it, check my code and determine if there is a mistake in my logic.

Monday, August 17, 2015

Snap! Son of Scratch

   I have been spending many pleasant hours tracing the roots of Scratch all the way back to the 1970s and the pioneering work of Dr. Seymour Papert at the Massachusetts Institute of Technology Artificial Intelligence Lab. At that time Dr. Papert created the computer programming language for kids called Logo. He continued his work with Logo by teaming with the Lego® group to produce Lego® Logo and the current Mindstorms version of Lego® Logo. Scratch owes its snap-together blocks to the snap-together blocks of Lego®.
   During my search I was thrilled to come across a paper presented at a 2010 conference on Constructionism by Brain Harvey and Jens Monig describing the extension they made to Scratch called Snap! Here's a link to their paper.
   Their motivation was to add custom blocks to Scratch to make it a language suitable for High School Computer Science Advanced Placement and undergraduate introductory computer science classes.
   Snap! Is free and runs in your browser. Here’s the link.
http://snap.berkeley.edu
   This is a screenshot of the Snap! browser. As you can see, there is a Scratch look to Snap!
   A link to a reference manual is give near the bottom of the home page.