**About**

This homework assignment will build gradually towards the pricing of an option in a game scenario.

- It can be used as an interview question for a junior trader position or really any position that requires computational thinking

- Prerequisites:
- basic probability including conditional probability (although you do not need Bayes Thereom, just logic. You will need to do a lot of reasoning the same way you need to turn any involved word problem into math statements)

**Extra Credit: Validate your answer via simulation. I include my Python code.**

## Introduction to the *Snake Eyes Game*

*Snake Eyes Game*

The Snake Eyes game is something my 1st grader plays at school. The rules are simple:

- Roll a pair of dice and record the sum

- Continue until you roll a ‘2’ (but don’t record the ‘2’)

- Your score is the sum of all your rolls

**Example 1**

Your rolls are as follows: [9, 4, 12, 2]

Your score is 9 + 4 + 12 = 25

**Example 2**

Your rolls: [2]

Your score is zero.

We will slowly build until we can price an option struck on your score!

### 10 core questions

How many rolls do I need to be 100% sure I get snake eyes?

**Answer**

Technically infinite

What’s the probability I get snake eyes in my first 5 rolls?

**Answer**

Getting snake eyes or not is a binary event. You either rolled it or you didn’t. The probability of rolling snake eyes is 1/36.

If you roll 2 dice, your sample space of possible rolls is 36 (ie 6 x 6). The sample space:

…so the probability of NOT getting snake eyes is 35/36.

The probability of NOT getting snake eyes 5x in a row is:

(35/36) ⁵ = 86.9%

So the probability of rolling snake eyes in your first 5 rolls is:

P(snake eyes) = 1 - 86.9% =

**13.1%**I’ll bet you I’ll roll snake eyes in my first 30 rolls. Should you take the bet?

**Answer**

No, you should not take the bet.

P(no snake eyes in 30 rolls) = (35/36)³⁰ = 43%

Therefore I have a 57% chance of rolling snake eyes in the first 30 rolls.

How many rolls do you need to be 75% certain you will roll snake eyes?

**Answer**

What’s given:

- P(snake eyes) = 1 - P(no snake eyes)

- P(snake eyes) = 75%

- P(no snake eyes) = 25%

Using the logic from Question#2, we know:

P

**(no snake eyes) = (35/36)ᴺ**where N = # of rolls

Plugging in:

P

**(no snake eyes) = (35/36)ᴺ = .25**Solve for N:

N * ln(35/36) = ln(.25)

N = ln(.25) / ln(35/36) =

**49.2**You need

**49.2**rolls to be**75%**certain you roll snake eyes.Generalize the formula from the solution in question #4 to answer:

“

**How many rolls to be X% sure I get snake eyes?”****Answer**

**N = ln (P(no snake eyes)) / ln (35/36)**

Let’s re-phrase question #3. How many rolls do you need to make betting on snake eyes a fair bet?

**Answer**

We just plug and chug into the equation from question #5:

N = ln (P(no snake eyes)) / ln (35/36)

N = ln (.5) / ln (35/36)

N =

**24.6**If we roll 24.6 times we are 50% to see snake eyes. For the bet to be fair (ie an even money proposition) the roller should get 24.6 rolls.

What’s the expectancy of a dice roll given it's not snake eyes?

**Answer**

The expected value of the sum of a pair of dice is 7.

If we remove the 2 and compute the fair value the dice roll given it’s anything but a 2 then the EV =

**7.143**The enclosed table shows:

“

**How many rolls to be X% sure I get snake eyes?”**for many values of X.

**Answer**

X = confidence in rolling snake eyes in N rolls

Can you put the steps together to determine the mean and median scores when you play the game?

Remember the score is the sum of dice rolls until you roll snake eyes.

**Answer**

**Mean**

On average, we expect snake eyes 1 in 36 rolls. Said otherwise we expect to roll 35 times before getting snake eyes.

