Fickle Fruit Solution


The following diagram represents the behavior of the fruit vendor in the Fickle Fruit exercise. Note that we have shortened the descriptions of the states to "HAT" and "NO HAT" to indicate what the vendor is wearing on his/her head. Also, rather than writing out the names of the fruit, we use "a" for apple and "b" for banana so that "a/b" means "asked for an apple, and received a banana."




Frustrating Fruit Solution


Here's the diagram which represents the vendor's behavior in the Frustrating Fruit exercise. There is only one slight difference between this machine and the previous one (the loop transition on the "HAT" state gives a banana instead of an apple)!