Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 11. R function Function is a wrapper that allows us to write code in modules Back to Handout Homework: Create a function for drunken sailor –

Similar presentations


Presentation on theme: "Lecture 11. R function Function is a wrapper that allows us to write code in modules Back to Handout Homework: Create a function for drunken sailor –"— Presentation transcript:

1 Lecture 11

2 R function Function is a wrapper that allows us to write code in modules Back to Handout Homework: Create a function for drunken sailor – Inputs: Number of steps, probability for step up – Output: path of the sailor Evaluate the function, print and plot the path – 25 steps with prob.3 and 32 steps with prob.8

3 Counting cards Basic counting rule: – +1 for 2-6 – 0 for 7-9 – -1for 10-A We only start playing when the count becomes high (typically 17)

4 Play movie 21

5 Black jack analysis We will use R to compute the probability of dealer going bust. We use hard 17 stop rule for the dealer. – R code available on the website – R function (from handout)

6 Estimated Results BJbust

7 Homework Modify the R code to use soft 17. – Always stop if 18 or higher – Stop on 17 unless there is A counted as 11 (in which case dealer hit himself/herself) What do you expect to happen?

8 Counting cards Basic counting rule: – +1 for 2-6 – 0 for 7-9 – -1for 10-A We will again use R to compute the probability of dealer going bust. – We only start playing when the count becomes 17 R code available in resource section of sakai

9 Estimated Results – Count +17 Quote from wikipedia: – “Another aspect of the probability of card counting is that, at higher counts, the player's probability of winning a hand is only slightly changed and still below 50%. The player's edge over the house on such hands does not come from the player's probability of winning the hands. Instead it comes from the increased probability of blackjacks, increased gain and benefit from doubling, splitting and surrender, and the insurance side bet, which becomes profitable at high counts.” BJbust Only plain


Download ppt "Lecture 11. R function Function is a wrapper that allows us to write code in modules Back to Handout Homework: Create a function for drunken sailor –"

Similar presentations


Ads by Google