| 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 |
Simple example: how count signs "x" and "o". Count this in horizontal direction from left do right and back. Value write to variables "sumx", "sumo" and "xosum" (= sumx + sumo). If actual sign is "N" (none x, none o) reset all counters. If actual sig is "x" reset counrter for "o" and on the contrary. from left to right >>
<< and back ![]() |
||||
|
examples in C++
counting of signs (X and O) in rows from left to right ( >> ): int xosum = 1; //1 = here is left border
//if(xosum == sumx): N X //if(xosum > sumx): O X or B X (B = border)
for (row = 0; row < 19; row++) {
for (column = 0; column < 19; column++) {
switch(matRCboard[row][column]) {
case 'O': sumo++, xosum++;
sumx = 0; break;
case 'X': sumx++, xosum++;
sumo = 0; break;
case 'N': xmap[row][column] = sumx;
omap[row][column] = sumo;
sumx = sumo = xosum = 0; //reset counters
} //switch
} //for (column)
sumx = sumo = xosum = 0; //reset counters (here ending row)
} //for (row)
|
|||||
| go on: | < previous page | next page > | |||
| iM007: alike theme | FREE SECTOR, 2014 (free alliance of developers Pixoria gomoku plug-in engines) | page 1/30 | |||