Another week, another Riddler. The question:

*Congratulations! The Acme Axegrinders, which you own, are the regular season champions of the National Squishyball League (NSL). Your team will now play a championship series against the Boondocks Barbarians, which had the second-best regular season record. You feel good about Acme’s chances in the series because Acme won exactly 60 percent of the hundreds of games it played against Boondocks this season. (The NSL has an incredibly long regular season.) The NSL has two special rules for the playoffs:*

*The owner of the top-seeded team (i.e., you) gets to select the length of the championship series in advance of the first game, so you could decide to play a single game, a best two out of three series, a three out of five series, etc., all the way up to a 50 out of 99 series.**The owner of the winning team gets $1 million minus $10,000 for each of the victories required to win the series, regardless of how many games the series lasts in total. Thus, if the top-seeded team’s owner selects a single-game championship, the winning owner will collect $990,000. If he or she selects a 4 out of 7 series, the winning team’s owner will collect $960,000. The owner of the losing team gets nothing.*

*Since Acme has a 60 percent chance of winning any individual game against Boondocks, Rule 1 encourages you to opt for a very long series to improve Acme’s chances of winning the series. But Rule 2 means that a long series will mean less winnings for you if Acme does take the series.*

*How long a series should you select in order to maximize your expected winnings? And how much money do you expect to win?*

To find this you have to find the expected value for each number of games. This ended up being:

Where

number of games won

series is first to _

probability Axegrinders win

What the heck is this? Oh man good question. Okay so first we assume that in each case we are playing the full number of games. So if it is a first to 3 (commonly referred to as a best of 5) then we are going to play five games, even if we win the first 3. This can lead to “extra” wins, but helps keep the math concise. So again in the first to 3 case:

Axegrinders Wins | Barbarians wins | Ways this can occur | |

First to 3 | 3 | 2 | 10 |

4 | 1 | 5 | |

5 | 0 | 1 |

So the equation would take n=0 (no extra wins) to make the top row. The probability this happens is

summed with the next two rows:

this sum, equal to 0.68, is the chance that the Axegrinders win the series. This is multiplied by the payout to get the expected value (662,000).

This gives us this wonky looking graph:

The result of this is the optimal payout is when the Axegrinders choose to play a first to 13, or **best of 25**. Doing so will give them an expected return of **$736,222.**

The code:

import math import matplotlib.pyplot as plt #Chances of winning def c_o_w(prob,first_to): chance_of_winning = 0 for i in range(0,first_to): games = 2*first_to-1 a_wins = first_to+i b_wins = games-a_wins individ_prob = prob**(a_wins)*(1-prob)**(b_wins)*math.factorial(games)/(math.factorial(a_wins)*math.factorial(b_wins)) chance_of_winning += individ_prob return(chance_of_winning) #Calculated chances of winning, payout and ev for each series length chances = [] payout = [] ev = [] x = [] for series_length in range(1,86): chances.append(c_o_w(0.6,series_length)) payout.append(100-series_length) ev.append(chances[series_length-1]*payout[series_length-1]) x.append(series_length) #Oh man I gotta graph this fig, ax = plt.subplots(sharey=False) pev, = ax.plot(x,ev, color = 'b', label = 'Expected Value') ax.set_ylabel("Dollars, in Thousands", color = 'b') ppay, = ax.plot(x,payout,color = 'g', label = 'Payout') ax.tick_params('y',colors = 'b') ax.set_xlabel("Best of _ Series") ax2 = ax.twinx() pchance, = ax2.plot(x,chances, color = 'm', label = 'Probability to win series') ax2.set_ylabel("Chances Axegrinders Win Series", color = 'm') ax2.tick_params('y',colors = 'm') fig.tight_layout() plt.title('Axegrinders Series Length Selection') fig.legend([pev,ppay,pchance],['Expected Value', 'Payout', 'Chances Axegrinders Win Series'],loc='lower right', borderaxespad=8.) plt.show()

Pingback: How Much Is A Spy Worth In A Warring Riddler Nation? | FiveThirtyEight

This is random, but I messaged you on Reddit a little bit ago regarding a big little code you did, didn’t know if you were still active or not. If you still have it or would be able to run it, I’d love to use what you wrote. Thanks!- jrballard@crimson.ua.edu

Pingback: How Much Is A Spy Worth In A Warring Riddler Nation? – KAYENRE Technology