hw2 - CSE4/586(Spring 2009 Homework 2 Due by Feb 3 in class...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSE4/586 (Spring 2009): Homework 2 Due by Feb 3, in class. Consider a coffee can containing an arbitrary (but finite) number of beans. The beans come in 3 different colors: red, green, and blue. You are asked to perform the following action repeatedly (ie., over and over as long as possible): Reach into the can and pick two random beans. If the beans are the same color, throw them both out. If they are different colors (eg., red and green), throw them both out and add a bean of the third color (eg., blue) to the can. I. Program (16 points) Write the simplest program you can that represents this “computation”. (3 variables should suffice). II. Fixed Point (12 points) Calculate the fixed-point of your program. III. Progress (16 points) Give a carefully reasoned argument that your program terminates. IV. Safety (56 points) Is the final state determined deterministically by the initial configuration? (Give a yes/no answer) If “no”, give an example of a single initial configuration and two different runs from that initial state that lead to different final states. If “yes”, give the simplest rule you can for predicting the final state given an initial configuration. Prove that your rule is correct. 1 ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online