iteration

Monty Hall Game Show Problem

Submitted by Kenrick on Thu, 10/25/2007 - 22:49.
Oct 25 2007 - 10:49pm
Etc/GMT-8

This problem is to simulate the Monty Hall Problem, which was popularized by Marilyn vos Savant in her Parade column. The problem is stated as:

Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?

Sierpinski Gasket

Submitted by Kenrick on Thu, 10/25/2007 - 22:28.
Oct 25 2007 - 10:28pm
Etc/GMT-8

A Sierpinski Gasket (or Triangle) is a type of fractal named after the Polish mathematician Waclaw Sierpinski who described some of its interesting properties in 1916. It is a nice example of how an orderly structure can be created as a result of random, chaotic behavior. In fact, the gasket can only be created by random behavior. http://serendip.brynmawr.edu/playground/sierpinski.html is a good site to learn more about Sierpinski Gaskets.

Simple Steganography

Submitted by Kenrick on Thu, 10/25/2007 - 17:43.
Oct 25 2007 - 5:43pm
Etc/GMT-8
secretmessage.png

This problem requires that the student know how to display an image, get/set the RGB values from a pixel, and iterate over an image with an if-statement inside the loop. I've used this in my CS1 Java classes and also in a class for non-majors taught once in Python and another time in VB.NET. Of course you can substitute your own image if you wish!

Assignment: Find the secret message

Add to calendar