| FS 05 /HOW MAKE IT: very shortly PICTORIAL GUIDE after GOMOKU ENGINE code | |||||
| go on: | < previous page
|
next page > | |||
![]() game board summary flagx add ten flagx values M+ in line /001 M+ in line /002 M+ in line /003 M+ in line /004 LastMove /001 LastMove /002 predict low now predict high now 2d delay, dilay more delay now dilay +, delay + three: better end strategy FS05 summary |
Engine search sequences of signs in accordance with this rules: Sequence have five squares. Sum squares with sign X and free (N) squares with value higher than 99 in array "x_tack" must be three. Values must have different direction than sequence. If engine found sequence: To empty square of sequence (N) without value (zero) on the same position in array "x_tack", record to array "pred_x" value. If sequence count two sign X, value is 100, if one, value is 10. If sequence hasn't X, value is 1.
Next rules: Sequence have sex squares. First an last squares is empty (N). Sum signs X and free (N) squares with value higher than 99 (different direction) in array "x_tack" in four squares inside of sequence, must be two. If engine found sequence: Record values to array "pred_x" only into four squares inside of sequence. All rules is analogical for sign O.
Examples: In array "pred_x" is recorded values for second diagonal direction. Next values for horizontal direction.
Sum values from all directions in array "x_plus". This array contain now informations for searching with "low predict" rules. Engine record final "predict low" values to now free array "xmap" that way: if value in array "flagx" on the same position is bigger than 99 and smaller than 197 record "predict low (C)" values (101 till 109), if "flagx" value is bigger than 999 and smaller than 1097 record to "xmap" array "predict low (M)" values (111 till 119).
|
||||
|
examples in C++
Final hierarchy of "predict low" values: //...
//for (loop = 0; loop < 6; loop++) {pacx[(loop)] = placx[(loop)] = 0;}
//...
//...
//if(flagx[][] > 99) xshift = x_plus[][]; //sum all directions: 1(), 10(x), 100(xx)
//
//if((flagx[][] > 99) && (flagx[][] < 197)) {
// if(xshift == 1) xtemporal[][] = 101;
// if(xshift == 10) xtemporal[][] = 102;
// if(xshift == 100) xtemporal[][] = 103;
// if((xshift > 1) && (xshift < 10) && (pacx[(0)] < (xshift + 1))) {
// pacx[(0)] = xshift, xtemporal[][] = 4; //2, 3, 4
// }
// if((xshift > 10) && (xshift < 20) && (pacx[(1)] < (xshift + 1))) {
// pacx[(1)] = xshift, xtemporal[][] = 5; //11, 12, 13
// }
// if((xshift > 100) && (xshift < 110) && (pacx[(2)] < (xshift + 1))) {
// pacx[(2)] = xshift, xtemporal[][] = 6; //101, 102, 103
// }
// if((xshift > 19) && (xshift < 100) && (pacx[(3)] < (xshift + 1))) {
// pacx[(3)] = xshift, xtemporal[][] = 7; //20, 21, 30
// }
// if((xshift > 109) && (xshift < 200) && (pacx[(4)] < (xshift + 1))) {
// pacx[(4)] = xshift, xtemporal[][] = 8; //110, 111, 120
// }
// if((xshift > 199) && (pacx[(5)] < (xshift + 1))) {
// pacx[(5)] = xshift, xtemporal[][] = 9; //200, 201, 210, 211, 220
// }
// }
//if((flagx[][] > 999) && (flagx[][] < 1097)) {
// if(xshift == 1) xtemporal[][] = 111;
// if(xshift == 10) xtemporal[][] = 112;
// if(xshift == 100) xtemporal[][] = 113;
// if((xshift > 1) && (xshift < 10) && (placx[(0)] < (xshift + 1))) {
// placx[(0)] = xshift, xtemporal[][] = 14; //2, 3, 4
// }
// if((xshift > 10) && (xshift < 20) && (placx[(1)] < (xshift + 1))) {
// placx[(1)] = xshift, xtemporal[][] = 15; //11, 12, 13
// }
// if((xshift > 100) && (xshift < 110) && (placx[(2)] < (xshift + 1))) {
// placx[(2)] = xshift, xtemporal[][] = 16; //101, 102, 103
// }
// if((xshift > 19) && (xshift < 100) && (placx[(3)] < (xshift + 1))) {
// placx[(3)] = xshift, xtemporal[][] = 17; //20, 21, 30
// }
// if((xshift > 109) && (xshift < 200) && (placx[(4)] < (xshift + 1))) {
// placx[(4)] = xshift, xtemporal[][] = 18; //110, 111, 120
// }
// if((xshift > 199) && (placx[(5)] < (xshift + 1))) {
// placx[(5)] = xshift, xtemporal[][] = 19; //200, 201, 210, 211, 220
// }
// }
//...
//...
//if(flagx[][] > 99) xshift = x_plus[][]; //sum all directions: 1(), 10(x), 100(xx)
//
//if((xtemporal[][] == 4) && (xshift == pacx[(0)])) xtemporal[][] += 100;
//if((xtemporal[][] == 5) && (xshift == pacx[(1)])) xtemporal[][] += 100;
//if((xtemporal[][] == 6) && (xshift == pacx[(2)])) xtemporal[][] += 100;
//if((xtemporal[][] == 7) && (xshift == pacx[(3)])) xtemporal[][] += 100;
//if((xtemporal[][] == 8) && (xshift == pacx[(4)])) xtemporal[][] += 100;
//if((xtemporal[][] == 9) && (xshift == pacx[(5)])) xtemporal[][] += 100;
//
//if((xtemporal[][] == 14) && (xshift == placx[(0)])) xtemporal[][] += 100;
//if((xtemporal[][] == 15) && (xshift == placx[(1)])) xtemporal[][] += 100;
//if((xtemporal[][] == 16) && (xshift == placx[(2)])) xtemporal[][] += 100;
//if((xtemporal[][] == 17) && (xshift == placx[(3)])) xtemporal[][] += 100;
//if((xtemporal[][] == 18) && (xshift == placx[(4)])) xtemporal[][] += 100;
//if((xtemporal[][] == 19) && (xshift == placx[(5)])) xtemporal[][] += 100;
//...
//xmap[][] = omap[][] = 0;
//if(xtemporal[][] > 100) xmap[][] = xtemporal[][];
//...
|
|||||
| go on: | < previous page | next page > | |||
| FS03: alike theme | FREE SECTOR, 2016 (free alliance of developers Pixoria gomoku plug-in engines) | page 9/16 | |||