FS 03 /HOW MAKE IT: very shortly PICTORIAL GUIDE after GOMOKU ENGINE code |
|||||

go on: |
< previous page
this page 28/30more delay use |
next page > |
|||

game boardsummary 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 |
This sample: engine is second (O) player. First player have three "dilay" structures. "Dilay" "flagx" values (197 and 1097) are through filter write to array "x_away" (1 and 10). More about dilay structures: see page 20
In array "x_away" engine (player O) search "more delay" structures and result of search write to array "x_plus".
How make it? See at page 24 and page 25 If engine (second player) no have "more delay" and detect "more delay" values in "x_plus" array (array of first player) and top value in his ("flago") array is lower than 1098 and top ("flagx") value of first player is lower than 5000, increase value in array of first player ("flagx") on the same (like a "x_plus") square position. Increase on new value 9999, if original (old) value on the same position of array ("flago") bigger than 999. Eslse (if lower than 1000) increase value on 9998. |
||||

examples in C++
Search maximum value in arrays "x_plus" and "o_plus" and change value on the same position of square in the "flag" array of rival if maximum "flag" value (best move) of engine player is lower:
//plusx = pluso = 0; for(row = 0; row < rcmax; row++) { for(column = 0; column < rcmax; column++) { if(plusx < x_plus[row][column]) plusx = x_plus[row][column]; if(pluso < o_plus[row][column]) pluso = o_plus[row][column]; } } //if(who == 1) you are first player (X) //if(who == 0) you are second player (O) //xmax: maximum value in "flagx" array //omax: maximum value in "flago" array //bacx = baco = 0; if((who == 0) && (pluso == 0) && (plusx > 1) && (omax < 1098)) { ((xmax > 196) && (xmax < 5000)) bacx = 1; } if((who == 1) && (plusx == 0) && (pluso > 1) && (xmax < 1098)) { ((omax > 196) && (omax < 5000)) baco = 1; } for(row = 0; row < rcmax; row++) { for(column = 0; column < rcmax; column++) { if((bacx == 1) && (x_plus[row][column] == plusx)) { (flagx[row][column] > 999) flagx[row][column] = 9999; (flagx[row][column] < 1000) flagx[row][column] = 9998; } if((baco == 1) && (o_plus[row][column] == pluso)) { (flago[row][column] > 999) flago[row][column] = 9999; (flago[row][column] < 1000) flago[row][column] = 9998; } } |
|||||

go on: |
< previous page |
next page > |
|||

FREE SECTOR, 2014 (free alliance of developers Pixoria gomoku plug-in engines) | page 28/30 | ||||