Change w output when only one class is possible
This commit is contained in:
parent
a18cd5ef8d
commit
a97a4cfa08
1 changed files with 13 additions and 4 deletions
17
app/Main.hs
17
app/Main.hs
|
|
@ -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 ()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue