|HOW IT WORKS - BRIEF GUIDE TO THIS ENGINE|
|obsah:||basic analysis, move evaluation at lowest level:||page 3/12|
inputs and outputs
first 2 layers
flag rules (1D)
flag combination (2D)
go to page:
Basic step of the analysis is a search of the game board in eight directions. Engine looks for specific sequences (strings) of characters.
According to the game rules, the player can only place their symbol in an empty square. As the game progresses, the amout of free squares ( N ) diminishes and so does the set of next possible moves.
It's useful to evaluate every free square. To win, every player must try to:
1. Occupy some suitable free squares in close vicinity with their symbol,
2. similarly, prevent the opponent to occupy certain free squares,
3. make the opponent occupy certain free squares.
Thus, the player must analyze the placement of their, but also the opponent's symbols on the game board. That is, examine the game board in parallel, from both perspectives.
A single free square can then be valued differently, depending on whose point of view we use.
For this reason, the engine will create for itself two virtual game boards (2D arrays), One for continuous recording of free square values from its POV, and a second one for opponent's POV.:
int xRCboard for player one ( X ) 
int oRCboard for player two ( O ) 
The engine searches the game board:
1. horizontally, each row from left to right and back
2. vertically, each column top-down and back up again
3. diagonally, from top-left to bottom-right and back
4. diagonally, from top-right to bottom-left and back
and looks for character patterns (sequences) on several levels:
lowest level: the engine advances in one of eight directions, square by square, and counts symbols of each player:
int sumx, int sumo, int xosum
example: read direction >> X N O X X sumx = 20, sumo = 0, xosum = 30
example: read direction >> X O N X O sumx = 0, sumo = 10, xosum = 20
example: read direction >> N N X N O sumx = 0, sumo = 10, xosum = 10
when the engine reaches a free square: read direction >> N O X X N
sumx = 20, sumo = 0, xosum = 30;
xRCboard[row][column] = xRCboard[row][column] + sumx;
oRCboard[row][column] = oRCboard[row][column] + sumo;
sumx = sumo = xosum = 0; //reset of counters
In this free square (of a virtual game board for a player), the engine will add the value of corresponding counter. The resulting number saved there is now the base value of this free square (at the lowest level).
click here to view images
continue on next page . . .
|go top||independent Machines develop lab (2013)||page 3/12|