2 ms·
Question 4 was fun :) Not sure what technique they wanted you to use, but it was easy to work back from the desired outcome, keeping track of the current IOU b
by Cogito 10y ago
Question 4 was fun :)
Not sure what technique they wanted you to use, but it was easy to work back from the desired outcome, keeping track of the current IOU balance and the bet that would leave you in the desired position. I assume the early questions illuminate the general way of doing this.
==== SPOILER ====
Create a 4 * 4 matrix BET_m,n and a 5 * 5 matrix IOU_m,n, where m and n are the number of wins for each team respectively, and each matrix encodes how much is bet and owed after that many wins.
Our initial constraints give IOU_0,0 = 0, as nothing is owed until a team wins a game. IOU_4,* = 100 and IOU_* ,4 = -100.
It's hard to see what BET_0,0 should be starting from the start, so instead lets work backwards.
If a team has 3 wins, and wins again, then the bet plus current IOU must equal 100 if it's my team winning, -100 if the other.
IOU_3,3 + BET_3,3 = IOU_4,3 = 100
IOU_3,3 - BET_3,3 = IOU_3,4 = -100
Thus BET_3,3 = 100 and IOU_3,3 = 0
Our matrices now look like
BET = [. . . .
. . . .
. . . .
. . . 100]
IOU = [0 . . . -100
. . . . -100
. . . . -100
. . . 0 -100
100 100 100 100 . ]
IOU_3,2 + BET_3,2 = 100
IOU_3,2 - BET_3,2 = 0
So BET_3,2 = 50 and IOU_3,2 = 50
By symmetry BET_2,3 = 50 and IOU_2,3 = -50
Working along the m=3 and n=3 edges we get
BET = [. . . 12.5
. . . 25
. . . 50
12.5 25 50 100 ]
IOU = [0 . . -87.5 -100
. . . -75 -100
. . . -50 -100
87.5 75 50 0 -100
100 100 100 100 . ]
In general, our constraints are:
IOU_m,n + BET_m,n = IOU_m+1,n
IOU_m,n - BET_m,n = IOU_m,n+1
Filling in through the middle
BET = [31.25 31.25 25 12.5
31.25 37.5 37.5 25
25 37.5 50 50
12.5 25 50 100 ]
IOU = [0 -31.25 -62.5 -87.5 -100
31.25 0 -37.5 -75 -100
62.5 37.5 0 -50 -100
87.5 75 50 0 -100
100 100 100 100 . ]