Three equal die rolls in a row in a $3\times 3$ array If 9 six-sided dice were rolled consecutively and displayed in a $3\times3$ format, what is the probability of a line of 3 of the same number occurring? Considering the 8 ways that are possible; 3 horizontally, 3 vertically and 2 diagonally.
The example below shows a line of three diagonally; $A_1, B_2$ and $C_3$.
$$\begin{array}{ccc}
\begin{array}{ccc}
A_1&A_2&A_3\\B_1&B_2&B_3\\C_1&C_2&C_3
\end{array}
&\to&
\begin{array}{ccc}
2&4&5 \\ 4&2&3 \\ 6&6&2
\end{array}
\end{array}
$$
What are the players odds of winning given that only one line of three is needed to win. Thanks so much to the smart person that can work this out and possibly explain in simple terms the process of working it out!
Very much appreciated!
=)
 A: I think it's pretty difficult to come up here with an explicit formula, making symmetry or independence arguments. There's a lot to enumerate and many possibilities to mess up.
However, the problem is small enough to solve by brute-force, enumerating all possibilities. I did that and came up with the following code in Python/numpy (where I used only one symmetry argument to reduce the runtime by a factor of $6$, namely that the last die always shows a $1$):
from numpy import *
def cvec(v):
    return all(v==v[0])

def cmat(A):
    return (cvec(A[:,0]) or cvec(A[:,1]) or cvec(A[:,2]) or 
            cvec(A[0,:]) or cvec(A[1,:]) or cvec(A[2,:]) or
            cvec(diag(A)) or cvec(diag(A[:,::-1])))

def arrinc(A,i=0,j=0):
    A[i,j]+=1
    if A[i,j]==7:
        A[i,j]=1
        i+=1
        if i==3:
            i=0
            j+=1
        arrinc(A,i,j)

N=6**8
m=0
A=ones([3,3])
for i in range(N):
    if cmat(A):
        m+=1
    arrinc(A)
print m,N,1.0*m/N

The computation took about $4-5$ minutes on my laptop with the following results: There are $N=6^8=1679616$ possibilities at all with $m=341036$ favourable outcomes, giving a probability of $p\approx0.203044029111$
A: I agree with Elmar that a simple closed form seems unlikely. Nevertheless, you can apply some mathematics to perform a more efficient computation. This code calculates the number of winning configurations using inclusion–exclusion, by considering all $2^8=256$ subsets of the $8$ lines, calculating the number of values that can be independently chosen if all lines in the subset are constant, and adding up the signed contributions. The result coincides with Elmar's,
$$
p=\frac{2046216}{6^9}=\frac{2046216}{10077696}=\frac{85259}{419904}\approx0.203\;.
$$
This could also be done e.g. for a $5\times5$ square, where brute-force enumeration would be infeasible.
