Frank Rosemeier wrote:

Dear Haskellers,

I would like to implement a board game for a single player in Haskell.
The pieces may be moved one step in any direction if there is no piece next to it,
and the goal is to rearrange the pieces to their home positions.
The Haskell program should find an optimal solution (with minimal number of moves).

Can anybody recommend some helpful libraries for this task?
Any hints are very welcome!
This sounds like a homework problem, so I'll be a bit vague.

This is a job for a combination of the list and state monads. Something of type ListT (State GameState) will probably be important. You just need to define the GameState type and something to give you a list of legal next moves :: GameState -> [GameState].

After that, its trivial.

Paul.
_______________________________________________
Haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to