Copyright | >implying |
---|---|
License | >implying |
Maintainer | Florian Hageneder |
Stability | none |
Portability | what? |
Safe Haskell | Safe |
Language | Haskell2010 |
Word
Description
- placeholder :: Char
- type SolutionWord = [(Char, Bool)]
- createSolutionWord :: String -> SolutionWord
- tryChar :: Char -> SolutionWord -> Bool
- solveChar :: Char -> SolutionWord -> SolutionWord
- solveWord :: String -> SolutionWord -> (Bool, SolutionWord)
- showSolution :: SolutionWord -> String
- isPlayable :: SolutionWord -> Bool
Documentation
placeholder :: Char Source #
Placeholder for unsolved chars in solution
type SolutionWord = [(Char, Bool)] Source #
Solution of a Hangman game. Unguessd chars are marked with a False.
Arguments
:: String | String to play with |
-> SolutionWord | Solution to create a game with |
Creates a SolutionWord from a given String
>>>
createSolutionWord "abc"
[('a', False), ('b', False), ('b', False)]
Arguments
:: Char | The char the player played |
-> SolutionWord | The word that is being played3 |
-> Bool | wether guessed char was right |
Checks if a given char is in the word.
>>>
tryChar 'a' "Hangman"
True
Arguments
:: Char | Char that player tries to add |
-> SolutionWord | Current game state |
-> SolutionWord | New state of progress |
Applys a guess on the solution.
>>>
solveChar a [('a', false), ('b', true)]
[('a', True), ('b', True)]
Arguments
:: String | String to compare with the solution |
-> SolutionWord | Solution to check against |
-> (Bool, SolutionWord) | (if it was successfull, new State of the solution word) |
Checks of the given word matches the solution.
>>>
solveWord "ab" [('a', False), ('b', False)]
(True, [('a', True), ('b', True)])
Arguments
:: SolutionWord | SolutionWord to show |
-> String | Stringified version of the solution |
Converts a solution into a String
>>>
showSolution [('a', True), ('b', False)]
"a_"
Arguments
:: SolutionWord | Word to check |
-> Bool | Wether the word is still playable |
Checks if there are unknown chars in a solutionWord left.
>>>
isPlayable [('a', True)]
False