Skip to content

This is an IO Monad exercise used by Erik Meijer - DelftX: FP101x Introduction to Functional Programming - Haskell

Notifications You must be signed in to change notification settings

ecamalionte/hangman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Hangman

A game for two in which one player tries to guess the letters of a word, and failed attempts are recorded by drawing a gallows and someone hanging on it, line by line. Ps.: The gallows was not implemented.

Example of code written in Haskell

This is an IO Monad exercise used by Erik Meijer - DelftX: FP101x Introduction to Functional Programming

How to play

You will need to install a Haskell compiler. I have used Glasgow Haskell Compiler - ghc

$ ghc hangman.hs
$ ./hangman
Enter a secret word: *******
Try to guess: h
h______
Try to guess: ha
ha___a_
Try to guess: hang
hang_an
Try to guess: hangman
You win!!!

Or

$ ghci
GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
Prelude> :load hangman.hs
[1 of 1] Compiling Main             ( hangman/hangman.hs, interpreted )
Ok, modules loaded: Main.
*Main> main
Enter a secret word: *******
Try to guess: h
h______
Try to guess: ha
ha___a_
Try to guess: hang
hang_an
Try to guess: hangman
You win!!!

TODO

  1. Draw gallows and someone hanging on it.

About

This is an IO Monad exercise used by Erik Meijer - DelftX: FP101x Introduction to Functional Programming - Haskell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published