| FS 05 /HOW MAKE IT: very shortly PICTORIAL GUIDE after GOMOKU ENGINE code | |||||
| go on: | < previous page
|
last page | |||
![]() game board last page 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 "FS05" is subroutine of main program "Pixoria". Engine after her activation makes (in the rough) this: Rewrite one dimensional (1D) input array "board"[361] to two dimensional (2D) array "matRCboard"[19][19]. Count signs "N" (empty squares) in input array and detect by a ("who") is. if in input array is only signs "N", or if in input array isn't sign "O" and only one sign "X", which lay on border of playing area: engine send to Pixoria move (dMove) to the middle game area and finished. Else continue: (basic analyse) In according with variable "who", choose strategy: rewrite either (1D) arrays "this_are_x"[30] or "this_are_o"[30] to array "x_flat"[30] or "o_flat"[30]. rewrite either (1D) arrays "tax_prel"[18] or "tao_prel"[18] to array "x_prel"[18] or "o_prel"[18]. rewrite either (1D) arrays "tax_preh"[15] or "tao_preh"[15] to array "x_preh"[15] or "o_preh"[15]. A/ Scan (2D) arrays and record to (2D) arrays in horizontal ( _ ) direction: a/ Scan input array "matRCboard" from left to right ( >> ) and: --- detect left and right borders of game area --- detect sequences of signs "X", "O" and "N" (as well as FS03 page: 1) and in according with this: --- write values to arrays "xmap"[19][19] and "omap"[19][19] (as well as FS03 page 2, page 3, page 4 and page 5) --- write values to arrays "x_away"[19][19] and "o_away"[19][19] (as well as FS03 page 10) --- write values to arrays "x_plus"[19][19] and "o_plus"[19][19] (as well as FS03 page 8) b/ Scan input array "matRCboard" from right to left ( << ) and: --- detect right and left borders of game area --- detect sequences of signs "X", "O" and "N" (as well as FS03 page 1) and in according with this: --- write values to arrays "xmap"[19][19] and "omap"[19][19] (as well as FS03 page 2, page 3, page 4 and page 5) --- write values to arrays "x_away"[19][19] and "o_away"[19][19] (as well as FS03 page 10) --- write values to arrays "x_plus"[19][19] and "o_plus"[19][19] (as well as FS03 page 8) --- rewrite values from array "xmap" to array "xRCboard"[19][19] and from array "omap" to array "oRCboard"[19][19] c/ Scan input array "matRCboard" from right to left ( << ) and: --- detect right and left border of game area --- detect sequences of signs "X", "O" a "N" and in according with this: --- delete some values (zero) in arrays "xRCboard" and "oRCboard" (as well as FS03 page 6) d/ Read values in arrays: "xRCboard", "oRCboard", "xmap", "omap", "x_away", "o_away", "x_tack", "o_tack", "x_plus" and "o_plus" from left to right ( >> ) and: --- delete some values (zero) in arrays "xmap", "omap", "x_plus" and "o_plus" (as well as FS03 page 9) --- filter values in arrays "xRCboard" and "oRCboard" (likewise as FS03 page 7) --- write values to array "x_tack" and "o_tack" (likewise as FS03 page 13, page 14, page 15, page 16 and page 17) --- edit values in arrays "xRCboard" a "oRCboard" (likewise as FS03 page 11 and page 12) --- write values to array "flagx" and "flago" (likewise as FS03 page 13, page 14, page 15, page 16 and page 18) for FS05 "flagx" ("flago") values see page 02 --- delete contents of arrays "xmap", "omap", "x_plus" and "o_plus" e/ Scan input array "matRCboard" from left to right ( >> ) and: --- detect right and left border of game area --- detect sequences of signs "X", "O" a "N" and in according with this: --- edit values in arrays "flagx" and "flago" see page 01 ("add ten") --- delete contents of arrays "x_away" and "o_away" f/ Scan input array "matRCboard" from left to right ( >> ) and: --- detect right and left border of game area --- detect sequences of signs "X", "O" a "N" and in according with this: --- edit values in arrays "flagx" and "flago" see page 03 ("M+ in line") --- add values to arrays "xtemporal" and "otemporal" see page 03 ("M+ in line") g/ Read values in arrays: "xtemporal" and "otemporal" and: --- in according with their contents edit values in arrays "flagx" and "flago" see page 03 ("M+ in line") --- delete contents arrays "xtemporal" and "otemporal" B/ Scan (2D) arrays and record to (2D) arrays in vertical ( | ) direction: a/ Scan input array "matRCboard" from up to down and: --- farther proceed is analogical to: (A/a/) b/ Scan input array "matRCboard" from down to up and: --- farther proceed is analogical to: (A/b/), but: --- rewrite values from arrays "xmap" and "omap" to arrays "xtemporal"[19][19] and "otemporal"[19][19] c/ Scan input array "matRCboard" from down to up and: --- farther proceed is analogical to: (A/c/), but: --- delete some values (zero) in arrays "xtemporal" and "otemporal" d/ Read values in arrays: "xtemporal", "otemporal", "xmap", "omap", "x_away", "o_away", "x_tack", "o_tack", "x_plus" and "o_plus" from up to down and: --- delete some values (zero) in arrays "xmap", "omap", "x_plus" and "o_plus" --- filter values in arrays "xtemporal" and "otemporal" --- write values to arrays "x_tack" and "o_tack" --- edit values in arrays "xtemporal" and "otemporal" --- add values to arrays "flagx" and "flago" (likewise as FS03 page 18) --- delete contents arrays "xmap", "omap", "x_away", "o_away", "x_plus" and "o_plus" --- in according with contents arrays "xtemporal" and "otemporal" update contents arrays "xRCboard" and "oRCboard" (likewise as FS03 page 18) --- delete contents arrays "xtemporal" and "otemporal" e/ Scan input array "matRCboard" from up to down and: --- farther proceed is analogical to: (A/e/) f/ Scan input array "matRCboard" from up to down and: --- farther proceed is analogical to: (A/f/) g/ Read values in arrays: "xtemporal" and "otemporal" and: --- farther proceed is analogical to: (A/g/) C/ Scan (2D) arrays and record to (2D) arrays in diagonal ( \ ) direction: a/ Scan input array "matRCboard" from left to right and from up to down and: --- farther proceed is analogical to: (A/a/) b/ Scan input array "matRCboard" from right to left and from down to up and: --- farther proceed is analogical to: (B/b/) c/ Scan input array "matRCboard" from right to left and from down to up and: --- farther proceed is analogical to: (B/c/) d/ Read values in arrays: "xtemporal", "otemporal", "xmap", "omap", "x_away", "o_away", "x_tack", "o_tack", "x_plus" and "o_plus" from left to right and from up to down and: --- farther proceed is analogical to: (B/d/) e/ Scan input array "matRCboard" from up to down and: --- farther proceed is analogical to: (A/e/) f/ Scan input array "matRCboard" from up to down and: --- farther proceed is analogical to: (A/f/) g/ Read values in arrays: "xtemporal" and "otemporal" and: --- farther proceed is analogical to: (A/g/) D/ Scan (2D) arrays and record to (2D) arrays in diagonal ( / ) direction: and proceed is analogical to: (C/) if in array "xRCboard" or array "oRCboard" is value bigger than 99 (one move to finish): engine send to Pixoria move (dMove) to this position of game area and finished. Else continue: ("M+ in line" alike "delay") E/ Scan (2D) arrays and record to (2D) arrays in horizontal ( _ ) direction: a/ Scan input array "matRCboard" and arrays "x_tack" and "o_tack" from left to right ( >> ) and: --- detect left and right border of game area --- compare contens of arrays "matRCboard", "x_tack" and "o_tack" and: see page 04 ("M+ in line") --- search "M+ in line" structures and according of that: see page 04 ("M+ in line") --- edit values in arrays "flagx" and "flago" see page 04 ("M+ in line") F/ Scan (2D) arrays and record to (2D) arrays in vertical ( | ) direction: and proceed is analogical to: (E/) G/ Scan (2D) arrays and record to (2D) arrays in diagonal ( \ ) direction: and proceed is analogical to: (E/) H/ Scan (2D) arrays and record to (2D) arrays in diagonal ( / ) direction: and proceed is analogical to: (E/) and continue: ("predict" sequences, "delay" and "LastMove") I/ Scan (2D) arrays and record to (2D) arrays in horizontal ( _ ) direction: a/ Scan input array "matRCboard" and arrays "x_tack" and "o_tack" from left to right ( >> ) and: --- detect left and right border of game area --- search "predict" sequences and according of that: see page 09 ("predict low") --- write values to arrays "pred_x"[19][19] and "pred_o"[19][19] see page 09 ("predict low") --- write values to (now free) arrays "xmap" and "omap" (search "2d delay, dilay") see page 11 --- edit values in arrays "flagx" and "flago" (search "delay") --- write values to (now free) arrays "x_plus" and "o_plus" (search "LastMoves") see page 07 and page 08 J/ Scan (2D) arrays and record to (2D) arrays in vertical ( | ) direction: a/ Scan input array "matRCboard" and arrays "x_tack" and "o_tack" from up to down and: --- detect up and down border of game area --- search "predict" sequences and according of that write values to arrays "xtemporal" and "otemporal" --- write values to (now free) arrays "x_away" and "o_away" (search "2d delay, dilay") --- edit values in arrays "flagx" and "flago" (search "delay") --- write values to arrays "x_plus" and "o_plus" (search "LastMoves") K/ Browse arrays "pred_x" and "pred_o" from left to right ( >> ) and: --- add to they values from arrays "xtemporal" and "otemporal" see page 09 ("predict low") --- add values from arrays "x_away" and "o_away" to arrays "xmap" and "omap" --- delete contents of arrays "xtemporal", "otemporal", "x_away" and "o_away" L/ Scan (2D) arrays and record to (2D) arrays in diagonal ( \ ) direction: a/ Scan input array "matRCboard" and arrays "x_tack" and "o_tack" from left to right and from down to up and: --- proceed is analogical to: (J/a/) M/ The same proceed like a in: (K/) N/ Scan (2D) arrays an record to (2D) arrays in diagonal ( / ) direction: a/ Scan input array "matRCboard" and arrays "x_tack" and "o_tack" from right to left and from up to down and: --- proceed is analogical to: (J/a/) O/ Browse more of arrays from left to right ( >> ) and: --- add values from arrays "xtemporal" and "otemporal" to arrays "pred_x" and "pred_o" --- add values from arrays "x_away" and "o_away" to arrays "xmap" and "omap" --- filter values in arrays "pred_x" and "pred_o" (increase) --- add values from arrays "pred_x" and "pred_o" to arrays "x_tack" and "o_tack" --- filter values in arrays "x_plus" and "o_plus" (LastMove increase) --- delete contents of arrays "xtemporal", "otemporal", "pred_x", "pred_o", "x_away" and "o_away" --- edit arrays "xmap" and "omap" (search, clear, write) see page 11 ("2d delay, dilay") and continue: ("delay", "dilay" and "predict" structures) P/ Scan (2D) arrays and record to (2D) arrays in horizontal ( _ ) direction: a/ Scan input array "matRCboard" and arrays "x_tack", "o_tack", "flagx", "flago", "xmap" and "omap" from left to right ( >> ) and: --- detect left and right border of game area --- search "delay", "dilay" structures (likewise as FS03 page 19) and (page 20) --- search "predict" structures see page 09 and see page 10 ("low predict, high predict") --- search "2 delay, dilay" structures see page 11 ("2d delay, dilay") --- write values to arrays "flagx", "flago", "xtemporal" and "otemporal" (likewise as FS03 page 19) and (page 20) --- write values to arrays "pred_x" and "pred_o" see page 09 and see page 10 ("low predict, high predict") Q/ Browse arrays "xtemporal" and "otemporal" from left to right ( >> ) and: --- and according with their contents update contents of arrays "flagx" and "flago" --- add values from arrays "pred_x" and "pred_o" to arrays "x_plus" and "o_plus" --- delete contents of arrays "xtemporal", "otemporal", "pred_x" and "pred_o" R/ Scan (2D) arrays and record to (2D) arrays in vertical ( | ) direction: a/ Scan input array "matRCboard" and arrays "x_tack", "o_tack", "flagx", "flago", "xmap" and "omap" from up to down and: --- farther proceed is analogical to: (P/a/) S/ Browse arrays "xtemporal" and "otemporal" from left to right ( >> ) and: --- and according with their contents update contents of arrays "flagx" and "flago" --- add values from arrays "pred_x" and "pred_o" to arrays "x_plus" and "o_plus" --- delete contents of arrays "xtemporal", "otemporal", "pred_x" and "pred_o" T/ Scan (2D) arrays and record to (2D) arrays in diagonal ( \ ) direction: and proceed is analogical to: (R/a/) U/ The same proceed like a in: (S/) V/ Scan (2D) arrays and record to (2D) arrays in diagonal ( / ) direction: and proceed is analogical to: (R/a/) W/ Browse arrays "xtemporal" and "otemporal" from left to right ( >> ) and: --- and according with their contents update contents of arrays "flagx" and "flago" --- add values from arrays "pred_x" and "pred_o" to arrays "x_plus" and "o_plus" --- delete contents of arrays "x_away" and "o_away" --- read arrays "flagx" and "flago" and according their contens write values to arrays"x_away" and "o_away" --- delete contents of arrays "xtemporal", "otemporal", "pred_x" and "pred_o" and continue: ("more delays" structures) X/ Scan (2D) arrays and record to (2D) arrays in horizontal ( _ ) direction: a/ Scan input array "matRCboard" and arrays "x_away" and "o_away" from left to right ( >> ) and: --- detect left and right border of game area --- search structures "more delays" and write values to arrays "pred_x" and "pred_o" see page 12 Y/ Browse arrays "pred_x" and "pred_o" from left to right ( >> ) and: --- edit their contents Z/ Scan (2D) arrays and record to (2D) arrays in vertical ( | ) direction: and proceed is analogical to: (X/a/), but write values to arrays "xtemporal" and "otemporal" AA/ Browse arrays "xtemporal" and "otemporal" from left to right ( >> ) and: --- edit contents of arrays "xtemporal" and "otemporal" and --- add contens of arrays "xtemporal" and "otemporal" to arrays "pred_x" and "pred_o" --- delete contents of arrays "xtemporal" and "otemporal" AB/ Scan (2D) arrays and record to (2D) arrays in diagonal ( \ ) direction: and proceed is analogical to: (Z/a/) AC/ The same proceed like a in: (AA/) AD/ Scan (2D) arrays and record to (2D) arrays in diagonal ( / ) direction: and proceed is analogical to: (Z/a/) AE/ The same proceed like a in: (AA/) and continue: ("three" structures) AF/ Scan (2D) arrays and record to (2D) arrays in horizontal ( _ ) direction: a/ Scan input array "matRCboard" and arrays "flagx" and "flago" from left to right ( >> ) and: --- detect left and right border of game area --- search structures "three" and change values in arrays "flagx" and "flago" (likewise as FS03 page 26) --- write values to arrays "x_tack" and "o_tack" AG/ Scan (2D) arrays and record to (2D) arrays in vertical ( | ) direction: and proceed is analogical to: (AF/) AH/ Scan (2D) arrays and record to (2D) arrays in diagonal ( \ ) direction: and proceed is analogical to: (AF/) AI/ Scan (2D) arrays and record to (2D) arrays in diagonal ( / ) direction: and proceed is analogical to: (AF/) and continue: (work up "predict") AJ/ Scan (2D) arrays and record to (2D) arrays in horizontal ( _ ) direction: a/ Scan arrays "flagx", "flago", "pred_x", "pred_o", "x_plus", "o_plus", "x_tack", "o_tack", "xmap" and "omao" from left to right ( >> ) and: --- search maximum values in arrays "flagx" and "flago" and save them to variables "xmax", "omax", "xmax_o" and "omax_x" --- search maximum values in arrays "pred_x" and "pred_o" and save them to variables "plusx" and "pluso" (more delays) --- search "low predict" and "high predict" structures and: see page 09 and see page 10 --- write values to arrays "xtemporal" and "otemporal" b/ Scan arrays "flagx", "flago", "xtemporal", "otemporal", "x_plus", "o_plus", "xmap" and "omap" from left to right ( >> ) and: --- write values to arrays "xtemporal" and "otemporal" --- delete contents of arrays "xmap" and "omap" --- filter arrays "xtemporal" and "otemporal" and write values to arrays "xmap" and "omap" --- delete contents of arrays "xtemporal" and "otemporal" and continue: ("dilay+, delay+") AK/ Browse arrays "flagx" and "flago" from left to right ( >> ) and: --- search "dilay+, delay+" see page 13 and continue: ("best end of three") AL/ Browse arrays "matRCboard", "x_tack", "o_tack", "flagx" and "flago" from left to right ( >> ) and: --- search "best end of three" see page 14 --- write values to arrays "xtemporal" and "otemporal" and continue: ("2222") AM/ Browse arrays "flagx" and "flago" from left to right ( >> ) and: --- edit their contents and continue: (work up special reserves) AN/ Browse more of arrays from left to right ( >> ) and: --- search labels for special reserves ("three", "more delays", "delay+", "dilay+", etc.) and: --- according situation (who, defensive, etc.) change values in (2D) arrays "flagx", "flago", "x_away" and "o_away" or (1D) arrays "o_flat", "x_flat", "x_preh" and "o_preh" and final continue: ("final" values) AO/ Browse (2D) arrays "flagx", "flago", "xmap" and "omap" from left to right ( >> ) and: --- according values of their and according of values in (1D) arrays "x_flat", "o_flat", "x_preh", "o_preh, "x_prel" and "o_prel update values in arrays "xRCboard" and "oRCboard" (possible values: 0 to 200): see page 15 Engine choose in according with "who" from arrays "xRCboard" and "oRCboard" one top (best) value, her position in 2D array re-count on position in 1D array and this number of position send to Pixoria like a his move dMove and finished. |
||||
( T H A N K S ) |
|||||
| go on: | < previous page | last page | |||
| FREE SECTOR, 2016 (free alliance of developers Pixoria gomoku plug-in engines) | page 16/16 | ||||