Skip to content

Latest commit

 

History

History

guesscolor

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Guess the Color

This Haskell tiny game implements a color guessing game. How well do you know your colors? Guess RGB values for the displayed color!

How to Play

Download the source files:

$ git clone https://github.com/haskell-game/tiny-games-hs.git
$ cd hackage/guesscolor

With Stack installed, execute the game:

$ ./guesscolor.hs

After the game builds, it should open a window. In the terminal, enter space-separated RGB values (0-255) for the color in the window and press enter:

180 180 220

The game displays the actual RGB values and your score, from 0 (terrible guess) to 100 (excellent guess):

Actual color: 168 195 233
Score: 94

Notes

  • There is no error handling. The program exits with an error if the input is not correct, for example.
  • There is no input validation. It is up to the player to input RGB values within the correct range.
  • If you press escape in the color window, the game exits.
  • A comment on line 1 breaks some parsers, so I used a Haskell comment on line 4 instead.