All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Probability
Random Tic Tac Toe (Posted on 2025-02-17) Difficulty: 3 of 5
If every move in a game of tic-tac-toe is made at random, spread evenly over the remaining spaces, what is the probability the first player wins, the second player wins, or that there is a tie?

  Submitted by Charlie    
No Rating
Solution: (Hide)
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
>> 

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Some Thoughtshand counted TiesJer2025-02-17 14:18:14
SimulationLarry2025-02-17 07:33:01
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2025 by Animus Pactum Consulting. All rights reserved. Privacy Information