Haskell Cardguess Game

前端 未结 2 1710
鱼传尺愫
鱼传尺愫 2021-01-27 04:17

I am writing a Cardguess Game, where user sets the answer and lets the PC guess. For my project, the input card number is 2.

Then, I need to write the cardguess algorit

2条回答
  •  执笔经年
    2021-01-27 04:47

    Hard to read your mind here, but maybe you want something like this:

    startGuessing guesses state = do
      feedBack <- readFeedback
      let (newGuess, newState) = nextGuess (guesses, state) feedback
      startGuessing (guesses ++ newGuess) newState
    
    main = do
      let (guesses, state) = initialGuess 2      
      startGuessing guesses state
    

提交回复
热议问题