The program tabulates the results of all 9! = 362,880 of the orderings of 9 digits. This automatically gives each shorter game a higher probability as needed.
player 1 0.584920634920635
player 2 0.288095238095238
tie 0.126984126984127
737/1260, 121/420, 8/63 respectively, from
seqs=perms(1:9);
cts=zeros(1,3);
a(:,:,1)=diag([1,1,1]);
a(:,:,2)=flip(a(:,:,1));
for r=1:3
a(r,:,r+2)= ones(1,3);
end
for c=1:3
a(:,c,c+5)= ones(1,3);
end
a=logical(a);
for i=1:length(seqs)
grid=zeros(3);
seq=seqs(i,:);
w=0; p=1;
while w==0
grid(seq(p))=mod(p,2)+2;
for j=1:8
v=a(:,:,j);
v=reshape(grid(v),1,3);
if isequal(v,[2 2 2])
w=2; break
elseif isequal(v,[3 3 3])
w=1; break
end
end
p=p+1;
if p>9
break
end
end
switch w
case 1
cts(1)=cts(1)+1;
case 2
cts(2)=cts(2)+1;
case 0
cts(3)=cts(3)+1;
end
end
cts
sym(cts/sum(cts))
cts/sum(cts)
cts =
212256 104544 46080
ans =
[737/1260, 121/420, 8/63]
ans =
Column 1
0.584920634920635
Column 2
0.288095238095238
Column 3
0.126984126984127
>>
|