I know this question seems arbitrary, but it actually applies to a matching game that I'm writing.
I randomly typed the following letters and created a 6x6 array using the letters A, S, D, and F.
SADFSD ASDASD FDASAS DFDASD FDAFSD ADSFAS
Note that there are many ways to match 3 or more tiles (allowing matches in all 8 directions). For example, let's hide all letters in that array to show only A's.
.A.... A..A.. ..A.A. ...A.. ..A... A...A.
I can easily draw a line between 5 of those 9 A's.
I've found that I can randomly generate numerous random 6x6 arrays using 4 tile types and I never end up with an array with no matches of 3 or more adjacent tiles.
Yet, it is possible. If I very carefully lay things out I can create an array with no matches.
ASASAS DFDFDF ASASAS DFDFDF ASASAS DFDFDF
So, what are the odds that I can randomly generate a 6x6 array like this and end up with no matches of 3 or more?
I would like to know for 2 reasons. I want to know if it's necessary to add something to my game to automatically prevent a matchless board from occurring. If the odds are low enough I can simply allow the player to give up if they work themselves into a corner with no matches.
The other reason is that I want to know how many tile types I can put into an array of size WxH and still have very low odds of no matches. If I have an 8x8 array, how many tile types can I have and still have the odds be less than 1 in a billion?
If I can answer the second question then I can set up the game to allow lots of different sizes of boards with lots of sets of tiles without me needing to play test every possible variant.