Computer Science Canada missionaries and cannibals |
Author: | Tubs [ Tue Feb 12, 2008 12:23 pm ] |
Post subject: | missionaries and cannibals |
Quote: In the missionaries and cannibals problem, three missionaries and three cannibals must cross a river using a boat which can carry at most two people, under the constraint that, for both banks, if there are missionaries present on the bank, they cannot be outnumbered by cannibals (if they were, the cannibals would eat the missionaries.) The boat cannot cross the river by itself with no people on board.
I have so far developed a program in Prolog to solve this problem, but the question requires that the program solve for all possible solutions. My first idea was to record the first solution and check that the next solution isn't identical to the first, but would this not just incur an infinate loop when the program restarts? I am a total noob at Prolog and the prof is sub-par, does anyone have any suggestions? I can provide code if necessary. |
Author: | Tubs [ Wed Apr 09, 2008 10:25 am ] | ||
Post subject: | Re: missionaries and cannibals | ||
Well, since this got no responses I can assume there is little working knowledge of prolog around. Hence: the solution!
|