10/03/2006

A student wrote (last Thursday, so maybe it is all clear by now):

I was having trouble with #3 of the problem set because it only makes a
transition after you push the button.  You can't have an arc going from
"output soda" to "no money in machine" because you wouldn't push a
button after you get a soda.  Does that mean we need 5 states of "no
money" that you go straight to when there is more than 35 cents in
the machine? (I hope that was clear.) Thanks!

<<no signature, either>>

By now, this may be all clear, but just to be sure: Certainly, we could post
a sign on the coke machine saying push the button before starting the process
of inserting coins.  But I agree, that is a little unnatural.

So, as the solution sheet states:

1. You need five final states to dispense a coke + either 0,5,10,15,20 cents
change.  From each of the final states, the first coin for the next coke
takes you to the 5cents inserted, 10cents inserted, or 25cents inserted,
depending on whether that first coin was a nickel, dime, or quarter.

2. You never go back to the initial state.

One more thing, while I have your attention.  I want to be sure you
understand the correspondence of the button with a clock.  You are in
a state (say, 20cents inserted) and you have an input (say you put a dime
in the machine).  When you push the button, it is just like the clock
taking you to the next cycle.  The next state is 30cents in the machine.
The state is associated with how much money is in the machine.  That
combined with the input (coin inserted) takes you to the next state AFTER
the button is pushed.

Good luck on the exam.

Yale Patt