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

Search special sequences of squares with using information from arrays "matRCboard" and "x_tack".
This example of sequence is for "delay" rule 1. More about "x_tack": see page 17





Change on higher values in array "flagx".




Rule 1 (more combination) for "delay" sequence of squares: accept only square values with different directions from actual searching direction.




Rule 2 for (more combination) "delay" sequence of squares: (squares 1 and 6 must be free)

examples in C++
search "delay" structures in horizontal ( - ) direction:

for (row = 0; row < 19; row++) {
  for (column = 0; column < 19; column++) {
    mat = matRCboard[row][column], mat5 = matRCboard[row][(column + 5)];
    border = (19 - 1) - column;  //if (border == 0) end of game area (last square)
    if(border > 3)) {
      for (loop = 0; loop < 5; loop++) {  //search in horizontal direction >>
        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;  //diagonal 2 ( / )
                          case 300: lagx += 10; break;  //diagonal 1 ( \ )
                          case 200: lagx += 10; break;  //vertical   ( | )
                           case 40: lagx += 10; break;
                           case 30: lagx += 10; break;
                           case 20: lagx += 10; break;
                            case 4: lagx += 1; break;
                            case 3: lagx += 1; break;
                            case 2: lagx += 1; break;
                      }
                      //switch(o_tack[row][write]) {...}
                      if((column == write) && (lagx > 0)) bacx = 1;
                      //if((column == write) && (lago > 0)) ...
        }
      }
    }  //if (border)
    sum_lagx = sumx + lagx;
    //sum_lago = ...
    if((sumx == xosum) && (sumx < 30) && (sum_lagx > 30) && (border > 3)) delayx = 1;
    if((sumx == xosum) && (sumx < 20) && (sum_lagx == 30) && (bacx == 0) && (border > 4) {
     if((mat == 'N') && (mat5 == 'N')) delayx = 1;
    }
    //if( ... ) delayo = 1;
and change values in arrays "flag":
    if(delayx == 1) {
      for(loop = 0; loop < 5; loop++) {  //search in horizontal direction >>
        write = column + loop;
        switch(x_tack[row][write]) {
            case 400: if(flagx[row][write] < 6000) flagx[row][write] = 6000; break;
            case 300: if(flagx[row][write] < 6000) flagx[row][write] = 6000; break;
            case 200: if(flagx[row][write] < 6000) flagx[row][write] = 6000; break;
             case 40: if(flagx[row][write] < 1098) flagx[row][write] = 1098; break;
             case 30: if(flagx[row][write] < 1098) flagx[row][write] = 1098; break;
             case 20: if(flagx[row][write] < 1098) flagx[row][write] = 1098; break;
              case 4: if(flagx[row][write] < 199) flagx[row][write] = 199; break;
              case 3: if(flagx[row][write] < 199) flagx[row][write] = 199; break;
              case 2: if(flagx[row][write] < 199) flagx[row][write] = 199; break;
        }
      }
    }
    //if((delayo == 1) { ... }
    //reset counters (sumx = xosum = lagx = bacx = delayx = 0, sumo = ...)
  }
}
add change of values from other direction (perhaps horizontal add vertical) to "flagx" array:
//search in vertical direction
//...
//case 40: xtemporal[][] = 1098; break;  //diagonal 2 ( / )
//case 30: xtemporal[][] = 1098; break;  //diagonal 1 ( \ )
//case 10: xtemporal[][] = 1098; break;  //horizontal ( - )
//...
if((flagx[][] == 1098) && (xtemporal[][] == 1098)) flagx[][] = 1099;
if(flagx[][] <= xtemporal[][]) flagx[][] = xtemporal[][];
xtemporal[][] = 0;
go on: < previous page next page >
iM007: alike theme FREE SECTOR, 2014 (free alliance of developers Pixoria gomoku plug-in engines) page 19/30