[Haskell-cafe] Simple game: a monad for each player
Philippa Cowderoy
flippa at flippac.org
Sat Apr 10 10:11:55 EDT 2010
On 10/04/2010 13:57, Yves Parès wrote:
> I answered my own question by reading this monad-prompt example:
> http://paste.lisp.org/display/53766
>
> But one issue remains: those examples show how to make play EITHER a human
> or an AI. I don't see how to make a human player and an AI play SEQUENTIALLY
> (to a TicTacToe, for instance).
>
>
Make them polymorphic - the human player in any MonadIO, the AI player
in any monad. Then run them both in the same monad, with some kind of
wrapping function around the calls setting a context for the appropriate
player.
--
flippa at flippac.org
More information about the Haskell-Cafe
mailing list