home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / ProGoMoku.dxr / 00033_gameMovie3.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  22.4 KB  |  503 lines

  1. global gGameBoard, gKounterH, gKounterV, gPosH, gPosV, gPuppeter, singleUndo, gPlaying, gSingleMove, gCompsTurn, gEKountH, gEKountV, gEPuppet, gEMoves, gEWinX, gEWinY, gETrys, gEholdX, gEholdY, gELineH, gELineV, gELineHolder, gELineDirection, gGo4WinV, gGo4WinH, gCheckPLines, gNuLine, gBalls, gNuMapPosX, gNuMapPosY, gKountY, gKountX, gSaveLength, gLineDot, gAdd5Xs, gKount2, gFullBoard, gSpecial
  2.  
  3. on PlayerMove
  4.   if gSingleMove = 1 then
  5.     if gEMoves = 0 then
  6.       sprite(1).member = "pro-go-moku_move1"
  7.       if the mouseDown then
  8.         if gGameBoard[8][8] = 0 then
  9.           if (the mouseH < (59 + 12 + (8 * 26))) and (the mouseH > (59 - 12 + (8 * 26))) and (the mouseV > (10 - 12 + (8 * 26))) and (the mouseV < (10 + 12 + (8 * 26))) then
  10.             puppetSound(1, "move peg")
  11.             gGameBoard[8][8] = 1
  12.             gPosH = gKounterH
  13.             gPosV = gKounterV
  14.             gSingleMove = 0
  15.             if singleUndo = 1 then
  16.               gCompsTurn = 1
  17.             end if
  18.             singleUndo = 1
  19.             sprite(gPuppeter).puppet = 1
  20.             sprite(gPuppeter).member = "black bead"
  21.             sprite(gPuppeter).loc = point(59 + (8 * 26), 10 + (8 * 26))
  22.             gPuppeter = gPuppeter + 1
  23.             updateStage()
  24.           end if
  25.         end if
  26.       end if
  27.     end if
  28.     if gEMoves = 1 then
  29.       sprite(1).member = "pro-go-moku_move2"
  30.       if the mouseDown then
  31.         repeat with gKounterV = 1 to 15
  32.           repeat with gKounterH = 1 to 15
  33.             if gGameBoard[gKounterV][gKounterH] = 0 then
  34.               if (gKounterV >= 6) and (gKounterV <= 10) and ((gKounterH >= 6) and (gKounterH <= 10)) then
  35.                 next repeat
  36.               end if
  37.               if (the mouseH < (59 + 12 + (gKounterH * 26))) and (the mouseH > (59 - 12 + (gKounterH * 26))) and (the mouseV > (10 - 12 + (gKounterV * 26))) and (the mouseV < (10 + 12 + (gKounterV * 26))) then
  38.                 puppetSound(1, "move peg")
  39.                 gGameBoard[gKounterV][gKounterH] = 1
  40.                 gPosH = gKounterH
  41.                 gPosV = gKounterV
  42.                 gSingleMove = 0
  43.                 if singleUndo = 1 then
  44.                   gCompsTurn = 1
  45.                 end if
  46.                 singleUndo = 1
  47.                 sprite(gPuppeter).puppet = 1
  48.                 sprite(gPuppeter).member = "black bead"
  49.                 sprite(gPuppeter).loc = point(59 + (gKounterH * 26), 10 + (gKounterV * 26))
  50.                 gPuppeter = gPuppeter + 1
  51.                 updateStage()
  52.               end if
  53.             end if
  54.           end repeat
  55.         end repeat
  56.       end if
  57.     end if
  58.     if gEMoves >= 2 then
  59.       sprite(1).member = "pro-go-moku"
  60.       if the mouseDown then
  61.         repeat with gKounterV = 1 to 15
  62.           repeat with gKounterH = 1 to 15
  63.             if gGameBoard[gKounterV][gKounterH] = 0 then
  64.               if (the mouseH < (59 + 12 + (gKounterH * 26))) and (the mouseH > (59 - 12 + (gKounterH * 26))) and (the mouseV > (10 - 12 + (gKounterV * 26))) and (the mouseV < (10 + 12 + (gKounterV * 26))) then
  65.                 puppetSound(1, "move peg")
  66.                 gGameBoard[gKounterV][gKounterH] = 1
  67.                 gPosH = gKounterH
  68.                 gPosV = gKounterV
  69.                 gSingleMove = 0
  70.                 if singleUndo = 1 then
  71.                   gCompsTurn = 1
  72.                 end if
  73.                 singleUndo = 1
  74.                 sprite(gPuppeter).puppet = 1
  75.                 sprite(gPuppeter).member = "black bead"
  76.                 sprite(gPuppeter).loc = point(59 + (gKounterH * 26), 10 + (gKounterV * 26))
  77.                 gPuppeter = gPuppeter + 1
  78.                 updateStage()
  79.               end if
  80.             end if
  81.           end repeat
  82.         end repeat
  83.       end if
  84.     end if
  85.   end if
  86.   if the mouseUp then
  87.     gSingleMove = 1
  88.   end if
  89. end
  90.  
  91. on AI_Block
  92.   repeat with gGo4WinV = 1 to 15
  93.     repeat with gGo4WinH = 1 to 15
  94.       if gGameBoard[gGo4WinV][gGo4WinH] = 1 then
  95.         if gGo4WinH <= 11 then
  96.           if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) then
  97.             gBalls = 2
  98.           end if
  99.           if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 0) then
  100.             gBalls = 3
  101.           end if
  102.           if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 4] = 0) then
  103.             gBalls = 4
  104.           end if
  105.           if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 4] = 1) then
  106.             gBalls = 4
  107.             gSpecial = 2
  108.           end if
  109.           if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 1) then
  110.             gBalls = 3
  111.             gSpecial = 1
  112.           end if
  113.         else
  114.           if gGo4WinH = 12 then
  115.             if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) then
  116.               gBalls = 2
  117.               if (gGameBoard[gGo4WinV][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 3] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 0) then
  118.                 gBalls = 3
  119.               end if
  120.             end if
  121.           else
  122.             if gGo4WinH = 13 then
  123.               if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) then
  124.                 gBalls = 2
  125.               end if
  126.             end if
  127.           end if
  128.         end if
  129.         if gBalls >= gSaveLength then
  130.           gNuMapPosY = gGo4WinV
  131.           gNuMapPosX = gGo4WinH + (gBalls - gSpecial)
  132.           gSaveLength = gBalls
  133.           gEKountV = gNuMapPosY
  134.           gEKountH = gNuMapPosX
  135.         end if
  136.         gBalls = 1
  137.         gSpecial = 0
  138.         if (gGo4WinH <= 11) and (gGo4WinV >= 5) then
  139.           if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) then
  140.             gBalls = 2
  141.           end if
  142.           if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 0) then
  143.             gBalls = 3
  144.           end if
  145.           if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 1) and (gGameBoard[gGo4WinV - 4][gGo4WinH + 4] = 0) then
  146.             gBalls = 4
  147.           end if
  148.           if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 1) and (gGameBoard[gGo4WinV - 4][gGo4WinH + 4] = 1) then
  149.             gBalls = 4
  150.             gSpecial = 2
  151.             put "special"
  152.           end if
  153.           if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 1) then
  154.             gBalls = 3
  155.             gSpecial = 1
  156.           end if
  157.         else
  158.           if (gGo4WinH = 12) and (gGo4WinV = 4) then
  159.             if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) then
  160.               gBalls = 2
  161.               if (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] <> 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 0) then
  162.                 gBalls = 3
  163.               end if
  164.             end if
  165.           else
  166.             if (gGo4WinH = 13) and (gGo4WinV = 3) then
  167.               if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) then
  168.                 gBalls = 2
  169.               end if
  170.             end if
  171.           end if
  172.         end if
  173.         if gBalls >= gSaveLength then
  174.           gNuMapPosY = gGo4WinV - (gBalls - gSpecial)
  175.           gNuMapPosX = gGo4WinH + (gBalls - gSpecial)
  176.           gSaveLength = gBalls
  177.           gEKountV = gNuMapPosY
  178.           gEKountH = gNuMapPosX
  179.         end if
  180.         gBalls = 1
  181.         gSpecial = 0
  182.         if gGo4WinV >= 5 then
  183.           if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) then
  184.             gBalls = 2
  185.           end if
  186.           if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 0) then
  187.             gBalls = 3
  188.           end if
  189.           if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 4][gGo4WinH] = 0) then
  190.             gBalls = 4
  191.           end if
  192.           if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 4][gGo4WinH] = 1) then
  193.             gBalls = 4
  194.             gSpecial = 2
  195.             put "special"
  196.           end if
  197.           if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 1) then
  198.             gBalls = 3
  199.             gSpecial = 1
  200.           end if
  201.         else
  202.           if gGo4WinV = 4 then
  203.             if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) then
  204.               gBalls = 2
  205.               if (gGameBoard[gGo4WinV - 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 0) then
  206.                 gBalls = 3
  207.               end if
  208.             end if
  209.           else
  210.             if gGo4WinV = 3 then
  211.               if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) then
  212.                 gBalls = 2
  213.               end if
  214.             end if
  215.           end if
  216.         end if
  217.         if gBalls >= gSaveLength then
  218.           gNuMapPosY = gGo4WinV - (gBalls - gSpecial)
  219.           gNuMapPosX = gGo4WinH
  220.           gSaveLength = gBalls
  221.           gEKountV = gNuMapPosY
  222.           gEKountH = gNuMapPosX
  223.         end if
  224.         gBalls = 1
  225.         gSpecial = 0
  226.         if (gGo4WinH >= 5) and (gGo4WinV >= 5) then
  227.           if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) then
  228.             gBalls = 2
  229.           end if
  230.           if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 0) then
  231.             gBalls = 3
  232.           end if
  233.           if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 1) and (gGameBoard[gGo4WinV - 4][gGo4WinH - 4] = 0) then
  234.             gBalls = 4
  235.           end if
  236.           if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 1) and (gGameBoard[gGo4WinV - 4][gGo4WinH - 4] = 1) then
  237.             gBalls = 4
  238.             gSpecial = 2
  239.             put "special"
  240.           end if
  241.           if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 1) then
  242.             gBalls = 3
  243.             gSpecial = 1
  244.           end if
  245.         else
  246.           if (gGo4WinH = 4) and (gGo4WinV = 4) then
  247.             if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) then
  248.               gBalls = 2
  249.               if (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] <> 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 0) then
  250.                 gBalls = 3
  251.               end if
  252.             end if
  253.           else
  254.             if (gGo4WinH = 3) and (gGo4WinV = 3) then
  255.               if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) then
  256.                 gBalls = 2
  257.               end if
  258.             end if
  259.           end if
  260.         end if
  261.         if gBalls >= gSaveLength then
  262.           gNuMapPosY = gGo4WinV - (gBalls - gSpecial)
  263.           gNuMapPosX = gGo4WinH - (gBalls - gSpecial)
  264.           gSaveLength = gBalls
  265.           gEKountV = gNuMapPosY
  266.           gEKountH = gNuMapPosX
  267.         end if
  268.         gBalls = 1
  269.         gSpecial = 0
  270.         if gGo4WinH >= 5 then
  271.           if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) then
  272.             gBalls = 2
  273.           end if
  274.           if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 0) then
  275.             gBalls = 3
  276.           end if
  277.           if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 4] = 0) then
  278.             gBalls = 4
  279.           end if
  280.           if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 4] = 1) then
  281.             gBalls = 4
  282.             gSpecial = 2
  283.             put "special"
  284.           end if
  285.           if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 1) then
  286.             gBalls = 3
  287.             gSpecial = 1
  288.           end if
  289.         else
  290.           if gGo4WinH = 4 then
  291.             if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) then
  292.               gBalls = 2
  293.               if (gGameBoard[gGo4WinV][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 3] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 0) then
  294.                 gBalls = 3
  295.               end if
  296.             end if
  297.           else
  298.             if gGo4WinH = 3 then
  299.               if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) then
  300.                 gBalls = 2
  301.               end if
  302.             end if
  303.           end if
  304.         end if
  305.         if gBalls >= gSaveLength then
  306.           gNuMapPosY = gGo4WinV
  307.           gNuMapPosX = gGo4WinH - (gBalls - gSpecial)
  308.           gSaveLength = gBalls
  309.           gEKountV = gNuMapPosY
  310.           gEKountH = gNuMapPosX
  311.         end if
  312.         gBalls = 1
  313.         gSpecial = 0
  314.         if (gGo4WinH >= 5) and (gGo4WinV <= 11) then
  315.           if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) then
  316.             gBalls = 2
  317.           end if
  318.           if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 0) then
  319.             gBalls = 3
  320.           end if
  321.           if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 1) and (gGameBoard[gGo4WinV + 4][gGo4WinH - 4] = 0) then
  322.             gBalls = 4
  323.           end if
  324.           if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 1) and (gGameBoard[gGo4WinV + 4][gGo4WinH - 4] = 1) then
  325.             gBalls = 4
  326.             gSpecial = 2
  327.             put "special"
  328.           end if
  329.           if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 1) then
  330.             gBalls = 3
  331.             gSpecial = 1
  332.           end if
  333.         else
  334.           if (gGo4WinH = 4) and (gGo4WinV = 12) then
  335.             if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) then
  336.               gBalls = 2
  337.               if (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] <> 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 0) then
  338.                 gBalls = 3
  339.               end if
  340.             end if
  341.           else
  342.             if (gGo4WinH = 3) and (gGo4WinV = 13) then
  343.               if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) then
  344.                 gBalls = 2
  345.               end if
  346.             end if
  347.           end if
  348.         end if
  349.         if gBalls >= gSaveLength then
  350.           gNuMapPosY = gGo4WinV + (gBalls - gSpecial)
  351.           gNuMapPosX = gGo4WinH - (gBalls - gSpecial)
  352.           gSaveLength = gBalls
  353.           gEKountV = gNuMapPosY
  354.           gEKountH = gNuMapPosX
  355.         end if
  356.         gBalls = 1
  357.         gSpecial = 0
  358.         if gGo4WinV <= 11 then
  359.           if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) then
  360.             gBalls = 2
  361.           end if
  362.           if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 0) then
  363.             gBalls = 3
  364.           end if
  365.           if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 4][gGo4WinH] = 0) then
  366.             gBalls = 4
  367.           end if
  368.           if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 4][gGo4WinH] = 1) then
  369.             gBalls = 4
  370.             gSpecial = 2
  371.             put "special"
  372.           end if
  373.           if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 1) then
  374.             gBalls = 3
  375.             gSpecial = 1
  376.           end if
  377.         else
  378.           if gGo4WinV = 12 then
  379.             if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) then
  380.               gBalls = 2
  381.               if (gGameBoard[gGo4WinV + 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 0) then
  382.                 gBalls = 3
  383.               end if
  384.             end if
  385.           else
  386.             if gGo4WinV = 13 then
  387.               if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) then
  388.                 gBalls = 2
  389.               end if
  390.             end if
  391.           end if
  392.         end if
  393.         if gBalls >= gSaveLength then
  394.           gNuMapPosY = gGo4WinV + (gBalls - gSpecial)
  395.           gNuMapPosX = gGo4WinH
  396.           gSaveLength = gBalls
  397.           gEKountV = gNuMapPosY
  398.           gEKountH = gNuMapPosX
  399.         end if
  400.         gBalls = 1
  401.         gSpecial = 0
  402.         if (gGo4WinH <= 11) and (gGo4WinV <= 11) then
  403.           if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) then
  404.             gBalls = 2
  405.           end if
  406.           if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 0) then
  407.             gBalls = 3
  408.           end if
  409.           if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 1) and (gGameBoard[gGo4WinV + 4][gGo4WinH + 4] = 0) then
  410.             gBalls = 4
  411.           end if
  412.           if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 1) and (gGameBoard[gGo4WinV + 4][gGo4WinH + 4] = 1) then
  413.             gBalls = 4
  414.             gSpecial = 2
  415.             put "special"
  416.           end if
  417.           if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 1) then
  418.             gBalls = 3
  419.             gSpecial = 1
  420.           end if
  421.         else
  422.           if (gGo4WinH = 12) and (gGo4WinV = 12) then
  423.             if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) then
  424.               gBalls = 2
  425.               if (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] <> 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 0) then
  426.                 gBalls = 3
  427.               end if
  428.             end if
  429.           else
  430.             if (gGo4WinH = 13) and (gGo4WinV = 13) then
  431.               if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) then
  432.                 gBalls = 2
  433.               end if
  434.             end if
  435.           end if
  436.         end if
  437.         if gBalls >= gSaveLength then
  438.           gNuMapPosY = gGo4WinV + (gBalls - gSpecial)
  439.           gNuMapPosX = gGo4WinH + (gBalls - gSpecial)
  440.           gSaveLength = gBalls
  441.           gEKountV = gNuMapPosY
  442.           gEKountH = gNuMapPosX
  443.         end if
  444.         gBalls = 1
  445.         gSpecial = 0
  446.       end if
  447.     end repeat
  448.   end repeat
  449.   if gSaveLength <= 2 then
  450.     EnemyGo4Win()
  451.   end if
  452.   gSaveLength = 1
  453. end
  454.  
  455. on AI_Build
  456.   if gEMoves <= 1 then
  457.     selectLine()
  458.     gEKountV = gELineV
  459.     gEKountH = gELineH
  460.   else
  461.     repeat while gGameBoard[gELineV][gELineH] <> 0
  462.       case gELineDirection of
  463.         6:
  464.           Direction_Right()
  465.         9:
  466.           Direction_Up_Right()
  467.         8:
  468.           Direction_Up()
  469.         7:
  470.           Direction_Up_Left()
  471.         4:
  472.           Direction_Left()
  473.         1:
  474.           Direction_Down_Left()
  475.         2:
  476.           Direction_Down()
  477.         3:
  478.           Direction_Down_Right()
  479.         5:
  480.           Direction_Right()
  481.       end case
  482.     end repeat
  483.   end if
  484.   gEKountV = gELineV
  485.   gEKountH = gELineH
  486. end
  487.  
  488. on selectLine
  489.   gELineV = random(5) + 4
  490.   gELineH = random(5) + 4
  491. end
  492.  
  493. on AI_Random
  494.   gEKountV = random(15)
  495.   gEKountH = random(15)
  496.   if gEMoves <= 113 then
  497.     repeat while gGameBoard[gEKountV][gEKountH] <> 0
  498.       gEKountV = random(15)
  499.       gEKountH = random(15)
  500.     end repeat
  501.   end if
  502. end
  503.