Change w output when only one class is possible

This commit is contained in:
Joscha 2018-09-20 18:32:17 +00:00
parent a18cd5ef8d
commit a97a4cfa08

View file

@ -97,10 +97,19 @@ cmdStats = do
cmdWhat :: Console () cmdWhat :: Console ()
cmdWhat = do cmdWhat = do
g <- lift get g <- lift get
let next = nextGuesses g let showWords = intercalate ", "
showWords = intercalate ", " case possible g of
showNextGuess (score, w) = numberjust (show score) ++ ": " ++ showWords w [ws] -> do
mapM_ (H.outputStrLn . showNextGuess) next let guesswords = map (\(Guess w _) -> w) $ filter (\(Guess w n) -> n == length w) $ guesses g
possibleWords = ws \\ guesswords
H.outputStrLn "The word is one of the following words:"
H.outputStrLn $ " " ++ showWords possibleWords
H.outputStrLn "These words were already guessed:"
H.outputStrLn $ " " ++ showWords guesswords
_ -> do
let next = nextGuesses g
showNextGuess (score, w) = numberjust (show score) ++ ": " ++ showWords w
mapM_ (H.outputStrLn . showNextGuess) next
H.outputStrLn "" H.outputStrLn ""
loop :: Console () loop :: Console ()