Touching Tiles

thepenguin

Flying Penguin
Addon Developer
Joined
Jul 27, 2013
Messages
220
Reaction score
1
Points
16
Location
Earth-Moon Lagrange Point (L4)
Okay, here's something I have been wondering about for a while.

Given a grid of A by B square tiles, there are [math]{AB \choose n}[/math] ways to distribute n markers on those tiles (each marker takes up 1 tile, not split between tiles. You can consider it a 2D binary array with n "true" values placed around). For convenience, we can call that matrix M.

Now, if we consider the sum of all the true values, we get a sum of n ([math]\sum M_{AB} = n[/math]).

Here's the question:
What if instead of just adding up the values with each "marker" being 1, each "marker" counted for the number of continuous* tiles it touched. (each block of tiles would count for the number of tiles in that block squared)

*continuous = orthoganally touching (no diagonals)

For example:
In a 4x5 array with six markers, like this:

_ _ X _ _
X _ X X _
_ _ _ _ _
_ X _ X _

you would get a "score" of 1+1+1+9=12 (3 singles and a triple)

so, assuming the markers are randomly distributed in the grid, what is the expected value of the score?
 
Last edited:

RisingFury

OBSP developer
Addon Developer
Joined
Aug 15, 2008
Messages
6,427
Reaction score
492
Points
173
Location
Among bits and Bytes...
_ _ X _ _
_ _ X X _
_ _ _ _ _

This would count as 3^2 = 9 and not 2^2 + 3^2 + 2^2 = 17? So each of the markers is only included once?

In that case, how do you deal with something like this:

_ X X X X _

Is it 3^2 + 1^2 = 10 or 2^2 + 2^2 = 8?
 

thepenguin

Flying Penguin
Addon Developer
Joined
Jul 27, 2013
Messages
220
Reaction score
1
Points
16
Location
Earth-Moon Lagrange Point (L4)
_ _ X _ _
_ _ X X _
_ _ _ _ _

This would count as 3^2 = 9 and not 2^2 + 3^2 + 2^2 = 17? So each of the markers is only included once?

In that case, how do you deal with something like this:

_ X X X X _

Is it 3^2 + 1^2 = 10 or 2^2 + 2^2 = 8?

_ X X X X _ would be 16. It's a block of four markers. It's treated the same as:

_ X X _
_ X X _

or

_ X X X _
_ _ X _ _

This one would count as 25:

_ _ X _ _
_ X X X _
_ _ X _ _

as would this one

_ X X X X X _
 
Last edited:
Top