small puzzle programming
- To: mathgroup at smc.vnet.net
- Subject: [mg53857] small puzzle programming
- From: zak <chocolatez at gmail.com>
- Date: Sun, 30 Jan 2005 03:18:21 -0500 (EST)
- Reply-to: zak <chocolatez at gmail.com>
- Sender: owner-wri-mathgroup at wolfram.com
how to code the following puzzle in mathematica programming language:
the shepherd who want to cross a river aboard a boat taking with him
one of the following items (wolf,sheep,grass) one per time,
lst ={S,w,g,p} may describe the group on one side of the river
lst2={} may describe the the current state of the other side of the river.
the pairs {{w,p} ,{p,g}} are not allowed
of course the solution is:
((S,p),(S,w),(S,p),(S,g),(S,p))
but how to code this or may be other ideas.
zak