| 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 |
Free square position around and near by playing area border is for both players restrictive. Ass well restrictive for player is free square around and near by square with rival sign. Perhaps: for first (x) player is restrictive free sqares around and near by playing area border and also around abd near by square with second (o) player sign. Sample using this for square handycap: see page 12 arrays with values of restriction for first (x_away) and second (o_away) player:
other sample of values:
some one square positions (four) has playing area border on both opposite sides, they are it corns only in diagonal directions Firsrt player square (sign "x") is line wire for "x_away" values and send (shift) them to next square in actual direction. As well for second player square (o) and "o_away" values. |
||||
|
examples in C++
write values to two arrays named "x_away" and "o_away" from left to right ( >> ): int minor[2] = {6, 2};
for (row = 0; row < 19; row++) {
for (column = 0; column < 19; column++) {
if(column == 0){ //here begins row (left border)
for (loop = 0; loop < 2; loop++) {
o_away[row][(column + loop)] += minor[(loop)]; //>> B(border)|6|2|
x_away[row][(column + loop)] += minor[(loop)]; //>> B|6|2|
}
}
switch(matRCboard[row][column]) {
case 'O': sumo++;
for (loop = 0; loop < 2; loop++) {
border = (19 - 1) - (column + loop); //watch right border
if(sumx > 0) o_away[row][(column + loop)] += minor[(loop)]; //x|6|2|
if(border < 1) break; //here is right border
}
if(column == 0) x_away[row][(column + 1)] -= minor[(1)]; //B|o|(2 - 2)|
ashifto += o_away[row][column]; //SHIFT >
o_away[row][column] = ashiftx = 0;
sumx = 0; break;
case 'X': sumx++;
for (loop = 0; loop < 2; loop++) {
border = (19 - 1) - (column + loop); //watch right border
if(sumo > 0) x_away[row][(column + loop)] += minor[(loop)]; //o|6|2|
if(border < 1) break; //here is right border
}
if(column == 0) o_away[row][(column + 1)] -= minor[(1)]; //B|x|(2 - 2)|
ashiftx += x_away[row][column]; //SHIFT >
x_away[row][column] = ashifto = 0;
sumo = 0; break;
case 'N': border = (19 - 1) - column; //if border = 0, you are: |here|B
if((sumx > 0) && (border > 0)) { //x|-|?| >> x|6|2|
o_away[row][column] += minor[(0)];
o_away[row][(column + 1)] += minor[(1)];
}
if((sumo > 0) && (border > 0)) { //o|-|?| >> o|6|2|
x_away[row][column] += minor[(0)];
x_away[row][(column + 1)] += minor[(1)];
}
x_away[row][column] += ashiftx; //and end SHIFT
o_away[row][column] += ashifto; //and end SHIFT
ashiftx = ashifto = sumx = sumo = 0; //reset of counters
} //switch
}
ashiftx = ashifto = sumx = sumo = 0; //reset of counters
}
|
|||||
| go on: | < previous page | next page > | |||
| iM007: alike theme | FREE SECTOR, 2014 (free alliance of developers Pixoria gomoku plug-in engines) | page 10/30 | |||