|HOW IT WORKS - BRIEF GUIDE TO THIS ENGINE|
|obsah:||looking for sequences according to RCboard rules:||page 4/12|
inputs and outputs
first 2 layers
flag rules (1D)
flag combination (2D)
go to page:
The engine searches the game board (2D array) in one of eight directions and reaches a free square ( N ). Now it will add the symbol counter values ( X a O ) to corresponding squares as a basic evaluation of these squares at the lowest level, and continues with a higher-level test:
The valuation of a free square depends on the situations in its close (1D) surroundings.
So by 'surroundings' of a free square, we mean the squares before and after it in a line determined by the specific search direction. If we search the game board e.g. top-down, this means the squares in the same column, above and below the current free square. The squares below it are 'ahead' in this search direction.
The engine is still at the same free square. All tests are run on free squares only and the engine knows this, of course. First, the surroundings is tested from the point of view of player one ( X ). For player two, everything is done the same way, except that the two symbols are swapped.
The engine now tests the surroundings (ahead and in search direction) of the free square ( N ) according to this rules, and in this order:
(xRCboard rules) search direction >>
01. N X N N (NXXNN, NXXXNN, atd.) ( ? ) yes: increase value ( N ) by 5
02. N X N N N (NXXNNN, NXXXNNN, atd.) ( ? ) yes: increase value ( N ) by 5
03. N X N X N (only >>) ( ? ) yes: increase value ( N ) by 5
04. N X N X N N ( ? ) yes: increase value ( N ) by 5
05. X X X N N ( ? ) yes: increase value ( N ) by 5
06. N X X X N N (X/O) ( ? ) yes: increase value ( N ) by 5
06+ N X X X N N B ( ? ) yes: increase value ( N ) by 5
07. X X N X ( ? ) yes: increase value ( N ) by 5
08. N X X N X N ( ? ) yes: increase value ( N ) by 10
09. X X N X X ( ? ) yes: value ( N ) is 50
10. X X X N X ( ? ) yes: value ( N ) is 50
11. X N O (XXNO, XXXNO) ( ? ) yes: value ( N ) is 0
12. (B/O) N B ((B/O)XNB, (B/O)XXNB, (B/O)XXXNB) ( ? ) yes: value ( N ) is 0
13. (B/O) X N (N/X) O ((B/O)XXN(N/X)O) ( ? ) yes: value ( N ) is 0
14. (B/O) X N (N/X) (N/X) O ( ? ) yes: value ( N ) is 0
15. (B/O) X N (N/X) B ((B/O)XXN(N/X)B) ( ? ) yes: value ( N ) is 0
16. (B/O) X N (N/X) (N/X) B ( ? ) yes: value ( N ) is 0
17. X X X X N ( ? ) yes: value ( N ) is 50
B - this is not a square, but a game board edge (border)
(X/O) the square has an X or O symbol
(B/O) edge of game board or O symbol
(N/X) free square or X symbol
click here to view xRCboard rules in images
The engine follows these rule in all 8 directions of search. Rule 03. is symmetrical forward forward >> and << back and the engine doesn't use it in reverse direction (forward-only >>).
"Forward" and "back" are the only two possible ways to advance along a line (1D). A plane (2 dimensions) has an infinite amount of differently oriented lines. Gomoku rules narrow down our interest in line orientation (relative to a selected orthogonal coordinate system) to four. Four times two (forward and back) is eight directions. Differently oriented lines on a plane will intersect, however. To avoid distortions or loss of information in these line intersections, the engine uses this method:
If during the search the engine advances along parallel lines (same orientation), the values (evaluations of individual free squares) can be written without restriction. Even if that means changing a value that was found and written in the forward direction, when going back. The rule design accounts for this already. If we want to prevent this in some cases (forward-only >>), it's simple.
That's why the engine will first search the board in two opposite directions and continuously save the gathered information to a helper 2D array. Only after this operation completes, it will merge the data from the helper array to the work array.
The original value at a certain place in the work array is overwritten only if the new value is greater:
if(xRCboard[row][column] < xtemporal[row][column])
xRCboard[row][column] = xtemporal[row][column];
xtemporal[row][column] = 0; //reset temporary
continue on next page . . .
|go top||independent Machines develop lab (2013)||page 4/12|