What are the probabilities in this particular spin-off of BlackJack

A few of my friends are playing on a gaming server where this game exists. I was curious about the probabilities in it but i was unable to derive them. Any help would be MUCH appreciated. Note: For this problem, please assume that /dice is absolutely random. It is generated by a computer using a pseudo random code but i would appreciate it if that didnt work its way in here.

As for the game itself, here is how it works, there are two people who play the game, The Player and The Dealer.

As the game begins, the player uses /dice as many times as he wants(Each /dice has 6 outcomes which have absolutely equal chances). The player then dices as many times as he wants but his total must not go over 21.

For example when the total reaches 19, it would be a good choice to stop. If he gets 22, 23 or so on then he automatically loses.

Once he has "stayed" at a particular amount the dealer then rolls. His aim is to ensure that he gets a number higher than the player. If he succeeds, he wins. If he trips and gets 22, 23 or so on then he loses.

Now what is the probability that the dealer will win? What is the probability that the player will win? On a average game what is the probability of a 21 being rolled.

-
Just to be clear, that unless the the player went bust, the dealers strategy is always to roll until he has higher number then the player so that ties are impossible? (so that if the players rolls 21 the dealer always loses) – Shard Jan 20 '13 at 13:54
What's the significance of the slash in front of "dice"? – joriki Jan 20 '13 at 14:18
What do you mean by "On a average game what is the probablity of a $21$ being rolled."? How does this differ from "what is the probablity of a $21$ being rolled?"? – joriki Jan 20 '13 at 14:40
1 - In case of a tie, the player re-rolls. I am sorry i forgot to mention that. 2- / signifies a command, i should of probably mentioned that. 3 - Both are one and the same, my bad again :/ – Aayush Agrawal Jan 20 '13 at 18:25

With Shard's notation, the probability that the player wins if she rolls until she has at least $b$ is

$$p_b=\sum_{a=b}^{21}\sum_{c=22}^{a+6}p(a,b)p(c,a+1)\;,$$

and she will choose $b$ to maximize this. Here's code that calculates these probabilities using Shard's recurrence:

$$\begin{array}{c|c} b&p_b\\\hline 16&0.28518\\ 17&0.39679\\ 18&0.47400\\ 19&0.49650\\ 20&0.44231\\ 21&0.28597\\ \end{array}$$

Thus the player should roll until she has at least $19$, and then her winning probability is very nearly even. The probability that she rolls $21$ is $p(21,19)\approx0.19091$, and the probability that the dealer rolls $21$ is $p(19,19)p(21,20)+p(20,19)p(21,21)\approx0.13597$, for a total of about $0.32689$.

-
I am not very accurate with high level math(13 years old, just learnt 2 variable algebra).What i dont get is why are the probablities that the dealer rolls a 21 different than the players rolling a 21? The dice is fair to both ends right? Also the table describes the probablity of landing on any of those numbers but it doesnt mention the chances of a bust. I am sorry but i am a bit confused :/ – Aayush Agrawal Jan 20 '13 at 18:30
Also the probablity of rolling a 21 is given thx but what are the probablities of any random game being won by the player or the dealer? – Aayush Agrawal Jan 20 '13 at 18:34
@Aayush: I think you misunderstood the table. The probabilities $p(a,b)$ that Shard introduced are the probabilities for landing on $a$ if you keep rolling until you have at least $b$. The probabilities $p_b$ that I introduced are not probabilities for landing on any particular number; they're winning probabilities, which I believe is what you asked for. The table shows that the highest winning probability is achieved if the player rolls until she has at least $19$. I'll explain it in more detail later if I find the time. – joriki Jan 20 '13 at 21:00
@Aayush: If the player rolls until she has at least $b$, she might win if she ends up with anything from $b$ to $21$. That's reflected in the first sum in the equation, where $a$ is the number she ends up with and the probabilities for these cases are $p(a,b)$. Then the dealer will roll until he has at least one more than $a$ (that's the second argument in $p(c,a+1)$), and the player will win if he ends up with anything from $22$ to $a+6$ -- that's reflected in the second sum and in the first argument of $p(c,a+1)$. Summing over all these cases yields the probability for the player to win. – joriki Jan 20 '13 at 22:39
@Aayush: Note that this answers the question as originally posed, not the one as modified in your comment under the question. Regarding the probabilities of rolling a $21$: It's not the dice that cause the difference in these probabilities, but the different roles of the player and the dealer. They play with different targets, $b$ and $a+1$, respectively, and the dealer's target $a+1$ depends on the player's result $a$. If they'd play with the same target, they'd have the same probability of hitting $21$. – joriki Jan 20 '13 at 22:42

Each players turn can be described by a set of probabilities based on the "sticking number" $b$ they choose which is the lowest total number at which they will stop rolling the dice. The dealer always picks $b=n+1$ where $n$ is the score the player got to try and beat them. The player has a more tricky decision which will be based off what the probabilities are of him winning after sticking vs the probability of immediately going bust.

Let $p(a,b)$ be the probability that the the total = $a$ given we keep rolling until the total is $\ge b$. Clearly $p(a,b)=0$ if $a<b$ as we are supposed to keep rolling until $a\ge b$. Also $p(a,b)=0$ for $a>=b+6$ since a single roll of the die cannot take us from a number less then $b$ to one greater then or equal to $b+6$.

Also if we choose $b=1$ then clearly we stop after our very first roll and so $$p(1,1)=p(2,1)=p(3,1)=p(4,1)=p(5,1)=p(6,1)=\frac16$$ Now let us consider $b=2$. After our first roll we would only choose to roll again if we rolled a one, and so we end up with

$p(2,2)=p(3,2)=p(4,2)=p(5,2)=p(6,2)=\frac16+\frac1{6^2}$ and $p(7,2)=\frac1{6^2}$

In general we end up with the recurrence relation $$p(a,b)=p(a,b-1)+\frac{p(b-1,b-1)}6$$ where $b\le a\le b+5$ and zero for other values of $a$.

It should be easy to calculate the table of probabilities up to $b=21$, and thus work out the chance the dealer wins given that the player "stuck" on a certain number. Knowing these probabilities the player can now decide their own sticking number by working out if the chance of going "bust" on the next roll is less then the chance they would lose anyway by "sticking" and letting the dealer play.

-