# Course:CPSC312-2016-Project2-Over-Under

## Over Under

Authors: Hai Hoang, Michael Wagler, Yves Chan

### What is the problem?

- We would like to make a card guessing game called over under

#### Rules

1. Specify who goes first
2. A card is revealed, player has to determine if the next card is over, under, or equal
3. Another card is revealed, and if the player guesses correctly, they get a score of 1
4. Next player then guesses if the next card is over, under or equal, and gets scored if they guessed correctly
5. First person to 5 points wins

#### Other rules

1. If the deck runs out, then player with highest score wins

### What is the something extra?

We will be implementing an AI with 2 difficulty settings: easy and hard. We will also allow for player vs. player interactions.

1. Hard AI will make the best guess based on probability of cards that can show
2. Easy AI makes guesses randomly

### What did we learn from doing this?

Our game is designed for a person to play against a computer. The computer has two modes: simple and optimal. The game itself is quite simple: a random card from the deck is flipped and the player has to decide if the next card is over, under, or the same value as the card shown. Each time a card is flipped, that card is removed from the deck so the deck shrinks over time. The game continues until one player reaches 5 points or until the deck runs out. The computer's simple mode will randomly choose an answer, whereas the optimal mode keeps track of all the cards that has been played and will choose the optimal solution based on the maximum probability of the next card value being over, under, or the same. This optimal computer logic is our something extra that we were able to successfully complete.

We learned that random is difficult to work with in Haskell, especially because we were not able to type cast it. We had to understand IO in order to pass through our list of random integers to use for our calculations. We also learned about data structures and types which we previously had no knowledge of. This significantly helped us further understand Haskell syntax and allowed us to get hands-on experience with World and IO.