FS 03 /HOW MAKE IT: very shortly PICTORIAL GUIDE after GOMOKU ENGINE code
go on: < previous page this page 22/30pred_x to xmap 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

Two "pred" sequences first in horizontal direction and second in vertical direction. Both with square sign "x" and "pred" rule 2: More about "pred" rules: see page 21




Sum "pred_x" values from all directions. If any value in "pred_x" array is higher, record new value to array "xmap". Value for "xmap" also depend on value in the same position of square from array "x_tack".




If any value in array "xmap" is top and first (x) player move on this square, next best move for him is (sometime) "dilay". Example for two best moves:

examples in C++
search "pred" sequence in horizontal ( - ) direction with square of unity for more different directions:
//firstly: sum pred_x for all (four) directions ...
//possible values in sum_x array: 0, 1, 2, 3, 4, 11, 12, 13, 20, 21, 22, 30, 31, 40
//secondly: as well as "delay" search in vertical direction >> //for(row = 0; row < 19; row++) { // for(column = 0; column < 19; column++) { // border = (19 - 1) - column; // mat = matRCboard[row][column], mat5 = matRCboard[row][(column + 5)]; // if(border > 3) { // for (loop = 0; loop < 5; loop++) { // write = column + loop; // switch(matRCboard[row][write]) { // case 'X': sumx +=10, xosum += 10; break; // case 'O': sumo +=10, xosum += 10; break; // case 'N': switch(x_tack[row][write]) { // case 400: lagx += 10; break; //... if((column == write) && (lagx > 0)) bacx = 1; if((pred_x[row][write] > 1) && (xshift < 1)) xshift = 1; if((pred_x[row][write] > 10) && (xshift < 2)) xshift = 2; if((pred_x[row][write] > 19) && (xshift < 3)) xshift = 3; if((column == write) && (xshift > 0)) xshift += 10; //... // } //switch(matRCboard) // } //for(loop) // } //if(border) // sum_lagx = sumx + lagx; //... if((delayx == 0) && (dilayx == 0) && (xshift > 0) && (sumo == xosum)) { corn = sum_lagx % 10, sumx /=10, xosum /= 10; sum_lagx = ((sum_lagx - corn)/10) + corn; //example sum digit: 21 (2 + 1 = 3) if((sumx < 3) && (sum_lagx == 3) && (border > 3)) predictx = 1; if((xshift < 4) && (sumx < 2) && (sum_lagx == 2) && (bacx == 0) && (border > 4)) { if((mat == 'N') && (mat5 == 'N')) predictx = 2; } } //...
and change values in array "xmap":
if(predictx > 0) {
  forloop = 0; loop < 5; loop++) {
    write = column + loop;
    switch(x_tack[row][write]) {
        case 0: break;
        case 1: break;
       case 10: break;
      case 100: break;
       default: if((column == write) && ((predictx % 10) == 2)) break;
                if(x_tack[row][write] < 5) {
                 if((xshift == 2) && (xmap[row][write] < 193)) xmap[row][write] = 193;
                 if((xshift == 3) && (xmap[row][write] < 194)) xmap[row][write] = 194;
                }
                if(x_tack[row][write] > 4) {
                 if((xshift == 2) && (xmap[row][write] < 195)) xmap[row][write] = 195;
                 if((xshift == 3) && (xmap[row][write] < 196)) xmap[row][write] = 196;
                }
    }
  }
}
go on: < previous page next page >
FREE SECTOR, 2014 (free alliance of developers Pixoria gomoku plug-in engines) page 22/30