| 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 |
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, 40and 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 | ||||