[Haskell-cafe] Re: Hangman game
gale at sefer.org
Tue Jan 22 09:41:02 EST 2008
Ronald Guida wrote:
>> For a Hangman game, the only time I need to change the probability
>> distribution is if I load a new word list. If I wanted to be able to
>> load a new word list, then perhaps I need to carry the word list
>> inside the GameState as well?
Achim Schneider wrote:
> What about carrying a list of Strings inside the State?
Right, I think you need that if the word list can be reloaded,
or selected at run time.
> Write a RandomGen and Random instance that return some
> dictionary file in random order.
Whoa, I don't think we need to go that far. But good idea
to extract out selecting the random word into a separate
function. Later on you may want to change how that works,
e.g., you may use larger word lists and switch to reading
the word each time from a file. So this function should
return the word in your monad.
Changing the probability distribution sounds like a stretch,
I can't think of too many games where you would ever want
to do that at run time. In a game with real-time feedback,
you may want to fiddle with the generator for speed reasons.
More information about the Haskell-Cafe