Hangman 0.1.0.1 → 0.1.0.2
raw patch · 2 files changed
+6/−6 lines, 2 files
Files
- Hangman.cabal +1/−1
- Hangman.hs +5/−5
Hangman.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: Hangman-version: 0.1.0.1+version: 0.1.0.2 synopsis: The classic game of Hangman. description: With a number of guesses you must figure out the hidden word! homepage: https://github.com/lf94/Hangman
Hangman.hs view
@@ -7,10 +7,10 @@ data Letter = Hidden Char | Guessed Char -- | Represents a word made up of letters.-type Word = [Letter]+type AWord = [Letter] -- | The state of the Hangman game. -data HangmanState = HangmanState Word (Int,Int) [Char]+data HangmanState = HangmanState AWord (Int,Int) [Char] -- | The start of the game. hangman :: String -> Int -> IO ()@@ -48,7 +48,7 @@ putStrLn $ "Guessed:" ++ (show guessed) -wordToString :: Word -> String+wordToString :: AWord -> String wordToString = (fmap letterToChar) letterToChar :: Letter -> Char@@ -63,7 +63,7 @@ checkGuess c x = x -- | Determine if we've reached the end of the game.-endGame :: Word -> (Int,Int) -> Bool+endGame :: AWord -> (Int,Int) -> Bool endGame word (guess,guesses) | complete word = True | guess == guesses = True@@ -71,7 +71,7 @@ -- | Determine if the word is completely guessed.-complete :: Word -> Bool+complete :: AWord -> Bool complete = all isGuessed isGuessed :: Letter -> Bool