[Haskell-cafe] Simple game: a monad for each player
limestrael at gmail.com
Sat Apr 10 08:57:28 EDT 2010
I answered my own question by reading this monad-prompt example:
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).
Yves Parès wrote:
> I looked at the operational package (since it seemed simpler).
> I see its interest when building sets of operations.
> I think I see how I could apply it to my current problem. I saw in the
> tutorial the sentence: "The ability to write multiple interpreters is also
> very useful for implementing games, specifically to account for both human
> and computer opponents as well as replaying a game from a script."
> So I'm supposed to write 2 functions, one interpretHuman (running in IO,
> and prompting the user), and one interpretAI (running in Identity)?
> Are there examples of such games using operational?
> Heinrich Apfelmus wrote:
>> Gwern Branwen wrote:
>>> Yves Parès <limestrael at gmail.com> wrote:
>>>> But when running the game, the program cannot "switch" from a player's
>>>> to another.
>>>> Do you have any suggestion?
>>> Your desires remind me of the MonadPrompt package
>>> <http://hackage.haskell.org/package/MonadPrompt>, which IIRC, has been
>>> used in some game demos to provide abstraction from IO/test
>>> harness/pure AI etc.
>> The game demo can be found by chasing links from the package
>> There's also my package "operational"
>> which implements the same concept. It's throughly explained here:
>> Heinrich Apfelmus
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
Live long and prosper
View this message in context: http://old.nabble.com/Simple-game%3A-a-monad-for-each-player-tp28183930p28201834.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe