Thread Rating:

Wizard
Administrator
Wizard
  • Threads: 1491
  • Posts: 26435
Joined: Oct 14, 2009
August 10th, 2012 at 4:08:30 PM permalink
Recently I purchased the book The Mathematics of Poker by Bill Chen and Jerrod Ankenman. It has a lot of math exercises of simplified versions of poker to try to get at the essence of the game. Here is a problem along those lines that I made up.

  • Player X and Y each ante $1.
  • Both are given a random number uniformly distributed from 0 to 1. The higher number wins.
  • Player X may bet $1 or check.
  • If player X checks then Y is forced to check.
  • If player X bets then Y may call or fold.


What is the optimal strategy for both players? What is the expected value for X under mutual optimal strategy?

If sufficient interest is show in this exercise, then problem 2 will be the same, but allow Y to bet after a check, after which X can call or fold.
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
ewjones080
ewjones080
  • Threads: 33
  • Posts: 456
Joined: Feb 22, 2012
August 10th, 2012 at 5:03:30 PM permalink
I would imagine the best strategy for player X is to raise with a score higher than 0.5 and check anything else.

Then I would imagine the best thing for player Y is to call with anything .75 or higher, and fold the rest. Well assuming he knows that player X is playing with optimal strategy above. But then after throwing in the Ante's it probably changes the strategy right?

I'm too lazy to try to work out the math, since I'm sure I wouldn't get it right anyway.
ChampagneFireball
ChampagneFireball
  • Threads: 16
  • Posts: 118
Joined: May 2, 2010
August 10th, 2012 at 5:10:46 PM permalink
I would guess off the top of my head that X should raise a percentage of the time equal to his number. If he got .73, he should raise 73% of the time. This should throw off Y enough to not be able to determine X's hand.

But actually, that sounds like X could raise with 0.01 and really no chance to win or not raise with 0.99 and really no chance to lose. So maybe X should raise a percentage of time equal to (Value+1)/2 min 0% max 100%.
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
August 10th, 2012 at 6:24:22 PM permalink
I really like the idea of this game.. actually I have no experience with poker math at all, but if I get this right on this try, I might be interested in a purchase of the book.

My first ansatz for this game would be as followed (tried to make it as general as possible):
Player X will bet with probability b(x), where x is X's random number of distribution p(x) (check otherwise).
Player Y will call with probability c(y), where y is Y's random number of distribution p(y) (fold otherwise).
Both players know this strategy, especially each one knows both b(x) and c(y).

The expectation EVX for player X would be EVX = int dxdy p(x) p(y) [ $2 * b(x) * c(y) * (x>y) - $2 * b(x) * c(y) * (x<y) + $1 * b(x) * (1 - c(y)) + $1 * (1 - b(x)) * (x>y) - $1 * (1 - b(x)) * (x<y)].
The expectation EVY for player Y would be EVY = int dxdy p(x) p(y) [ $2 * b(x) * c(y) * (y>x) - $2 * b(x) * c(y) * (y<x) + $1 * (1 - b(x)) * (y>x) - $1 * (1 - b(x)) * (y<x) - $1 * b(x) * (1 - c(y)) ]

Here the symbol (a>b) is 1 if a > b, 0 otherwise. Hence (a>b) + (a<b) = 1.
The uniform probabilies p(x) and p(y) are constant, let's see how far I will get with this ansatz.

Player Y choses a strategy c(y) such that - for a given X's strategy b(x) - it will maximize EVY.
So the functional derivative must vanish (for every point y0)
0 = ðEVY / ðc(y0) = int dx p(x) p(y0) [ $2 * b(x) * (y0>x) - $2 * b(x) * (y0<x) + $1 * b(x)]
or 0 = $2 * int_0^y0 dx p(x) * b(x) - $2 * int_y0^1 dx p(x) * b(x) + $1 int dx p(x) * b(x)
Inserting this back into EVY(all c-linear terms vanish in the integral):
EVY = int dxdy p(x) p(y) ($1 * (1-b(x)) * ((y>x) - (y<x)) - $1 b(x) )

For any (consistent) strategy EVX + EVY = 0, so player X choses his strategy b(x) to maximize EVX:
EVX = - EVY = int dxdy p(x) p(y) ($1 * (1-b(x)) * ((y<x) - (y>x)) + $1 b(x) )
Maximum for
0 = ðEVX/ðb(x0) = int dy p(y) p(x0) $1 * ( (y>x0) - (y<x0) ) + $1 * p(x0)
Again inserting that back into EVX:
EVX = int dxdy p(x) p(y) $1 * ( (y<x) - (y>x) ) = 0.

Hm.... for mutual optimal strategy I get EVX = EVY = 0. Such a stragey would be to always check. Maybe I'm missing something (i.e. I didn't take into account that b(x) and c(y) are between 0 and 1.). I will try again tomorrow (or maybe someone can give a hint ...)

Edit:
Some thoughts about the exercise setting itself. I could guess that this exercise should serve an educational example on poker play. Information asymnetry would suggest that player Y holds a positional advantage (since he is to act last). However if Y systematically refuses to bet or raise on his position - he cannot use that advantage.
dwheatley
dwheatley
  • Threads: 25
  • Posts: 1246
Joined: Nov 16, 2009
August 10th, 2012 at 8:24:24 PM permalink
If X checks, he wins with probability equal to his number, x. The EV of this decision is 2x (the money in the pot is a sunk cost).

X should bet whenever the EV of betting is greater than 2x. This depends on Y's strategy. So we consider what Y does with his number y in response to a bet. Folding is 0 EV, calling is -1 + 3*p(winning). The p(winning) depends on y, and the conditional distribution of x given that X bets.

But it's bed time where I live, so maybe tomorrow.
Wisdom is the quality that keeps you out of situations where you would otherwise need it
Wizard
Administrator
Wizard
  • Threads: 1491
  • Posts: 26435
Joined: Oct 14, 2009
August 11th, 2012 at 8:41:26 AM permalink
MagnoJ at least gets points for the best effort thus far, but nobody has produced what I (perhaps incorrectly) think is the right answer.

As a hint, I don't think randomizing is necessary. That is more appropriate for games with discrete possibilities. For example I asked a similar question to this, but with a three-card deck earlier, which entailed a random strategy for the lowest card.
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
Boney526
Boney526
  • Threads: 8
  • Posts: 366
Joined: Sep 25, 2011
August 11th, 2012 at 9:12:48 AM permalink
I don't have time to even attempt to solve this, but here's a general hunch.

