# Problem: Expectations

So far, we have calculated the probability of an event occurring.
Suppose that we assign numeric values to each possible event,
*e.g.*, an amount of money won if you have a certain hand. We can
then use these probabilities to compute the *average value of an
experiment*, called its *expected value* or
*expectation*.

To formalize this notion, we can create a function \(f : \mathcal{P}(\Omega) \rightarrow
\mathbb{R}\) be an *interpretation function* that takes an
event as input and then produces its numeric “value” as output. If \(p : \mathcal{P}(\Omega) \rightarrow
\mathbb{R}\) is the probability of an event occurring, then the
expected value of the experiment is given by:

\[ \sum_{E \in \mathcal{P}(Q)} f(E) \cdot p(E). \]

In other words, the expectation is the *weighted average* of
all the possible events of the experiment.

Suppose that we draw a poker hand at random and receive the following pay-out depending on the outcome:

- $1 if we draw a pair.
- $10 if we draw a full house.
- $100 if we draw a flush.

If none of these occurrences happen, we

*lose*$3 dollars. Compute the expectation of this game.Now consider our Dungeons and Dragon example again. To hit a monster in combat, the player must first roll \(1d20\) to determine if they hit the monster. They hit the monster if the roll equals to or exceeds the monster’s armor class. If they do hit the monster, they roll a certain number of additional dice to determine the amount of damage dealt to the monster.

Let’s say for the purposes of the problem that the player is equipped with two daggers so they roll \(2d4\) damage if they hit and the monster in question has an armor class of 12. What is the expected amount of damage dealt to the monster by the player in a single attack?

# Problem: Gaming the System

The notion of expectation from today’s reading allows us to ascertain
the *average* of a probabilistic value. One application of
expectation towards practical ends is combating the Gambler’s
Fallacy in the context of gambling games. The Gambler’s Fallacy is
the incorrect belief that if an outcome has not occurred in the past, it
is more likely to occur in the future. This is the gut instinct we might
have that “we are due” for a pay-off if we play a gambling game and not
have won in some time. Or conversely, once we win, that we should back
off because “we used up our luck” and will not win again for some
time.

This reason is, of course, erroneous. Probabilities tell us likelihoods of occurrences, but they don’t mean that we can’t have arbitrary strings of consecutive wins or losses; it is just unlikely for them to occur. Nevertheless, the Gambler’s Fallacy is a powerful psychological trap to fall into and is one of the primary reasons why casinos and lotteries are so lucrative even though it is common knowledge that “the game is rigged” in some way.

The *expected value* of such a game gives us an objective
measure to be able to assess the worth of playing a game without falling
into the Gambler’s Fallacy. If we take a random variable \(X\) to record the *payoff* or
*net profit* for a single play of the game, then:

- A positive payoff means that, on average, we should see a net profit from playing the game. This implies that even though we might experience streaks of wins or losses, we should be confident that if we play the game enough, we will turn a profit.
- A negative payoff means the opposite—we will inevitably
*lose*money if we play the game enough times.

Gambling games create the *illusion* of a high payoff—“You
have a chance of winning a million dollars!”—but the expected value of
your bet is negative even though you put in relatively little money.

For this individual lab, you will design **two variations of a
gambling game**. You may take your inspiration from the simple
dice games we considered in class. Alternatively, you can think about
other simplified versions of casino games
involving playing
cars, slot
machines, lotteries, or others.
Feel free to be creative! If you aren’t feeling creative today, consider
designing a simple dice or lottery (number-guessing) game.

One variation of your gambling game should result in a *positive
payoff* and the other variation should result in a *negative
payoff*. The two variations should arise from tweaking the numbers
of your game in small ways, *e.g.*, changing the payoff for a
particular hand of cards or the amount of money you bet initially. Your
goal in designing this game and its variations is to do your best to
create the illusion of a high payoff in *both situations* so that
the game sounds compelling to play to others, irrespective of the
variations. Tomorrow, you will share *one version* of your game
with your partner and let them decide whether it is ultimately
worthwhile to play the game using the theory of expected value.

In your lab write-up, provide the following:

- Two descriptions of your gambling game, one for each variation. Try to keep it to a paragraph or two of prose and rules. You will share one of these these rule sets with your partner tomorrow.
- Write down the expected payoffs for each game demonstrating that one results in a net profit and the other results in a net loss.