| 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 use filter with "flagx" array and special values (delay, dilay, CC, MC ...) separate to now free array "x_away". More about "flagx": see page 02, about "delay" etc.: see pages FS03 (19)
In array "x_away" engine search sequences of signs according the "more delay" rules in all differrent directions. More "x_away" values inside one sequence engine add to one value and write to special positions in "more delay" sequence in now free array "pred_x".
Rules (sequences of signs) for searching (from left to right) "more delay". On right side is marked (violet colour) squares, where engine read and add more "x_away" values. In white frames it makes no odds on order of signs.
Rules for write sum of values (from "x_away") to array "pred_x". Positions of write is marked (violet). About exceptions (squares in white frames): see pages FS03 (25)
Sample with "more delay". Engine reduce "x_away" values 100 and 10 on values 1.
Next sample. See on "flagx" value 198. Marked two different direction "dilay" sequences in one square. In "x_away" array therefore is value 2. Engine use "more delay" for defend. In all samples of this page engine is second (O) player.
|
||||
|
examples in C++
read "flagx" values , write "x_away" values and count values: //... if (flagx[][] == 197) x_away[][] = 1, dilCx++; //dilay (C) if (flagx[][] == 198) x_away[][] = 2, dillCx++; //dilax (C) and dilay (C) if (flagx[][] == 199) x_away[][] = 1, delCx++; //delay (C) if ((flagx[][] > 199) && (flagx[][] < 1000)) x_away[][] = 1, xCC++; //(C + C) if (flagx[][] == 1097) x_away[][] = 10, dilMx++; //dilay (M) if (flagx[][] == 1098) x_away[][] = 100, delMx++; //delay (M) if (flagx[][] == 1099) x_away[][] = 200, dellMx++; //delay (M) and delay (M) if ((flagx[][] > 1099) && (flagx[][] < 2000)) x_away[][] = 100, countMC++; //(M + C) if (flagx[][] > 1999) x_away[][] = 1000, countMMx++; //(M + M) //...convert values: //...
if ((sum_lagx > 0) && (sum_lagx < 1000)) {
xshift = ((sum_lagx % 10) + ((sum_lagx / 10) % 10) + (sum_lagx / 100));
}
//sample 123: 1 + 2 + 3 = 6
//...
use "more delay" to defend, engine are second (O) player:
//...
if (plusx < pred_x[][]) plusx = pred_x[][]; //maximal "more delay" value
if (xmax < flagx[][]) xmax = flagx[][]; //maximal "flagx" value
//...
//special reserves:
//If who is zero, engine are second (O) player.
//---------------------------------------------
//baco = 0;
//if((who == 0) && (plusx > 1) && (omax < 1097) && (xmax > 196) && (xmax < 2000)) {
// if((dilCo + dillCo + delCo + oCC) == 0)) baco = 1;
// }
//if((who == 0) && (plusx > 1 && (omax < 1097)) && (xmax > 1096) && (xmax < 2000)) {
// if(((dilCo + dillCo + delCo + oCC) > 0)) {
// if((dilMx + delMx + dellMx + countMCx) > 0) baco = 2;
// }
// }
//if((who == 0) && (plusx > 1) && (omax < 1098) && (xmax > 1097) && (xmax < 2000)) {
// if((dilMo > 0) && ((delMx + dellMx + countMCx) > 0)) baco = 2;
// }
//...
//sumo = 0;
//if((baco == 1) && (pred_x[][] == plusx) {
// if((sumo == 0) && (flagx[][] > 1099)) flagx[][] = 1100, sumo = 1;
// if((sumo == 0) && (flagx[][] == 1099)) flagx[][] = 1100, sumo = 1;
// if((sumo == 0) && (flagx[][] == 1097)) flagx[][] = 1100, sumo = 1;
// if((sumo == 0) && (o_plus[][] > 999)) flago[][] = 1100, sumo = 1; //LastMove
// if((sumo == 0) && (flago[][] > 999)) flago[][] = 1100, sumo = 1;
// if((sumo == 0) && (flagx[][] > 199) && (flagx[][] < 1000)) flagx[][] = 1100, sumo = 1;
// if((sumo == 0) && (flagx[][] == 198)) flagx[][] = 1100, sumo = 1;
// if((sumo == 0) && (flago[][] > 99)) flago[][] = 1100, sumo = 1;
// if(sumo == 0) flagx[][] = 1100, sumo = 1;
// }
//if((baco == 2) && (pred_x[][] == plusx) {
// if((sumo == 0) && (flagx[][] > 1099)) flagx[][] = 1100, sumo = 1;
// if((sumo == 0) && (flagx[][] == 1099)) flagx[][] = 1100, sumo = 1;
// if((sumo == 0) && (flagx[][] == 1097)) flagx[][] = 1100, sumo = 1;
// if((sumo == 0) && (o_plus[][] > 999)) flago[][] = 1100, sumo = 1; //LastMove
// if((sumo == 0) && (flago[][] > 999)) flago[][] = 1100, sumo = 1;
// if((sumo == 0) && (flago[][] == 198)) flago[][] = 1100, sumo = 1;
// if((sumo == 0) && (flago[][] == 197)) flago[][] = 1100, sumo = 1
// if((sumo == 0) && (flago[][] > 99)) flago[][] = 1100, sumo = 1;
// if((sumo == 0) flagx[][] = 1100, sumo = 1;
// }
//...
|
|||||
| go on: | < previous page | next page > | |||
| FS03: alike theme | FREE SECTOR, 2016 (free alliance of developers Pixoria gomoku plug-in engines) | page 12/16 | |||