[Haskell-cafe] Re: Newbie: Project: Missionary and Cannibal
[Contd].
thapaps at gmail.com
thapaps at gmail.com
Tue Jan 16 23:35:59 EST 2007
thank you very much for all your Help. I am finally able to do something (O:
I watched the video presentation from Edsge W. Dijkstra. It is very helpful.
thank you once again for providing me the link.
I am trying to call a function and print a message.
moveLoadR :: Int -> Int -> (IO ()-> a)
moveLoadR m c | m==0 && c==0 = moveEndR $ putStrLn "END"
| otherwise = moveLoadR (m-1) (c-1) $ putStrLn
"Starting Missionary and Cannibal Game.\nLeft Bank: Missionary=3:Cannibal=3:
Moving From: Left ===> Right: Missionary=1 Cannibal=1 \n"
moveEndR :: (IO ()->a)
moveEndR = putStrLn"END OF Solution" <<< === THIS IS INCORRECT.
I tried doing this . but it will take me to the infinite Loop.
moveEndR :: (IO ()->a)
moveEndR = moveEndR $ putStrLn"END OF GAME"
Any help in this would be greatly appreciated.
.
On 1/16/07, Paul Johnson <paul at cogito.org.uk> wrote:
>
> This is presumably your homework. See
> http://www.haskell.org/haskellwiki/Homework_help
>
> This kind of problem is often solved by using the List monad, so try
> looking at that first.
>
> Failing that, have a list of moves to make a sequence. Then make a list
> of all possible sequences. Then filter out the ones that break the
> rules. Whatever is left is the answer you want.
>
> Paul.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070116/e954fa3d/attachment.htm
More information about the Haskell-Cafe
mailing list