TAMS / Java / Hades / applets: contents | previous | next | ||||
Hades Applets contents visual index introduction std_logic_1164 gatelevel circuits delay models flipflops adders and arithm... counters LFSR and selftest memories programmable logic state-machine editor counter counter with... counter up-down counter up-d... man-wolf-goa... branch-predi... stack contro... traffic ligh... RS232 transm... misc. demos I/O and displays DCF-77 clock relays (switch-le... CMOS circuits (sw... RTLIB logic RTLIB registers Prima processor D*CORE MicroJava Pic16 cosimulation Mips R3000 cosimu... Intel MCS4 (i4004) image processing ... [Sch04] Codeumsetzer [Sch04] Addierer [Sch04] Flipflops [Sch04] Schaltwerke [Sch04] RALU, Min... [Fer05] State-Mac... [Fer05] PIC16F84/... [Fer05] Miscellan... [Fer05] Femtojava FreeTTS | man-wolf-goat-cabbage problem
Circuit Description
A demonstration of the (famous) man-wolf-goat-cabbage problem,
modelled and solved via a finite state machine.
The idea is taken from my German edition of the Hopcroft-Ullmann
classic Introduction to Automata Theory, Languages, and Complexity.
As such, the German naming convention
(Z for 'Ziege'='goat') and (K for 'Kohl'='cabbage') has been used.
The problem is stated as such: A man (M) has got a wolf (W), a goat (Z) and a cabbage (K). He wants to cross a river in his boat, which is so small that he can either go over alone (M) or carry at most one of the (W,Z,K) with him. Naturally, when unobserved, the wolf will eat the goat, and the goat will eat the cabbage. Is there a sequence of boat movements that allows the man to transfer all three items across the river? Please open the state-machine editor (popup-menu, edit) to see solution for the problem modelled as a finite state machine. This is actually a complete solution of the problem that covers all possible sequences of boat movements, including the infinitely many suboptimal sequences which contain useless loops.
The name of each state encodes the current situation,
with the items on the left and right bank of the river
separated by a minus sign.
For example, the state name Click the input switches or type the 'c' and 'm','w','z','k' bindkeys to control the clock input and select the four possible transitions. Note that only one of the four 'm','w','z','k' inputs should be selected, but that is not enforced by the circuit. It would have been possible to auto-generate the clock pulses from the input switches for easier typing, but the realization shown here allows you to see the active transition during the simulation, which makes solving the problem much easier.
| |||
Print version | Run this demo in the Hades editor (via Java WebStart) | ||||
Usage | FAQ | About | License | Feedback | Tutorial (PDF) | Referenzkarte (PDF, in German) | ||||
Impressum | http://tams.informatik.uni-hamburg.de/applets/hades/webdemos/45-misc/05-fsm-editor/mwzk.html |