Hangkell-1.0.0: Like Hangman but online!

Copyright>implying
License>implying
MaintainerFlorian Hageneder
Stabilitynone
Portabilitywhat?
Safe HaskellSafe
LanguageHaskell2010

Word

Description

 

Synopsis

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.

createSolutionWord Source #

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)]

tryChar Source #

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

solveChar Source #

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)]

solveWord Source #

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)])

showSolution Source #

Arguments

:: SolutionWord

SolutionWord to show

-> String

Stringified version of the solution

Converts a solution into a String

>>> showSolution [('a', True), ('b', False)]
"a_"

isPlayable Source #

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