Graphics Reference
In-Depth Information
Fig. 8.5
The cell numbering
Before we can define the priority number of a cell, we must first define the cell
layout and what a winning combination is. The cells are labeled as shown (Fig.
8.5
):
Note that there are eight winning combinations on the board—that is, eight three-
in-a-rows:
0, 1, 2 (top row)
3, 4, 5 (middle row)
6, 7, 8 (bottom row)
0, 3, 6 (left column)
1, 4, 7 (middle column)
2, 5, 8 (right column)
0, 4, 8 (main diagonal)
2, 4, 6 (other diagonal)
One possible approach to determining the priority number of a cell labeled
n
P
n
,is
to add the number of winning combinations that share cell
n
,
W
n
, and the number of
tokens currently on the board that share a winning combination with cell
n
,
,
T
n
:
P
n
=
W
n
+
T
n
This is a plausible approach because:
The number of winning combinations that share cell
n
indicates the overall “use-
fulness” of the cell
The number of tokens that share a winning combination with cell
n
indicates the
current usefulness of the cell, for both forming 3-in-a-row and for blocking the
opponent's 3-in-a-row
Alternatively, wewanted to try aweighted formulawhichwould playmore aggres-
sively, in which the alternate priority number of cell
n
, denoted by
Q
n
, is the weighted
sum of the number of 'my' tokens currently on the board that share winning combi-
nations with cell
n
M
n
, and the number of opponent's tokens currently on the board
that share winning combinations with cell
n,
denoted by
O
n
:
,
Q
n
=
2
M
n
+
O
n
This approach is plausible because: