### Analyzing an Unfair Game

In this blog post, I will present an interesting 2 player game and I will discuss the mathematics that I used to determine the expectations for each player. This game is a generalization of the Price is Right spin wheel, in which players take turns spinning the Big Wheel in an attempt to get a sum as close to 100 without going over. I generalize this by picking random numbers in the range $[0,1]$ instead of numbers from the discrete set ${5,10,...100}$. Here is the formal problem statement:
Alice and Bob play a game where they try to get as close to $1$ as possible without going over. Whoever gets closer without going over wins, and Alice goes first. Alice repeatedly gets a random number from $[0,1]$ and adds it to her sum until she is satisfied with her current score or exceeds $1$ (if she exceeds $1$, she loses). Then Bob repeatedly picks random number until he either beats Alice's score or exceeds $1$. Assuming both players play optimally, what is the probability that Alice wins?

Wins: 0
Losses: 0
Score: 0
Computer: 0

### Bob's Strategy

The best strategy for Bob is pretty simple because he knows exactly what he needs to win (the same cannot be said for Alice). Thus, he can continue to ask for random numbers until he either wins or loses. This is the best and only intuitive strategy for Bob.

### Alice's Strategy

The best strategy for Alice is to repeatedly ask for a random number until she has exceeded some threshold, $k$ where $0≤k≤1$. The actual value of $k$ can vary but the important part is that if her current sum is less than $k$, she asks for a new number and otherwise she stays with her current sum. I will solve for the optimal value of $k$ later in this post.

### Simulate Different Strategies

If you get bored of playing the game over and over, you may type in your value for k (the threshold) and run 10000 simulations to see how well that strategy will pay off in the long run.

Threshold (k):
Winning Percentage:

### Finding the Optimal Strategy

Now that I've defined the game and each of the strategies, we are ready to start tackling the fun part - the Math!  Warning: The rest of the blog post is going to contain some fairly advanced mathematics.