Two robots play a game of tic-tac-toe. They choose their moves randomly. Let E denote the expected number of moves it would take for the robots to finish a game. Find 1 0 0 0 E rounded to the nearest integer.
Note: A move is defined as the action of one of the robots placing one X or one O. The game finishes after 9 moves no matter the result.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
to finish game at 5th move shouldnt a factor of 9 be also multiplied , coz there are initially 9 options to choose the first x
No. We have 8 choices for the winning line, 3! choices for the order those three squares are filled,and 6! choices for the other six squares.
ohh ok thanks a lot understood. Nice solution
@Sam Zhou , After 1,2,3,or 4 moves, how the game will be finished is difficult to understand. So 9! games can be played is the wrong assumption. I do not agree with this answer.
Log in to reply
A game of tic-tac-toe will finish, in the ordinary sense, after 5,6,7,8 or 9 moves. However, if you let the players play to the end, then there are 9 ! different games, but more than one of these games will correspond to one of the standard games. For example, consider a standard game where X wins on the fifth move. In my interpretation, there are 4 ! = 2 4 games which all start with the same five moves that lead to X winning, and this means that the probability of a specific five-move game is 2 4 times greater than the probability of any one nine-move game.
I never say that the game finishes in less than 5 moves. I count the number of ways that a game ends in 5,6,7,8,9 moves, and use those numbers to calculate E . You will note that my counts of games resolved after 5,6,7,8,9 moves add up to 9 ! .
@Mark Hennings , For the game to be resolved at the 5th move, The player X must fill a winning line in 1,3, 5 moves. Thus there are 8 × 3 ! × 6 × 5 × 2 4 games in which this happens. (I don't understand why 1440 is multiplied by 24(4!)?. I think it is multiplied because total sample space is multiplied by 24(4!) ) Okay. For the game to be resolved at the 6th move, player O must fill a winning line in moves 2,4,6, while player X could not fill a winning line in 1,3,5 moves. Now there are 6 ∗ 3 ∗ 4 ∗ 2 ∗ 3 ∗ 8 =3456 - 432*2 =2592 *6=15552 games in which player O can fill a winning line. You have calculated 31968 games. Again, 432 *6 =2592 games are deducted from 34560 games. Would you explain this computations in a easy to understand and step by step manner?
Log in to reply
Your formula for 5 moves, 8 × 3 ! × 6 × 5 × 2 4 is the same as mine, 8 × 3 ! × 6 ! , so we have no problems there. I multiply by 4 ! = 2 4 to allow for all the orders of the four plays after the game has been resolved at the fifth move.
As for 6 moves, you seem to be assuming that O has filled a horizontal or vertical line, when she could have filled a diagonal (in which case X cannot have filled a line at move 5. My argument goes through the cases carefully. Have another look.
If nothing else, my numbers can be confirmed by a simple computer search.
@Mark Hennings, I agree with your answers for 5,6 7 moves. But there is a difference between my answer and your answer for computations of number of games in 8 moves to finish the game. I agree with your answer for diagonal winning lines which is 25920 moves. But to finish horizontal and vertical winning lines, my answer for (2,4,8) move is 6 ∗ 3 ∗ 5 ∗ 2 ∗ 3 ∗ 1 ∗ 2 ∗ 1 = 1 0 8 0 ∗ 6 = 6 4 8 0 ∗ 2 = 1 2 9 6 0 , for (2,6,8) move answer is ( 6 ∗ 3 ∗ 5 ∗ 1 ∗ 3 ∗ 2 ∗ 1 ∗ 1 = 5 4 0 ∗ 6 = 3 2 4 0 ) and (4,6,8)move is 4 3 2 0 ∗ 6 = 2 5 9 2 0 . So the total number of games are 2 5 9 2 0 + 2 5 9 2 0 + 3 2 4 0 + 1 2 9 6 0 = 6 8 0 4 0 games. Now, what is wrong with these answers?
Log in to reply
There must be the same number of (2,4,8) winning games as (2,6,8) winning games or (4,6,8) winning games.
In each one of these, O must play three moves on a line and one move off that line, with one of the on-line moves being at stage 8. At the same time, X cannot score a winning line in his 1,3,5,7 moves. We are counting the cases where the winning line is horizontal or vertical, and it is each to check that there are 4 possible sets of moves that X can have made (around O's winning line).
Now X's moves are determined in this calculation by the four moves that O eventually makes, and the order O makes them in does not matter. Thus it cannot make a difference to the number of winning games if O makes his offline move at move 2, 4 or 6. Your counting thinks that it does, which is wrong.
this would be right if all 9! games were possible, but some of these games must end early
Log in to reply
otherwise, shouldn't the answer be 9000?
Log in to reply
Instead of stopping a game when the first line is drawn, consider playing all nine moves. This may seem pointless, but it means that all 9 ! moves are equally likely. If we consider a game that ends (in the ordinary sense) with a line being drawn at the 5th move, then there are 4 ! = 2 4 of these fully completed games that all correspond to that 5-move game, and this means that the probability of a 5-move game is 2 4 times more likely than any specific 9-move game.
This method of allowing all 9 moves to be made makes it easier to count the number of games, and hence calculate probabilities.
@Mark Hennings, I agree with your final answer 7626. Your answer is correct.
Problem Loading...
Note Loading...
Set Loading...
For simplicity, let the robots play all nine moves. This means that there are 9 ! games that can be played, all equally likely. Then consider the first stage when each game is resolved (after anything between 5 and 9 moves).
For the game to be resolved at the 5 th move, player X must fill a winning line in moves 1,3,5. There are thus 8 × 3 ! × 6 ! = 3 4 5 6 0 games in which this happens.
For the game to be resolved at the 6 th move, player O must fill a winning line in moves 2,4,6, while player X cannot have filled a line in moves 1,3,5. There are 8 × 3 ! × 6 ! = 3 4 5 6 0 games in which a winning line is filled in at moves 2,4,6, and there are 6 × 2 × 3 ! × 3 ! × 3 ! = 2 5 9 2 games in which a winning line is filled in in both moves 1,3,5 and 2,4,6 (the lines must be either both horizontal or both vertical, so there are 6 choices for O's line and then 2 choices for X's line). Thus there are 3 4 5 6 0 − 2 5 9 2 = 3 1 9 6 8 games that are resolved at the 6 th move.
For the game to be resolved at the 7 th move, player X must complete a line with either moves 1,3,7 or 1,5,7 or 3,5,7, and player O cannot have completed a line at moves 2,4,6. Since it is not possible in these circumstances for player X to complete a line in moves 1,3,5, we deduce that there are 3 times as many games that complete at the 7 th move as complete at the 6 th. Thus there are 3 × 3 1 9 6 8 = 9 5 9 0 4 games that complete at the 7 th move.
For a game to complete at the 8 th move, player O must complete a line at moves 2,4,8 or 2,6,8 or 4,6,8 (and therefore not at 2,4,6), while player X has not completed a line by then. There are 2 × 3 ! × 6 ! × 3 = 2 5 9 2 0 games in which this is done by completing a diagonal line (there are 2 line choices and 3 move combinations in which the line can be completed, and X cannot certainly not complete a line) and a further 6 × 9 × 3 ! × 4 ! × 2 ! × 3 = 4 6 6 5 6 games in which this is done by completing a horizontal or vertical line (there are 6 choices for the winning line, 9 configurations of X's four plays that do not complete a line, and 3 move combinations in which the winning line can be completed). This means that there are 2 5 9 2 0 + 4 6 6 5 6 = 7 2 5 7 6 games that are resolved at the 8 th move.
All other games are resolved at the 9 th move. There are 1 2 7 8 7 2 such games.
Thus the expected number of moves until resolution is E = 9 ! 5 × 3 4 5 6 0 + 6 × 3 1 9 6 8 + 7 × 9 5 9 0 4 + 8 × 7 2 5 7 6 + 9 × 1 2 7 8 7 2 = 4 2 0 3 2 0 3 and hence 1 0 0 0 E = 7 6 2 6 . 1 9 , making the answer 7 6 2 6 .