Just a simple demo. The goal was to minimize the upper bound of needed checks along the tic-tac-toe gameboard.
Brief Explanation
The result was achieved by assuming that the elements of the 3x3 matrix could be mapped to the [1,9] interval in N by the bijective application (from [1,3]x[1,3] to [1,9]):
f(i,j)=i+3(j-1);
Now let n=f(i,j), for each i,j in [1,3].
-
If n is 5, there are 4 checks needed (the middle row, the middle column, both diagonals);
-
If n is any other odd number (1,3,7,9), it stays in the corner, so ther are only 3 checks needed (a row, a column, a diagonal);
-
For even numbers the upper bound decreases to 2 (a row and a column only).
So the number of needed controls stays between 2 and 4, in a maximum
range of 8 (3 rows, 3 columns, 2 diagonals) - it would be nice if
tic-tac-toe was not a complete game in which neither player can
win...:P
Here it goes the code and the link to the main article.
Posted in Java Math on 14 January 2009 at 22:11:35
Permalink -
Write Comment -