# 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

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

#### Other rules

- 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.

- Hard AI will make the best guess based on probability of cards that can show
- 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.