Because Player X will control the action (whether there's betting, or not) you'd obviously always want to bet with higher hands, but you'd also want to throw in enough very low hands that will almost always lose if you check.

EG: If you have .00, you're going to lose by checking. But if you bet, there's a chance you'll win if they fold, so you have more equity by betting, as long as Player X folds at least 33% of the time. (There is 2 dollars in the pot already from the antes, your dollar makes it 3%, and if they fold 1/3 of the time, then your EV is 1 dollar for betting, rather than 0 dollars for checking.) I don't have time to find what the proper ranges would be.

It also seems to me that "optimal strategy" would be impossible, since each players optimal strategy would be based off the other players current strategy. In other words, because player Y's optimal strategy is going to based off of what Player X's strategy is, it could change. (although I guess that's more accurate in actual Poker)
bigfoot66
bigfoot66
  • Threads: 54
  • Posts: 1582
Joined: Feb 5, 2010
August 11th, 2012 at 9:20:45 AM permalink
My gut says that the first player should always raise.
Vote for Nobody 2020!
JB
Administrator
JB
  • Threads: 334
  • Posts: 2089
Joined: Oct 14, 2009
August 11th, 2012 at 11:29:19 AM permalink
I have a feeling it's wrong, but here is my guess:

Player X should bet with 0.0625 or higher, otherwise check.
Player Y should call with 0.25 or higher, otherwise fold.
Wizard
Administrator
Wizard
  • Threads: 1491
  • Posts: 26435
Joined: Oct 14, 2009
August 11th, 2012 at 12:12:39 PM permalink
Quote: JB

I have a feeling it's wrong, but here is my guess:



I disagree. Click the spoiler button for details.

If X checks on 0.0625 I show that the optimal strategy for Y would be to fold with 19/64 or less, assuming X raised.
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
JTate503
JTate503
  • Threads: 1
  • Posts: 7
Joined: Mar 3, 2012
August 11th, 2012 at 3:08:39 PM permalink
Error made.
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
August 11th, 2012 at 4:01:15 PM permalink
I'm not entirely sure that a fixed threshold bet/call strategy will perform better than a strategy involving a random element about the bet or call decision.
Wizard
Administrator
Wizard
  • Threads: 1491
  • Posts: 26435
Joined: Oct 14, 2009
August 11th, 2012 at 4:42:44 PM permalink
Quote: MangoJ

I'm not entirely sure that a fixed threshold bet/call strategy will perform better than a strategy involving a random element about the bet or call decision.



I've been wrong before, but I'll post what I think the answer is tomorrow. I would challenge anybody to produce a better strategy for either player to go against my strategy.
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
JTate503
JTate503
  • Threads: 1
  • Posts: 7
Joined: Mar 3, 2012
August 11th, 2012 at 4:53:17 PM permalink
Here is my answer:



Player X should raise if the number is below 0.1 or above 0.7
Player Y calls if number is above 0.1
Expected Value for player X is 0.1

charliepatrick
charliepatrick
  • Threads: 39
  • Posts: 2946
Joined: Jun 17, 2011
August 11th, 2012 at 6:53:19 PM permalink
I get the same answer = here's my method and btw I guessed the right answer after 6f as it made the maths simpler, before proving it!

(1) Firstly if X checks then it's a 50% game
(2) Secondly if X always bets then Y will call with .25+ (as stands to lose $1 vs gain $3)
(2 a) Hence bad strategy for X to "always" bet.
(3) From above it can be seen Y should always call any bet with expected chance of winning is 25% or more
(4) Is it worth X bluffing ??
(4 a) Sometimes wins pots which he should lose
(4 b) Sometime gets paid off on good hands
(4 c) Against bets lost when "bluff" called.
(5) Consider X bets with [0,A) (bluffing) and (B,1] (good hand)
(5 a) Y will call with a hand that is 1/4 way along the range
(5 b) Obviously the call point has to be in the (B,1] range so bluffs gain
(5 c) Mathematically (A-0) has to be less than 3*(1-B) (i.e. only bluff sometimes).
(6) If A iz zero (i.e. never bluff) Y will call 1/4 into your range
(6 a) Suppose you bet with .6 or more
(6 b) Y will call with .7 or more else fold
(6 c) Where you both have .7 or more, it remains 50-50 (sometimes you win one more, or lose one more)
(6 d) Where you have .6xxx you can win pots you shouldn't (Y = .6xxx) but will lose an extra $1 if Y has a good hand.
(6 e) Since you lose $1 with p=.3 and only gain $2 with p<.1 …
(6 f) Unless you bluff, you are better off not betting.

Suppose you bluff [0 - 0.1) and bet [0.7 - 1]
Obviously if you check then the action has no change on what should have happened.
The figures above mean Y should call with any hands of .7 or above.
Thus if you both have good hands they means sometimes you win 1 more and sometimes you lose 1 more
If you have a good hand and Y doesn't you were destined to win pot, so no change
The advantage comes from the bluffing times.
(a) Y has hand (0 - 0.1) - half the times you've stolen a pot - so profit = $2 * ( .1 * .1 /2)
(b) Y had hand (0.1 - 0.7) - you've stolen a pot - so profit = $2 * (.1 * .6)
(c) Y had hand (0.7-1) - you've lost an extra £1 - so loss = $1 * (.1 * .3)

Now generalise this as [0 to A) and [(1-3A) to 1]
Profit = 2 * A * A / 2 + 2 * A * (1-4A) - 1 * A * 3A
…. = 2A - 10 A*A
Which amazinginly (has a maximum value at A = .1) (simple diff 20A-2 = 0)
JTate503
JTate503
  • Threads: 1
  • Posts: 7
Joined: Mar 3, 2012
August 11th, 2012 at 7:29:31 PM permalink
It looks like to me that our answers are slightly different, but have the same expected value.



It doesn't matter expected value-wise if player Y calls or folds when "holding 0.1-0.7" since his hand can only beat 25% of the range of X's hands. However by calling on all hands above 0.1, he will have a higher standard deviation than if he only called hands above 0.7. Furthermore, he could play a percentage of the hands between 0.1 and 0.7 and have a standard deviation somehwere in between.

SD(Y calls on all hands above 0.1) = 1.439
SD(Y calls on all hands above 0.7)=1.162

This is under the assumption that I actually got the problem right (at least as far as not using a randomization strategy).

MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
August 12th, 2012 at 4:40:36 AM permalink
This problem puzzled me, so I wrote a self-learning numerical simulation.


X and Y follow a strategy that they will bet or call based on their drawn number with a given probability.
Blue dots are the bet probability for X, green circles are the call probabilities for Y.

The simulation oscillates a little bit, and the discrete levels of Y depend on the size of the simulation.


Results are:
X should bet on ~0.7 or greater, and bluff on ~0.1 or lower.
Y should call on ~0.7 or greater, and call between 0.1 and 0.7 with increasing probability.

Overall EV for X is 0.09997 (probably 1/10 in an "infinite" version).

This turns out *quite* intersting. Thank you Wizard for this problem. Quite frankly I don't understand much of the "analytical" answers given above, but I admire their beauty (and consistent results). You now have hooked me on poker math.
Wizard
Administrator
Wizard
  • Threads: 1491
  • Posts: 26435
Joined: Oct 14, 2009
August 12th, 2012 at 9:04:58 AM permalink
When I did the math I got the same X strategy as mentioned above, raise with less than 0.1 or more than 0.7. However, my Y strategy was to call with 0.4 or greater.

I see JTate says Y's counter-strategy is equally good calling from 0.1 to 0.7. I haven't confirmed that, but I've noticed with similar problems that there are often a range of equally good counter strategies, and I can confirm a Y call point of 0.4 has the same EV has 0.1, at 0.1 for X.

Mango's answer is also interesting. It would seem Y can do whatever he wants between 0.1 and 0.7.


Good work gang! I will post a more difficult problem tomorrow.
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
weaselman
weaselman
  • Threads: 20
  • Posts: 2349
Joined: Jul 11, 2010
August 12th, 2012 at 9:17:43 AM permalink
I don't understand. :( Need some help please!

How is it you guys are saying the first player should check between .1 and .7?
Suppose, I have .6. If I check, my EV is 1.2. If I raise, and the other guy folds, it is 2. if he calls, it is 1.4. Either way, I get more than 1.2. Why would I not want to bet?
"When two people always agree one of them is unnecessary"
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
August 12th, 2012 at 9:25:53 AM permalink
Quote: Wizard

It would seem Y can do whatever he wants between 0.1 and 0.7.




Simulation suggest that Y's response to 0.1 - 0.7 is highly sensitive of X's exact strategy on the bluff. I got extreme switching behaviours between calls and folds on slight variations of X's probability to bluff on exactly 0.1.

From a different poker book I remember the phrase that a perfect bluff's expectation value is independent to the response of the opponent.
Wizard
Administrator
Wizard
  • Threads: 1491
  • Posts: 26435
Joined: Oct 14, 2009
August 12th, 2012 at 9:54:08 AM permalink
Yes, if X has 0.6 that is better than average. However, maybe he is trying to sucker Y into calling more, enabling his bluffs to be more powerful. You have to consider that how X's strategy influences Y's behavior.


I would add that all points where the strategy changes should be on exactly borderline cases. That is the key to how I solved the problem. I plan to explain my solution tomorrow.

I also suspect that my answer of Y calling at 0.4 may better take advantage of non-optimal X strategies than other points between 0.1 and 0.7.
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
August 12th, 2012 at 10:21:20 AM permalink

I somehow agree that X's bluff serves him an advantage.
What I don't understand is: why does X bluff on 0-0.1, but not - say - on 0.5-0.6. If he would bluff with the higher "hand" wouldn't that give him an extra advantage when the bluff is called ?
buzzpaff
buzzpaff
  • Threads: 112
  • Posts: 5328
Joined: Mar 8, 2011
August 12th, 2012 at 12:24:26 PM permalink
I got x + 1/2 y Am I close ?
charliepatrick
charliepatrick
  • Threads: 39
  • Posts: 2946
Joined: Jun 17, 2011
August 12th, 2012 at 1:27:34 PM permalink
Quote: MangoJ


I somehow agree that X's bluff serves him an advantage.
What I don't understand is: why does X bluff on 0-0.1, but not - say - on 0.5-0.6. If he would bluff with the higher "hand" wouldn't that give him an extra advantage when the bluff is called ?

Case 1: Y is only going to call with .7 or more - in which case it doesn't matter what score you bluff with as if called it will lose. If you don't bluff your chances of winning are the score you have, therefore why not bluff with 0-0.1 where you had little chance of winning, and now have a .7 chance, rather than 0.5-0.6 where you were favourite to win.

Case 2: Y finds out you only bet with a hand greater than x (in your case x=.5). It is illogical for him to call with any hand less than x and technically should only call with hands greater than x+0.1 or .7. Thus this reverts to case 1 as any bluff loses if called.
dwheatley
dwheatley
  • Threads: 25
  • Posts: 1246
Joined: Nov 16, 2009
August 13th, 2012 at 11:42:16 AM permalink
Quote: weaselman

I don't understand. :( Need some help please!



Quote: weaselman


How is it you guys are saying the first player should check between .1 and .7?
Suppose, I have .6. If I check, my EV is 1.2. If I raise, and the other guy folds, it is 2. if he calls, it is 1.4. Either way, I get more than 1.2. Why would I not want to bet?


Your EV if Y calls isn't 1.4, it depends on his strategy. In this case, we can fix Y's strategy to be call greater than .4 to do the math. Then your EV is only 1/3. Even if Y changes his strategy to other optimal Y responses, the EV of raising with a mid hand is still too low.
Wisdom is the quality that keeps you out of situations where you would otherwise need it
Wizard
Administrator
Wizard
  • Threads: 1491
  • Posts: 26435
Joined: Oct 14, 2009
August 13th, 2012 at 12:22:22 PM permalink

My method of solving this problem comes from The Mathematics of Poker by Bill Chen and Jerrod Ankenman.

The crux of their solution is to find indifference points where each player perceives the same expected value between two options. Let’s look at this problem as an example.

Let’s define some variables:

x1 = Point at which X is indifferent to bluffing and checking.
x2 = Point at which X is indifferent to checking and raising.
y1 = point at which Y is indifferent to folding and checking after a raise by X.

Take it on faith that this would be the strategy structure for both players. If you can't, buy the book mentioned above, or take up a college-level game theory class.

Next, we must decide which number will be greater, x1 or y1. It seems obvious to me that y1 will be greater. If it isn't to you, I suppose you could work out the problem both way, and see which results in a greater expected value for player X.

Now we're ready to get our hands dirty with some math. Let's start by finding an equation for x1. We do this by examing the possible outcomes for all possible values of Y, and how much X will win whether he bluffs or checks with exactly x1 points.


Y Bluff Check Difference Exp. Val.
1 to y1 -2 -1 -1 y1-1
y1 to x1 1 -1 2 2y1-2x1
x1 to 0 1 1 0 0



The expected value column is the product of the probability that Y will have a value in the stated range and how much X stands to gain to bluff if Y is in that range.

The sum of the expected value column is 3y1 - 2x1 -1. We set this equal to zero because at exactly x1 player X should be indifferent to bluffing and checking. So, 3y1 - 2x1 -1 = 0.

Next, do the same thing for x2.

Y Bluff Check Difference Exp Val
1 to x2 -2 -1 -1 x2-1
x2 to y1 2 1 1 x2-y1
y1 to 0 1 1 0 0


For x2 the expected value equation is 2x2 -y1 -1 = 0.

Next, do the same thing for y1, but consider every possible number of points for player X.

Y Bluff Check Difference Exp Val
1 to x2 -2 -1 -1 x2-1
x2 to y1 -1 -1 0 0
y1 to x1 1 1 0 0
x1 to 0 2 -1 3 3x1


For y1, the expected value equation is 3x1 + x2 -1 = 0.

So, now we have three equations and three unknowns. We all know from algebra class that is all we need to solve the problem! I'm going to assume the reader knows how to basic matrix algebra. So I'll skip all that and jump to the solution which is:

x1=0.1
x2=0.7
y1=0.4
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
weaselman
weaselman
  • Threads: 20
  • Posts: 2349
Joined: Jul 11, 2010
August 13th, 2012 at 3:48:59 PM permalink
It still does not make too much intuitive sense to me, I am afraid, so I wrote a simulation to convince myself ...
It did not work. :(

When X and Y play according to Wizard's strategy, I am getting EV of -0.005 and +0.005 for them respectively. First of all, X can definitely do better than this by never betting at all. Now, changing Y's raising threshold to 0.5, makes the EV -/+ 0.035, which seems to suggest that raising between 0.4 and 0.5 is not optimal play for Y. Moreover, raising threshold to 0.7 does even better for Y at 0.095.

What am I missing here? For what it's worth, here is the simulation (you can play around with $xbet and $ybet settings to adjust the strategies. everything else is, I think, pretty straightforward, but I can explain if needed).

#!/usr/bin/perl
while(1)
{
my ($x, $y) = (rand(), rand());

my $xbet = ($x < 0.1 || $x > 0.7) ? 1 : 0;
my $ybet = $xbet && ($y >= 0.4) ? 1 : 0;

my $val = $x > $y ? 1 : -1;
if($xbet)
{
$val *= 2 if($ybet || $val < 0);
}

$xwin += $val;
$ywin -= $val;
$N++;

printf ("%8d: X: %6.3f, Y: %6.3f\n", $N, $xwin/$N, $ywin/$N) unless $N % 1000000;
}
"When two people always agree one of them is unnecessary"
Wizard
Administrator
Wizard
  • Threads: 1491
  • Posts: 26435
Joined: Oct 14, 2009
August 13th, 2012 at 4:13:05 PM permalink
Quote: weaselman

When X and Y play according to Wizard's strategy, I am getting EV of -0.005 and +0.005 for them respectively.



I think there is something wrong with your program. At least three people have found strategies where the EV of X is 0.1, including my strategy.
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
charliepatrick
charliepatrick
  • Threads: 39
  • Posts: 2946
Joined: Jun 17, 2011
August 13th, 2012 at 4:45:56 PM permalink
Quote: Wizard

...strategies where the EV of X is 0.1. ....

I agree with the .1. What is interesting about your solution is that while X has an optimum (initial) strategy, which means Y actually has a range of replies, the answer you give for Y prevents X from adopting a better strategy knowing Y's answer.
One way or working it out (cheating) is to create a spreadsheet where you put X's value (use .0005 to represent 0-0.001 etc.) and then decide whether he bets or not. No decide how often Y calls/folds factored in. Then you can play around and vary the numbers.
What turns out interesting is Y's optimum strategy prevents X gaining too much. For instance if Y calls too often then you're better off not bluffing and raising with lower hands, and if Y rarely calls then you bluff more, both which give X a better EV.
Bluff Bet Bet ? Y Folds Y Calls X Bets / Wins X Bets / Loses X Checks / Wins X Checks / Loses
Values: 0.1 0.7 0.4 Totals: 430 -210 240 -360 100
.000 500 1 0.4 1.2 0.00 0.00
.001 500 1 0.4 1.2 0.00 0.00

.099 500 1 0.4 1.2 0.00 0.00
.100 500 0 0 0 0.10 0.90
.101 500 0 0 0 0.10 0.90

.698 500 0 0 0 0.70 0.30
.699 500 0 0 0 0.70 0.30
.700 500 1 1.001 0.599 0.00 0.00
.701 500 1 1.003 0.597 0.00 0.00

.997 500 1 1.595 0.005 0.00 0.00
.998 500 1 1.597 0.003 0.00 0.00
.999 500 1 1.599 0.001 0.00 0.00

I guess it's the same as the dealer hits 16 and stands on 17; otherwise players might adopt a better, and more profitable, strategy.
weaselman
weaselman
  • Threads: 20
  • Posts: 2349
Joined: Jul 11, 2010
August 13th, 2012 at 5:38:41 PM permalink
Quote: Wizard

I think there is something wrong with your program.


Indeed, I found the error :)
The fixed version, shows X's expectation 0.1 with your strategy.

#!/usr/bin/perl
while(1)
{
my ($x, $y) = (rand(), rand());

my $xbet = ($x < 0.1 || $x > 0.7) ? 1 : 0;
#my $xbet = $x > 0.8;
my $ybet = $xbet && ($y >= 0.4) ? 1 : 0;

my $val = $x > $y ? 1 : -1;
if($xbet)
{
$val *= 2 if($ybet || $val < 0);
$val = 1 unless $ybet;
}

$xwin += $val;
$ywin -= $val;
$N++;

printf ("%8d: X: %6.3f, Y: %6.3f\n", $N, $xwin/$N, $ywin/$N) unless $N % 1000000;
}
"When two people always agree one of them is unnecessary"
  • Jump to: