---
title: "Section 2.2 Practice: Simulation"
author: "YOUR NAME HERE"
output: pdf_document
---

Use simulation to solve the following problems:

# 1. Your department is holding a raffle. They sell 30 tickets and offer seven prizes. They place the tickets in a hat and draw one for each prize. The tickets are sampled without replacement, i.e. the selected tickets are not placed back in the hat. What is the probability of winning a prize if you buy one ticket?



# 1b. What if the tickets are sampled with replacement?



\newpage
# 2. If 100 balls are randomly placed into 20 urns, estimate the probability that at least one of the urns is empty. _Hint: look at the `length()` and `unique()` functions from chapter 1_.


\newpage
# 3. A standard deck of cards has 52 cards, four each of 2,3,4,5,6,7,8,9,10, J,Q,K,A. In blackjack, a player gets two cards and adds their values. Cards count as their usual numbers, except Aces are 11 (or 1), while K, Q, J are all 10. Use R to simulate dealing two cards, and compute these probabilities. 

_Hint, create the deck of cards using their numeric value, not the letters "J", "Q", "K" etc._

## a. A **blackjack** means getting an Ace and a value ten card. What is the probability of getting a blackjack?



## b. What is the probability of getting 19? Assume that an Ace counts as 11?


\newpage
# 4. Deathrolling in World of Warcraft works as follows: Player 1 tosses a 1000 sided die. Say they get $x_{1}$. Then player 2 tosses a die with $x_{1}$ sides on it. Say they get $x_{2}$. Player 1 tosses a die with $x_{2}$ sides on it. This pattern continues until a player rolls a 1. The player who loses is the player who rolls a 1. 

## a. What is the probability a 1 will be rolled on the 4th roll in deathroll? 



## b. What is the probability that the second person will loose? 



