Unformatted text preview: CSE4/586 (Spring 2009): Homework 2
Due by Feb 3, in class. Consider a coﬀee can containing an arbitrary (but ﬁnite) number of beans. The beans come in 3 diﬀerent 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 diﬀerent 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 suﬃce). II. Fixed Point (12 points) Calculate the ﬁxedpoint of your program. III. Progress (16 points) Give a carefully reasoned argument that your program terminates. IV. Safety (56 points) Is the ﬁnal state determined deterministically by the initial conﬁguration? (Give a yes/no answer) If “no”, give an example of a single initial conﬁguration and two diﬀerent runs from that initial state that lead to diﬀerent ﬁnal states. If “yes”, give the simplest rule you can for predicting the ﬁnal state given an initial conﬁguration. Prove that your rule is correct. 1 ...
View
Full Document
 Spring '09
 qwerty
 Primary color, Initial Configuration

Click to edit the document details