Hello papa,

Sunday, November 29, 2009, 5:11:23 PM, you wrote:

> add some IO on top of it, keeping the main code pure. The idea was to
> write a very simple two-player game, then define some strategies to
> play it that do not involve IO

ho i could do it:

class Strategy state where
  initState :: state
  nextMove :: state -> (Move,state)
  updateState :: (Move,state) -> state

where initState gives initial state,
nextMove returns move and updated internal state
updateState updates state with opponent's move

then you can develop any IO front-end that runs two strategies each
against other


-- 
Best regards,
 Bulat                            mailto:bulat.zigans...@gmail.com

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to