FS 03 /HOW MAKE IT: very shortly PICTORIAL GUIDE after GOMOKU ENGINE code
go on: < previous page this page 25/30more delay samples next page >


game board
summary

sumx and sumo
sumx to xmap
xmap between x add
xmap between x less
xmap more samples
zeroX and zeroO
xmap editing
x_plus and middx
x_plus and zeroX
x_away and o_away
xRCboard and liftx
xRCboard add & less
xmap to lagx
lagx 5000 & x_away
lagx 100 & x_away
lagx 10 and lagx 1
lagx to x_tack
xRCboard allways
flagx allways

delayx
dilayx
pred_x
pred_x to xmap
choose from flagx
more delay
more delay samples
three
crossmix
more delay use
flag to RCboard

summary

More delay is for defence. Here, in this sample, is engine second (O) player. First player have two dilay structures. In "flagx" array is dilay(x) structure recorded in values 197 and 1097. More about dilay structures: see page 20
Engine (O) choose top value (1097) and play, but first player (X) have still one else dilay structure:





In array "x_plus" is recorded information about structure (more delay) common for both dilayx structures. If this here second player detect, only one move disturb both structures of first player:
Details about "more delay" use: see page 28





Other sample with two "bigger" (CC) structures. Second (O) player chose one top "flagx" value (200), but first player have still next one "bigger" structure. More about "bigger" structures: see page 18




In array "x_plus" is marks on sqares if their positions common for both CC structures. Second (O) player move on this and disturb both CC structures of first player(X). For more about array "x_plus" see next page.




Sequences of squares with special squares positions for write "more delays" values. Square with white borders is depend on label for exception. Blue number 1 - 19 is order sequence in searching.




Square with red borders is label denotative exception. Label (L) is insert to sequence XNNXXNN (XNNXXLN) and use for make difference in direction of search ( >> ) between NNXX and XXNN so that square with "more delay" value was only inside XNLXX (XXLNX, XNLXXLNX):

