|
Writing a programme to play “Tic Tac Toe” |
This Page as a Word
Doc |
|
Numbered by Row & Column
These are the numbers I chose for the cells, read them as (11)
Row1 Column1 (23) Row2 Column3 This was a “Lucky” choice as you can see from
the following. Now you can take these “mappings” and by adding them,
subtracting them or multiplying them you can extract useful information that
can be used in the Tic Tac Toe programme to identify where the cell is.
|
|
11 |
12 |
13 |
|
21 |
22 |
23 |
|
31 |
32 |
33 |
|
|
Forward Diagonal (+) Add row and column values.
Now, this is interesting! If you add the row number and
column number in the grid above together, 3 + 1 = 4, 2 + 2 = 4 and 1 + 3 =
4, you get this:- And can you see, you can pick out the forward diagonal as
all the 4’s |
|
|
Backward Diagonal (-)
Subtract row and column values. If you subtract the row number
and column number you get this:-
You can pick out the backward diagonal (0)
|
|
|
English Cross (-)
Subtract row and column values
If you subtract the row number and column number you get this:- And can
you see, you can pick out the English cross, or PLUS sign as all the 1’s |
|
|
Corners (*) By multiplying the row and column values you get
this:-
All the corners are odd numbers (1,3,9) the rest are
even (2,4,6) |
|