From UBC Wiki


Authors: Sophia Shi

What is the problem?

A game inspired by Bulls and Cows. Where a unknow sequence of 5 lights are lit up and the goal is to guess the color of each light. Lights are of color Red, Green, Blue, Yellow, Orange or Purple.

What is the something extra?

The program generates a random sequence of color each time. Each time when the player makes a guess, the program will show the number of correct lights (both color and position) as well as the number of miss-placed colors.

What did we learn from doing this?

It is very difficult to convert between a and IO a in Haskell. Thus the most challenging part is to work with System.Random.

Haskell is unable to handle "if" without "else" so I have to find my way around it with a loop.

Links to code etc