examples in C++
Search structures in array "matRCboard" and save "more delay" values to array "x_plus" in direction from left to right ( >> ):
//this sample code is continue from previous page:
// border = (19 - 1) - column; // mat1 = matRCboard[row][(column + 1)], mat2 = matRCboard[row][(column + 2)]; // mat3 = matRCboard[row][(column + 3)], mat4 = matRCboard[row][(column + 4)]; // mat5 = matRCboard[row][(column + 5)], mat6 = matRCboard[row][(column + 6)]; // mat7 = matRCboard[row][(column + 7)], mat = matRCboard[row][column]; // if(predictx > 0) { // sumx = xosum = lagx = 0; // for(loop = 0; loop < predictx; loop++) { // write = column + loop; // switch(matRCboard[row][write]) { // case 'X': sumx++, xosum++; break; // case 'N': lagx++; //<------------------- shift text to left if((loop > 0) && (loop < (predictx - 1)) && (sumx > 0)) { if((matRCboard[row][(write + 1)] == 'X') && (x_plus[row][write] < xshift)) { x_plus[row][write] = xshift; //search(.)>> x.x (universal) } } if((loop > 1) && (loop < (predictx - 2)) && (sumx == 2) && (xosum == 2)) { if((matRCboard[row][(write + 1)] == 'N') && (matRCboard[row][(write + 2)] == 'X')) { if(x_plus[row][write] < xshift) x_plus[row][write] = xshift; //>> xx.-x (universal) } } if((loop > 1) && (loop < (predictx - 2)) && (sumx == 0) && (xosum == 1)) { if((matRCboard[row][(write + 1)] == 'X') && (matRCboard[row][(write + 2)] == 'X')) { if(x_plus[row][write] < xshift) x_plus[row][write] = xshift; //>> x-.xx (universal) } } if((predictx == 6) && (loop == 2) && (sumx == 1) && (xosum == 1) && (lagx == 2)) { if((mat3 == 'N') && (mat4 == 'X')) x_plus[row][write] = xshift; //>> -x.-x- (6) } if((predictx == 6) && (loop == 3) && (sumx == 0) && (xosum == 1) && (lagx == 3)) { if(mat4 == 'X') x_plus[row][write] = xshift; //>> -x-.x- (6) } if((predictx == 5) && (loop == 3) && (sumx == 3) && (xosum == 3) && (lagx == 1)) { if(mat4 == 'N') x_plus[row][write] = xshift; //>> xxx.- (5) } if((predictx == 5) && (loop == 1) && (sumx == 0) && (lagx == 2)) { x_plus[row][write] = xshift; //>> -.xxx (5) } if((predictx == 5) && (loop == 0) && (mat4 == 'N')) x_plus[row][write] = xshift;
if((predictx == 5) && (loop == 4) && (sumx == 3) && (lagx == 2)) { x_plus[row][write] = xshift; } if((predictx == 6) && (loop == 3) && (sumx == 2) && (lagx == 2)) { if((x_plus[row][write] < 5001) && (x_plus[row][write] < xshift)) { x_plus[row][write] = xshift; } } if((predictx == 6) && (loop == 2) && (xosum == 0) && (lagx == 3)) { if(x_plus[row][write] < xshift) x_plus[row][write] = xshift; } if((predictx == 6) && (loop == 1) && (sumx == 0) && (lagx == 2)) { if((mat4 == 'N') && (x_plus[row][write] < xshift)) x_plus[row][write] = xshift; } if((predictx == 6) && (loop == 4) && (sumx == 2) && (lagx == 3)) { if((x_plus[row][write] < 5001) && (x_plus[row][write] < xshift)) { x_plus[row][write] = xshift; } } if((predictx == 7) && (loop == 1) && (sumx == 0) && (lagx == 2)) { if((mat4 == 'N') && (mat5 == 'N') && (mat6 == 'N') && (x_plus[row][write] < xshift)) { x_plus[row][write] = xshift; } } if((predictx == 7) && (loop == 4) && (sumx == 2) && (lagx == 3)) { if((mat5 == 'N') && (mat6 == 'N') && (x_plus[row][write] < 5001)) { if(x_plus[row][write] < xshift) x_plus[row][write] = xshift; } } if((predictx == 7) && (loop == 5) && (sumx == 2) && (lagx == 4)) { if((mat6 == 'N') && (x_plus[row][write] < xshift)) x_plus[row][write] = xshift; } if((predictx == 7) && (loop == 2) && (xosum == 0) && (lagx == 3)) { if((mat5 == 'N') && (mat6 == 'N') && (x_plus[row][write] < xshift)) { x_plus[row][write] = xshift; } } if((predictx == 8) && (loop == 2) && (xosum == 0) && (lagx == 3)) { if((mat5 == 'N') && (mat6 == 'N') && (mat7 == 'N')) x_plus[row][write] = xshift; } if((predictx == 8) && (loop == 5) && (sumx == 2) && (lagx == 4)) { if((mat6 == 'N') && (mat7 == 'N')) x_plus[row][write] = xshift; } //-------------------> shift text back // sumx = 0; break; // } //switch // } //for // } //if // if... // if((mat == 'X') && (border > 5) && (mat1 == 'N') && (mat2 == 'N')) { // if((mat3 == 'X') && (mat4 == 'X') && (mat5 == 'N') && (mat6 == 'N')) { // x_plus[row][column + 5)] = 5001; //X--xx-- (insert label 5001 to *) X--xx*- // } // } // if((mat == 'N') && (border > 5) && (mat1 == 'N') && (mat2 == 'X')) { // if((mat3 == 'X') && (mat4 == 'N') && (mat5 == 'N') && (mat6 == 'X')) { // if(x_plus[row][(column + 4)] < 5001) x_plus[row][column + 1)] = 0; //-.xx--x // } // } // sumx = xosum = sum_lagx = lagx = predictx = xshift = 0; //reset of counters // sumo = ... // } //}
//... //if(x_plus[][] >= 5001) x_plus[][] -= 5001; //clear labels in array: //...
add values from other direction (perhaps horizontal add vertical) to "x_plus" array:
//search in vertical direction
//...
//if(...)xtemporal[][] = xshift;
//...
x_plus[][] += xtemporal[][];
xtemporal[][] = 0;
//...
go on: < previous page next page >
FREE SECTOR, 2014 (free alliance of developers Pixoria gomoku plug-in engines) page 25/30