# How to catch a cheater with math (math & coding exercise)

This problem is inspired by a game from the Primer YouTube channel.

Your goal is to come up with an algorithm that gives you the highest score in a simple game that you can find here. You achieve this by correctly labeling blobs as fair or cheating.

Game rules:

At each turn, you have three options:

- tell the blob to flip a coin
- label it as fair
- label it as cheater.

You start with 100 coin flips, and each time you flip a coin, you must “pay” one flip.

If you classify the blob correctly, your score increases by one, and you receive 15 bonus flips.

If you classify the blob incorrectly, your score does not change, but you lose 30 flips.

Important information:

- The occurrence of fair and fraudulent blobs is 1:1
- The probability that a fair blob will flip heads is 50%
- The probability that a fraudulent blob will flip heads is 75%

Exercise:

In the interactive notebook, which you can find here, you can implement an algorithm to decide what to do at each turn and test how well this algorithm works.

I hope that no previous programming experience is required for this, and everything is sufficiently explained in the notebook. If not, let me know in the comments.