
Okay for IA, which doesn't need any special monad, but what if I want to make a network player ? It would have to run in a State monad, accessing to IO, storing a ByteString. For instance, (Monad m) => StateT ByteString m. The ByteString is a lazy one, we read from it to get the data sent by the real player through the network. Then, if I want to have a human an a network player playing sequentially, how can I do this without stacking each player's monad? (See my first mail) Philippa Cowderoy wrote:
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@flippac.org _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
----- Yves Parès Live long and prosper -- View this message in context: http://old.nabble.com/Simple-game%3A-a-monad-for-each-player-tp28183930p2820... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.