If the EV of a non-snake eyes roll = 7.14 (via question #7) then the mean score is:

35 x 7.14 =

**250****Median**

To compute the median, we look at the table to see that our 50% confidence point corresponds to 24.6 rolls.

The median score is:

24.6 x 7.14 =

**175.7**The enclosed table shows:

*Expected scores for a given number of rolls***Answer**

(note: I truncated the number of rolls so if the rolls required was 24.6 I multiplied by 24 when computing the expected score because I wanted the rolls to be an integer for future calcs. This will create a small downward bias to the expected scores for a given probability but you’ll see that it won’t matter)

## Options

This will get a bit more challenging. Thus far our tables have mapped a distribution of scores. We know the mean score is 250 and the median score is 175.

We will now progress towards pricing an option. The 300 strike call!

### 3 option questions

What is the probability the 300 strike call goes in-the-money?

[In the rare but totally welcome case where you don’t know what that means but you are attempting to work through these problems, this is another way of asking:

*how often does a player score above 300*?]**Answer**

**30%**

The case that corresponds to an expected score of 300 corresponds to the 30% of cases where I don’t roll snake eyes in my first 42.7 rolls. So we expect a score of 300

**at least**30% of the time (that 30% represents a cumulative probability of 42.7 rolls or higher)We know how often the call goes in the money from the last question. And we know the payoff of the call at various points in the distribution.

Compute the value of the 300 call.

(I used a table in Excel to work it out)

**Answer**

The value of the call at expiration (ie the end of the game) is:

MAX(0, score - 300)

Which means:

- The call cannot be worth less than 0

- We can compute the theoretical value of the call by the sumproduct of the probability * the payoff.

The trick is we need to turn cumulative probabilities into discrete densities. We know that the call is in-the-money 30% of the time (corresponding to an expected # of rolls of 42.7) but in theory you can end up rolling hundreds of times before seeing snake eyes. In those cases,the score will be much higher than 300.

I broke down the probabilities into small discrete increments.

*A note on discrete vs continuous*

Integrating the area under a distribution curve is the same idea just using calculus to do continuous math. If I’m computing the area of vertical rectangles with a base that’s 1% wide, calculus integration is saying make the base-width approach a limit of zero. The red rectangles in this image from dsearl.org is analogous to the probability densities I’m constructing in the table.

I get a value for the 300 strike call of

**76.6**I hit up a friend who has been trading along-side me for my whole career knowing he likes to nerd out on little puzzles like these. I asked him to compute the call value on his own.
He got

**78.8****Sounds like we have a market! 76.6 bid - offered at 78.8 We will revisit this down below!**In the last question we computed a theoretical value for the 300 call.

Imagine you sell it for $80.

How often do you have a positive p/l?

**Answer**

**~78% of the time**

We already computed that the call goes in-the-money 30% of the time. How often does it go far enough in the money that the buyer covers the $80 premium.

A bit less than 22% of the time the call expires worth $80 or more. So if you sell the call for $80 you expect to win the remaining 78% of the time.

## Simulation

We can validate the theoretical finding by playing the Snake Eyes game a lot. I simulated 10,000 trials in Python.

My code is ugly but you can find it below.

## Code & GIT

`import numpy as np import matplotlib.pyplot as plt import random as random 'define functions' def roll_two_dice(): x= random.randint(1,6) + random.randint(1,6) return x def a_single_play(): trials = [] tally = 0 dice = 0 num_of_trials = 0 avg_roll = 0 while dice !=2: dice = roll_two_dice() trials.append(dice) num_of_trials = len(trials) if dice > 2: tally = tally + dice avg_roll = tally/num_of_trials else: return tally, num_of_trials, avg_roll 'simulation' list_of_tallies = [] list_of_trial_quantities= [] list_of_avg_rolls = [] for i in range(10000): z = a_single_play() list_of_tallies.append(z[0]) list_of_trial_quantities.append(z[1]) list_of_avg_rolls.append(z[2]) 'output arrays used to be examined in Excel' array_tallies = np.array(list_of_tallies) array_trial_quantities = np.array(list_of_trial_quantities) plt.hist(array_trial_quantities, bins = np.arange(200), cumulative = (True)) plt.show()`

Comparing the simulation to the theoretical calcs

The simulation plays the game 10,000 times.

For every game it records:

- The number of rolls before snake eyes comes up.

## Comparing The Number Of Rolls Before Hitting Snake eyes

Spot on! In the simulation, 50% of the time you get to 25 rolls (remember we computed 24.6)

In graph form:

The Python cumulative distribution shows 5,000 out of the 10,000 games played ended at roll 25 as expected.

- The avg of the rolls comprising the total score.

## Was the average non-snake eye roll actually 7.14?

The avg of the “average roll per game” was 6.94.

…but

if we filter out the games where the first roll is snake eyes, the average for the remaining games is

**7.13**- The scores. We can compare the distribution of the scores to what we expect.
- What percent of the scores were greater than 300?
- Average score given that it is greater than 300?
- Call Value from simulation
**The call value in the simulation is worth 77.1**

## What did the simulation think the 300 call is worth?

Rather than just show the score distribution (which is actually a bit redundant once we validated that the avg number of rolls and the average non-snake eyes roll line up to the theoretical) for the theo and simulation, we can look at the value of the call from the simulation.

**Simulation results**

30%

558
This corresponds to an average payoff to the strike of 258 (558-300) when it is in the money.

P(above the 300 strike) x Payoff when above the strike

30% x 258 =

**77.1****In between my 76.6 value and my friend’s 78.8 value!**

*If you use options to hedge or invest, check out the** **moontower.ai** option trading analytics platform*

*If you use options to hedge or invest, check out the*

*moontower.ai*

*option trading analytics platform*