# Dice Math Containment Thread

**URL:** <https://unstuckpolitics.com/t/dice-math-containment-thread/10887>\
**Category:** Sundry Chitchat\
**Created:** [April 12, 2024, 1:01pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887 "2024-04-12T13:01:24Z")\
**Posts on this page:** 20\
**Page:** 6

<div class="post-metadata">

**Author:** ![MrWookie](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/mrwookie/32/133536_2.png) [@MrWookie](https://unstuckpolitics.com/u/MrWookie)\
**Post date:** [April 12, 2024, 5:47am UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/101 "2024-04-12T05:47:02Z")

</div>

Do you scroll past 50 or 62 posts?

---

<div class="post-metadata">

**Author:** ![WAR](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/war/32/52_2.png) [@WAR](https://unstuckpolitics.com/u/WAR)\
**Post date:** [April 12, 2024, 9:30am UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/102 "2024-04-12T09:30:54Z")

</div>

ok good, I’m glad I didn’t think about this for more than 30 seconds.

---

<div class="post-metadata">

**Author:** ![bobman0330](https://unstuckpolitics.com/letter_avatar_proxy/v4/letter/b/e9bcb4/32.png) [@bobman0330](https://unstuckpolitics.com/u/bobman0330)\
**Post date:** [April 12, 2024, 10:07am UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/103 "2024-04-12T10:07:14Z")

</div>

> [@Trolly](#):
>
> Surely we can find an analytical solution to this instead of spreadsheeting it.

I posted it yesterday morning, it’s not that complicated.

---

<div class="post-metadata">

**Author:** ![ctr123](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/ctr123/32/106809_2.png) [@ctr123](https://unstuckpolitics.com/u/ctr123)\
**Post date:** [April 12, 2024, 10:09am UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/104 "2024-04-12T10:09:45Z")

</div>

> [@Trolly](#):
>
> Surely we can find an analytical solution to this instead of spreadsheeting it.

Right : assuming we’re drawing uniformly from [0,1] to make computations simpler :

assuming there’s only one equilibrium strategy which must then be symmetric (probably true but too lazy to prove it now)

If c is the equilibrium cutoff strategy, then this means that  
(value of rerolling vs strat c) = (probability of winning with c vs strat c)

The first quantity is 1 - average(strat c), and average(strat c) is the sum of  
c/2 (proba c of drawing below c, then 1/2 average value of reroll)  
and  
1/2-c^2/2 (expected value of U 1\_{U\>c}, which is the integral \int\_c^1 x dx)  
i.e.  
(value of rerolling vs strat c) =1/2 + c^2/2 - c/2

On the other hand, the proba that c is winning against strat c is exactly the proba that two rolls end up below c, i.e. c^2

This gives you the equation  
1/2+c^2/2-c/2 = c^2  
which unique solution between 0 and 1 is 1/2(sqrt(5)-1) or approximately 0.618

Edit : previously post said  
"  
this means that you need to reroll at exactly the average value of the strategy. (since this will also be what your opponent is getting if he’s playing perfectly)  
"  
which somehow got the right answer in the end, but the reasoning seems incorrect.

---

<div class="post-metadata">

**Author:** ![dogsballs](https://unstuckpolitics.com/letter_avatar_proxy/v4/letter/d/c6cbf5/32.png) [@dogsballs](https://unstuckpolitics.com/u/dogsballs)\
**Post date:** [April 12, 2024, 11:42am UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/105 "2024-04-12T11:42:46Z")

</div>

> [@CanadaMatt3004](#):
>
> I think I figured it out
> 
> ![image](https://unstuckpolitics.com/uploads/default/original/3X/b/9/b9c2ec478638679c53c04a08db47f370da6fd355.jpeg)

I showed that solution to my wife this morning. She agreed with it.

---

<div class="post-metadata">

**Author:** ![clovis8](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/clovis8/32/1067_2.png) [@clovis8](https://unstuckpolitics.com/u/clovis8)\
**Post date:** [April 12, 2024, 2:57pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/106 "2024-04-12T14:57:57Z")

</div>

My question is why is a solar installation specialist a python code genius? Micro is quite the polymath. Feeling good and humbled right now. 😁

---

<div class="post-metadata">

**Author:** ![microbet](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/microbet/32/108_2.png) [@microbet](https://unstuckpolitics.com/u/microbet)\
**Post date:** [April 12, 2024, 3:03pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/107 "2024-04-12T15:03:59Z")

</div>

Dunno about all of that, and you never know…zikzak is a builder and good at computer stuff, d10 was on this and all I know (or think anyway) about his career is he was an army helicopter pilot.

But, I was a software developer before I did solar and have recently mostly gone back to software. I’m sorta educated as well, started in engineering but graduated Math and English at the finest University in the world.

---

<div class="post-metadata">

**Author:** ![ctr123](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/ctr123/32/106809_2.png) [@ctr123](https://unstuckpolitics.com/u/ctr123)\
**Post date:** [April 12, 2024, 3:04pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/108 "2024-04-12T15:04:38Z")

</div>

> [@ctr123](#):
>
> 1/2(sqrt(5)-1) or approximately 0.618

this is for continuous distribution on [0,1], rescaled to uniform (still continuous) on [1,100] which is closer to the discrete dice, this gives ~ 62.2.

So the continuous approximation is consistent with the d10 solution of “keep 63+, reroll 62-”.

(Not sure if there’s a simple proof that this approximation is good enough without actually doing the discrete math which it seems bobman already did)

---

<div class="post-metadata">

**Author:** ![spidercrab](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/spidercrab/32/140004_2.png) [@spidercrab](https://unstuckpolitics.com/u/spidercrab)\
**Post date:** [April 12, 2024, 3:06pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/109 "2024-04-12T15:06:58Z")

</div>

> [@clovis8](#):
>
> My question is why is a solar installation specialist a python code genius? Micro is quite the polymath. Feeling good and humbled right now. 😁

Yeah, this is something that I often think about here. There are so many people here who are informed/skilled at seemingly-unrelated topics. It’s really impressive.

Meanwhile, I can read financial statements and that’s basically it.

---

<div class="post-metadata">

**Author:** ![Devil](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/devil/32/128560_2.png) [@Devil](https://unstuckpolitics.com/u/Devil)\
**Post date:** [April 12, 2024, 5:49pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/110 "2024-04-12T17:49:38Z")

</div>

> [@ctr123](#):
>
> somehow got the right answer in the end, but the reasoning seems incorrect.

Still following Newton. [No one noticed for 250 years (pdf).](https://arxiv.org/pdf/math/0701089.pdf)

> Yet even they should feel no embarrassment. As Augustus De Morgan once wrote, “Everyone makes errors in probabilities, at times, and big ones.”

---

<div class="post-metadata">

**Author:** ![d10](https://unstuckpolitics.com/letter_avatar_proxy/v4/letter/d/b77776/32.png) [@d10](https://unstuckpolitics.com/u/d10)\
**Post date:** [April 13, 2024, 2:14am UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/111 "2024-04-13T02:14:39Z")

</div>

> [@microbet](#):
>
> d10 was on this and all I know (or think anyway) about his career is he was an army helicopter pilot.

Still piloting but I’ve changed employers a few times since then. I grew up as a computer nerd though. I started programming on the family PC at 5 because all the games were run off a BASIC compiler. The change in career path was due to graduating high school in 2000 with the tech industry crashing and the war industry looking up. I took part time college classes as an adult because I had time and the government was paying for it, so I’ve got 180 undergraduate credits mostly in math and science, and 3/4 of two degrees in computer science and aerospace engineering. Not at an elite school but a decently ranked public university, particularly in those programs. Would have finished but I got relocated. My calculus is on point but my stats is not so great. I have a vivid memory of pissing off my high school stats class by vehemently arguing the wrong side of the Monty Hall problem.

---

<div class="post-metadata">

**Author:** ![microbet](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/microbet/32/108_2.png) [@microbet](https://unstuckpolitics.com/u/microbet)\
**Post date:** [April 13, 2024, 2:29am UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/112 "2024-04-13T02:29:17Z")

</div>

BA in Math here and I’ve never taken a stats class. I had a dumb aversion to things that seemed too practical and avoided it.

---

<div class="post-metadata">

**Author:** ![ctr123](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/ctr123/32/106809_2.png) [@ctr123](https://unstuckpolitics.com/u/ctr123)\
**Post date:** [April 13, 2024, 5:30am UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/113 "2024-04-13T05:30:51Z")

</div>

nice story, and since we’re talking credentials I’m a mathematician (in a probability adjacent field) so I shouldn’t be making a mistake here…  
(although I’m on vacation trying very hard to not think about math…which I wasn’t expecting to be challenged by reading this board’s LC thread but here we are…)

But anyway thanks for this Newton anecdote, makes me feel better 🙂

---

<div class="post-metadata">

**Author:** ![Cactus](https://unstuckpolitics.com/letter_avatar_proxy/v4/letter/c/f475e1/32.png) [@Cactus](https://unstuckpolitics.com/u/Cactus)\
**Post date:** [April 13, 2024, 5:46pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/114 "2024-04-13T17:46:07Z")

</div>

> [@d10](#):
>
> have a vivid memory of pissing off my high school stats class by vehemently arguing the wrong side of the Monty Hall problem.

What is the right side? Assuming Monty knows what’s behind each door you switch, right? I had a terrible argument with my uncle about it. He’s an electrical engineer and a very smart guy, but he just wouldn’t accept switching as the right answer no matter how hard I tried to explain it

---

<div class="post-metadata">

**Author:** ![WAR](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/war/32/52_2.png) [@WAR](https://unstuckpolitics.com/u/WAR)\
**Post date:** [April 13, 2024, 5:56pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/115 "2024-04-13T17:56:11Z")

</div>

Your original choice is right 1/3 of the time and one of the other two is right 2/3. He always removes a loser from the other two. This has no impact on how often your original choice is right because there will be a loser in the other pool either way. So the choice is if your original pick was right (1/3) or if either of the other two were right (2/3).

---

<div class="post-metadata">

**Author:** ![eeAWW](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/eeaww/32/1158_2.png) [@eeAWW](https://unstuckpolitics.com/u/eeAWW)\
**Post date:** [April 13, 2024, 10:17pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/116 "2024-04-13T22:17:26Z")

</div>

I went with a brutish solution using Julia code and got 63, which would have been my wise-ass guess because 100(e-1)/e. It’s very possible I did something wrong.

When Hero’s strategy is to stay on h, the probability of Hero rolling r is given by:

```auto
rollprob(r::Int64, h::Int64) = .0001(h-1) + .01(r>=h)

```

After rolling r, the probability of winning against Villain’s strategy of staying on v is:

```auto
condp(r::Int64, v::Int64) = .01*max(0, r-v) + .0001(v-1)*(r-1)

```

The probability of winning against strategy v using strategy h is:

```auto
pwin(h::Int64, v::Int64) = sum([rollprob(r,h)*condp(r,v) for r=1:100])

```

The probability of winning with strategy h against the best possible response is:

```auto
pwin(h::Int64) = minimum([pwin(h,v) for v=51:100])

```

And now we can solve for the optimum strategy:

```auto
x = 0.0
p = 0.0
for h=51:100
	if (q = pwin(h))>p
		p = q
		x = h
	end
end
x

```

That gives a result of x=63. No other strategy gives us a higher probability of winning against Villain’s best response (the one that minimizes our probability).

I also tried eliminating ties and testing whether any heads-up matchup gives us a \<50% chance of winning when our strategy is to aim for 63.

The probability of a tie, given that we rolled r and Villain’s target is v, is

```auto
tieprob(r::Int64, v::Int64) = .0001(v-1) + .01(v<=r)

```

The probability of a tie when strategy h faces strategy v is

```auto
ptie(h::Int64, v::Int64) = sum([rollprob(r,h)*tieprob(r,v) for r=1:100])

```

Now we can test the heads-up matchups:

```auto
for v=51:100
	if pwin(63,v)/(1-ptie(63,v)) < 0.5
		println(v)
	end
end

```

No results, so 63 doesn’t lose any matchups.  
The same procedure says 62 loses to 63, and it says 64 loses to 60 through 63.

---

<div class="post-metadata">

**Author:** ![microbet](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/microbet/32/108_2.png) [@microbet](https://unstuckpolitics.com/u/microbet)\
**Post date:** [April 13, 2024, 10:46pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/117 "2024-04-13T22:46:32Z")

</div>

> [@eeAWW](#):
>
> `.01(r>=h)`

So (r\>=h) returns 0 if r\<h and 1 if r\>=h and then it multiplies by .01 even without the ‘\*’?

---

<div class="post-metadata">

**Author:** ![eeAWW](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/eeaww/32/1158_2.png) [@eeAWW](https://unstuckpolitics.com/u/eeAWW)\
**Post date:** [April 13, 2024, 10:48pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/118 "2024-04-13T22:48:18Z")

</div>

Exactly

---

<div class="post-metadata">

**Author:** ![Melkerson](https://unstuckpolitics.com/letter_avatar_proxy/v4/letter/m/f19dbf/32.png) [@Melkerson](https://unstuckpolitics.com/u/Melkerson)\
**Post date:** [April 13, 2024, 11:34pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/119 "2024-04-13T23:34:24Z")

</div>

Upthread someone said 63 loses to 58 or something like that. Your method found that not to be the case?

---

<div class="post-metadata">

**Author:** ![econophile](https://unstuckpolitics.com/user_avatar/unstuckpolitics.com/econophile/32/78823_2.png) [@econophile](https://unstuckpolitics.com/u/econophile)\
**Post date:** [April 13, 2024, 11:36pm UTC](https://unstuckpolitics.com/t/dice-math-containment-thread/10887/120 "2024-04-13T23:36:21Z")

</div>

I think when he says 63, he means stand on 63. Other people are talking about the highest number you would reroll. So his 63 is the same as others’ 62.

[Previous page](https://unstuckpolitics.com/t/dice-math-containment-thread/10887.md?page=5)

[Next page](https://unstuckpolitics.com/t/dice-math-containment-thread/10887.md?page=7)
