format long
%The default Balls vector (no ties) is: [250 199 156 119 88 63 43 28 17 11 8 7 6 5]
Balls = [250 199 156 104 103 63 43 28 17 11 8 7 6 5]';
%Creating probability matrix of possible outcomes
ProbMat = zeros(14,14,14);
one = 1;
while one < 15
two = 1;
while two < 15
three = 1;
while three < 15
ProbMat(one,two,three) = (Balls(one)/sum(Balls))*(Balls(two)/(sum(Balls)-Balls(one)))*(Balls(three)/(sum(Balls)-Balls(one)-Balls(two)));
if one == two
ProbMat(one,two,three) = 0;
end
if one == three
ProbMat(one,two,three) = 0;
end
if two == three
ProbMat(one,two,three) = 0;
end
three = three + 1;
end
two = two + 1;
end
one = one + 1;
end
%Matrix of Pick Probabilities
ProbPick = zeros(14,14);
%Calculating Prob of Top 3 Pick
l = 1;
while l < 15
n = 1;
while n < 15
t = 1;
while t < 15
ProbPick(l,1) = ProbPick(l,1) + ProbMat(l,n,t);
ProbPick(l,2) = ProbPick(l,2) + ProbMat(n,l,t);
ProbPick(l,3) = ProbPick(l,3) + ProbMat(n,t,l);
t = t + 1;
end
n = n + 1;
end
l = l + 1;
end
%Calculating Prob of keeping pick (for teams in the 4 - 14 slots)
n = 4;
while n < 15
one = 1;
while one < n
two = 1;
while two < n
three = 1;
while three < n
ProbPick(n,n) = ProbPick(n,n) + ProbMat(one,two,three);
three = three + 1;
end
two = two + 1;
end
one = one + 1;
end
n = n + 1;
end
%Calculating Prob of sliding three slots (for teams in the 1 - 11 slots)
n = 1;
while n < 12
r = n + 1;
while r < 15
s = n + 1;
while s < 15
t = n + 1;
while t < 15
ProbPick(n,n+3) = ProbPick(n,n+3) + ProbMat(r,s,t);
t = t + 1;
end
s = s + 1;
end
r = r + 1;
end
n = n + 1;
end
%Calculating prob of sliding two slots (for teams in the 2 - 12 slots)
n = 2;
while n < 13
r = 1;
while r < n
s = n + 1;
while s < 15
t = n + 1;
while t < 15
ProbPick(n,n+2) = ProbPick(n,n+2) + ProbMat(r,s,t) + ProbMat(s,r,t) + ProbMat(s,t,r);
t = t + 1;
end
s = s + 1;
end
r = r + 1;
end
n = n + 1;
end
%Calculating prob of sliding one slot (for teams in the 3 - 13 slots)
n = 3;
while n < 14
r = 1;
while r < n
s = 1;
while s < n
t = n + 1;
while t < 15
ProbPick(n,n+1) = ProbPick(n,n+1) + ProbMat(r,s,t) + ProbMat(r,t,s) + ProbMat(t,r,s);
t = t + 1;
end
s = s + 1;
end
r = r + 1;
end
n = n + 1;
end
ProbPickT = ProbPick'