Talk:Pig the dice game/Player: Difference between revisions

m
(→‎Strategy: not "winning", but "more likely to win")
 
(10 intermediate revisions by 4 users not shown)
Line 80:
: I believe this particular game has a unique solution, and I do have ''a'' solution of the P matrix, although proving it's unique is not easy. The holding choice pattern is pasted [http://pastebin.com/SWhU4mL7 here], where each row starts with two numbers, your current score and current holding score; the horizontal axis is the opponent's current score. Wherever there's a dot, it means you're better off hold; otherwise you should roll. For example, on line "0 21: ", there are 11 dots at the begining of the line, which means: if your total score is 0, and have already rolled 21 points this turn, then your best choice is hold if opponent has 0-10 points, but better keep rolling if he has 11 or more. The graph has many odd features, but generally makes sense. --[[User:Ledrug|Ledrug]] 13:13, 15 September 2012 (UTC)
 
:: That's an interesting set of data. I would particularly like to understand the "concave" parts of the holding pattern -- especially for right-facing concavities (such as the rightmost part of 36 22: through 36 25:). Those features seem counter-intuitive to me. Thanks. --[[User:Rdm|Rdm]] 23:39, 15 September 2012 (UTC)
 
::: Well, simple flukes there. In that region the winning chances are about .2 ~ .3, but the differences between hold and roll are very small (<1e-3), which could simply be because of loss of floating point precision. It isn't very meaningful. --[[User:Ledrug|Ledrug]] 00:33, 16 September 2012 (UTC)
 
:::: There are other concave regions (both vertically facing and right facing). Are they all "doesn't matter much what you choose" issues? --[[User:Rdm|Rdm]] 12:49, 16 September 2012 (UTC)
::::: I don't know, probably. I can't paste the graph with numbers in it, the file would be too big for pastebin. Instead the code generating numbers is in [[User:Ledrug/bits]] at the top, you can play with it to see the numbers (warning: huge output on stdout). --[[User:Ledrug|Ledrug]] 21:31, 16 September 2012 (UTC)
 
I should at least include a strategy of random play in my solution so that I can gauge any other strategy against it.--[[User:Paddy3118|Paddy3118]] 11:28, 15 September 2012 (UTC)
 
===Tournament of Pigs===
I decided to have various strategies fight it out and see who has the highest winning chance. Contestants:
 
A: always roll
 
R: randomly roll. Roll if holding score is 0, otherwise has 1/3 of chance to hold.
 
H: hold at 20. Roll if opponent >= 80; roll if self score >= 78; roll if holding score <= 20; hold otherwise.
 
O: the optimal holding pattern discussed above.
 
Each strat also has an "anti": AntiX is the holding pattern that maximizes winning when playing agains X. Note that AntiO ''is'' O. The following table is the resulting winning chances when one plays agains another in row major, that is, the top right corner means "when playing agains O, strat A has 0.121 chance of winning if move first, 0.112 if move second". The third number is just the sum of those two numbers; if it's gerater than 1, the strat has better overall odds when playing that opponent.
<pre>
A AntiA R AntiR H AntiH O
A 0.503/0.497 1.000 0.122/0.113 0.235 0.168/0.160 0.329 0.139/0.130 0.268 0.124/0.115 0.238 0.121/0.112 0.234 0.121/0.112 0.233
AntiA 0.887/0.878 1.765 0.529/0.471 1.000 0.806/0.768 1.575 0.577/0.520 1.097 0.570/0.510 1.081 0.530/0.471 1.001 0.524/0.464 0.988
R 0.840/0.832 1.671 0.232/0.194 0.425 0.528/0.472 1.000 0.191/0.153 0.343 0.206/0.168 0.374 0.215/0.175 0.390 0.221/0.181 0.402
AntiR 0.870/0.861 1.732 0.480/0.423 0.903 0.847/0.809 1.657 0.527/0.473 1.000 0.509/0.452 0.962 0.473/0.415 0.889 0.475/0.416 0.891
H 0.885/0.876 1.761 0.490/0.430 0.919 0.832/0.794 1.626 0.548/0.491 1.038 0.529/0.471 1.000 0.483/0.421 0.904 0.489/0.428 0.917
AntiH 0.888/0.879 1.766 0.529/0.469 0.999 0.825/0.785 1.610 0.585/0.526 1.111 0.579/0.517 1.096 0.530/0.470 1.000 0.527/0.466 0.993
O 0.888/0.879 1.767 0.536/0.476 1.012 0.819/0.779 1.598 0.584/0.525 1.109 0.572/0.511 1.083 0.534/0.473 1.007 0.530/0.470 1.000
</pre>
One funny thing is, AntiA is not the best at beating A; I blame loss of floating point precision for this, though I'm not completely sure.
 
===Someone else's strategy===
I found a [http://cs.gettysburg.edu/projects/pig/piggame.html site] and a paper "Optimal Play of the Dice Game Pig" by Todd W. Neller and Clifton G.M. Presser. I glossed over the pretty graphs which may however be something like what Ledrug is computing for his optimal strategy. I was after simple strategies and picked out their mention of 20 as being the accumulated points in a round where the odds of throwing a one are balanced by accumulated point.<br>
They also go on to describe why roll till 20 fails when getting nearer to the end of a game where it is advantageous to 'sprint for the win'. I ignored their full optimised strategy and just coded a 'region of desperation'. If any player is within 20 of finishing then this player should keep on rolling until it either wins or is bust as another player is likely to win on its next go. --[[User:Paddy3118|Paddy3118]] 05:55, 17 September 2012 (UTC)
: Holding at 20 is obviously not universal: if your opponent has 98 or 99 points, you have more than 50% chance of losing if you hold at any point before 100. If you want a simple rule, this is closer to truth: if your opponent has more than 80ish, roll no matter what; if you have more than 78 points, roll no matter what; otherwise hold if your holding score is more than 20ish. That should be a pretty good rough approximation.
: The fact is, at any give point in the game, the probabilities of roll vs hold never differ all that much: the winning chance of rolling is never lower than 80% that of holding. If you want a ''really'' simple rule, "just keep rolling" is the simplest. But as a game, a good strategy has a lot do with human perception of the outcome rather than boring mathematics. Take for an example, the absurd situation where both players are at 0, but you somehow with a streak of terrific luck and had rolled 99 so far. What to do at this point? If you hold, you have 98.8% chance winning; if you roll, it's 91.2%. You can hardly say the odds are against you if you choose to roll, but you'd be kicking yourself really hard under the table if you rolled a 1. Really, what one may consider a "good enough" strategy sometimes has nothing to do with facts at all. --[[User:Ledrug|Ledrug]] 07:26, 17 September 2012 (UTC)
 
== Table of Contents (List of implementations) ==
 
I added the Go example, but there seems to be no 'Table of Contents' under the task description. Forgive me, but I'm a complete noob, and don't know how to add it. [[User:La Longue Carabine|La Longue Carabine]] 18:43, 9 November 2012 (UTC)
:Hi, I forced it to appear, but normally it appears when there are four or more examples.--[[User:Paddy3118|Paddy3118]] 18:46, 9 November 2012 (UTC)
 
::Thanks. I guess I should have searched around a little more, finally found that out by looking at the Wikipedia Cheat Sheet. [[User:La Longue Carabine|La Longue Carabine]] 18:50, 9 November 2012 (UTC)