| FS 03 /HOW MAKE IT: very shortly PICTORIAL GUIDE after GOMOKU ENGINE code | |||||
| go on: | < previous page
|
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 "dilay" rule 4. More about "x_tack": see page 17
Change on higher values in array "flagx".
Rule 1 (more combination) for "dilay" sequence of squares: accept only square values with different directions from actual searching direction.
Rule 2 and 3 (more combination) for "dilay" sequence of squares:
Rule 4 (more combination) for "dilay" sequence of squares: (squares 1 and 6 must be free)
Rule 5 and 6 (more combination) for "dilay" sequence of squares: (squares 1 and 6 must be free)
|
||||
|
examples in C++
search "dilay" structures in horizontal ( - ) direction: //for(row = 0; row < 19; row++) {
//for(column = 0; column < 19; column++) {
//as well as "delay" search in vertical direction >>
//...
sum_lagx = sumx + lagx;
if((delayx == 0) && (sumo == xosum)) {
if((sumx < 30) && (sum_lagx > 21) && (sum_lagx < 24) && (border > 3)) dilayx = 1;
if((sumx < 30) && (sum_lagx > 12) && (sum_lagx < 15) && (border > 3)) dilayx = 1;
if((sumx < 30) && (sum_lagx > 3) && (sum_lagx < 6) && (border > 3)) dilayx = 1;
if((dilayx == 0) && (bacx == 0) && (border > 4) && (mat == 'N') && (mat5 == 'N')) {
if((sumx < 20) && (sum_lagx == 21)) dilayx = 1; //(rule 4)
if((sumx < 20) && (sum_lagx == 12)) dilayx = 1; //(rule 5)
if((sumx < 20) && (sum_lagx == 3)) dilayx = 1; //(rule 6)
}
}
and change values in arrays "flag":
if(dilayx == 1) {
for(loop = 0; loop < 5; loop++) { //search in vertical direction >>
write = column + loop;
switch(x_tack[row][write]) {
case 400: if(flagx[row][write] < 5100) flagx[row][write] = 5100; break;
case 300: if(flagx[row][write] < 5100) flagx[row][write] = 5100; break;
case 200: if(flagx[row][write] < 5100) flagx[row][write] = 5100; break;
case 40: if(flagx[row][write] < 1098) flagx[row][write] = 1097; break;
case 30: if(flagx[row][write] < 1098) flagx[row][write] = 1097; break;
case 20: if(flagx[row][write] < 1098) flagx[row][write] = 1097; break;
case 4: if(flagx[row][write] < 199) flagx[row][write] = 197; break;
case 3: if(flagx[row][write] < 199) flagx[row][write] = 197; break;
case 2: if(flagx[row][write] < 199) flagx[row][write] = 197; break;
}
}
}
add change of values from other direction (perhaps horizontal add vertical) to "flagx" array:
//search in vertical direction //... //case 40: if(xtemporal[][] < 199) xtemporal[][] = 197; break; //diagonal 2 ( / ) //case 30: if(xtemporal[][] < 199) xtemporal[][] = 197; break; //diagonal 1 ( \ ) //case 10: if(xtemporal[][] < 199) xtemporal[][] = 197; break; //horizontal ( - ) //... if((flagx[][] == 197) && (xtemporal[][] == 197)) flagx[][] = 198; 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 20/30 | |||