Turn in one copy for each group. Please turn in both an HTML file and your R Markdown script. This is due Sunday, February 4.

## Lab Overview

For this lab we will focus on writing code for simulations.

The entire lab will be worth 100 points. Clarity of code, including comments and interpretable variables names, along with thoughtful writing with an emphasis on concise interpretations will be worth 10.

## Questions

Answer the following questions in this R Markdown document. Please include code where necessary.

### 1. Roulette Simulation

In class we discussed and wrote a function to simulate a roulette spin. We use a spinner with 38 spots including 0 and 00 as green.

#### b (20 points)

Using this function, compute the probability of rolling a red value. How does this compare to the analytical solution for the probability?

#### d (30 points)

Write a function that takes two arguments, a color (red or black) and a bet amount and returns the earnings. In roulette if you place a $1 on a color, you win$1 if your color is selected. Note: this function will likely call the previous function we specified for Roulette spins.

#### e (20 points)

Simulate a series of 100 $1 bets on red. Assuming you started with$100, how much money do you have at the end of the \$100 bets?

### 2. Black-Jack

#### a. (30 points)

Write a loop to implement a procedure (this does not need to be a function) to estimate the probability of being dealt black-jack (2 cards that total 21). If you are unfamiliar with black jack, wikipedia provides a nice overview.