if (the mouseH < (58 + 12 + (gKounterH * 30))) and (the mouseH > (58 - 12 + (gKounterH * 30))) and (the mouseV > (9 - 12 + (gKounterV * 30))) and (the mouseV < (9 + 12 + (gKounterV * 30))) then
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) then
gBalls = 2
end if
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 0) then
gBalls = 3
end if
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
gBalls = 4
end if
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
gBalls = 4
gSpecial = 2
end if
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 1) then
gBalls = 3
gSpecial = 1
end if
if ((gGameBoard[gGo4WinV][gGo4WinH + 1] = 0) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 1)) or ((gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 4] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Right1"
end if
if gGo4WinH <= 8 then
if ((gGameBoard[gGo4WinV][gGo4WinH + 1] = 0) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 1)) or ((gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 4] = 1)) or ((gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 0) and (gGameBoard[gGo4WinV][gGo4WinH + 4] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 5] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Right2"
end if
end if
else
if gGo4WinH = 10 then
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) then
gBalls = 2
if (gGameBoard[gGo4WinV][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 3] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 0) then
gBalls = 3
end if
end if
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 0) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 1) then
gBalls = 0
gSpecial = 0
put "distaste Right3"
end if
else
if gGo4WinH = 11 then
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) then
gBalls = 2
end if
end if
end if
end if
if gBalls >= gSaveLength then
gNuMapPosY = gGo4WinV
gNuMapPosX = gGo4WinH + (gBalls - gSpecial)
gSaveLength = gBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gBalls = 1
gSpecial = 0
if (gGo4WinH <= 9) and (gGo4WinV >= 5) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) then
gBalls = 2
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 0) then
gBalls = 3
end if
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
gBalls = 4
end if
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
gBalls = 4
gSpecial = 2
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 1) then
gBalls = 3
gSpecial = 1
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 0) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 1) then
gBalls = 1
gSpecial = 0
end if
if ((gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 0) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 1)) or ((gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH + 4] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Up&Right1"
end if
if (gGo4WinH <= 8) and (gGo4WinV >= 6) then
if ((gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 0) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 1)) or ((gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH + 4] = 1)) or ((gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 0) and (gGameBoard[gGo4WinV - 4][gGo4WinH + 4] = 2) and (gGameBoard[gGo4WinV - 5][gGo4WinH + 5] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Up&Right2"
end if
end if
else
if (gGo4WinH = 10) and (gGo4WinV = 4) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) then
gBalls = 2
if (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] <> 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 0) then
gBalls = 3
end if
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 0) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 1) then
gBalls = 1
gSpecial = 0
put "distaste Up&Right3"
end if
else
if (gGo4WinH = 11) and (gGo4WinV = 3) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) then
gBalls = 2
end if
end if
end if
end if
if gBalls >= gSaveLength then
gNuMapPosY = gGo4WinV - (gBalls - gSpecial)
gNuMapPosX = gGo4WinH + (gBalls - gSpecial)
gSaveLength = gBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gBalls = 1
gSpecial = 0
if gGo4WinV >= 5 then
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) then
gBalls = 2
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 0) then
gBalls = 3
end if
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
gBalls = 4
end if
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
gBalls = 4
gSpecial = 2
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 1) then
gBalls = 3
gSpecial = 1
end if
if ((gGameBoard[gGo4WinV - 1][gGo4WinH] = 0) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 1)) or ((gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Up1"
end if
if gGo4WinV >= 6 then
if ((gGameBoard[gGo4WinV - 1][gGo4WinH] = 0) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 1)) or ((gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH] = 1)) or ((gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 0) and (gGameBoard[gGo4WinV - 4][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 5][gGo4WinH] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Up2"
end if
end if
else
if gGo4WinV = 4 then
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) then
gBalls = 2
if (gGameBoard[gGo4WinV - 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 0) then
gBalls = 3
end if
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 0) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 1) then
gBalls = 1
gSpecial = 0
put "distaste Up3"
end if
else
if gGo4WinV = 3 then
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) then
gBalls = 2
end if
end if
end if
end if
if gBalls >= gSaveLength then
gNuMapPosY = gGo4WinV - (gBalls - gSpecial)
gNuMapPosX = gGo4WinH
gSaveLength = gBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gBalls = 1
gSpecial = 0
if (gGo4WinH >= 5) and (gGo4WinV >= 5) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) then
gBalls = 2
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 0) then
gBalls = 3
end if
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
gBalls = 4
end if
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
gBalls = 4
gSpecial = 2
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 1) then
gBalls = 3
gSpecial = 1
end if
if ((gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 0) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 1)) or ((gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH - 4] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Up&Left1"
end if
if (gGo4WinH >= 6) and (gGo4WinV >= 6) then
if ((gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 0) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 1)) or ((gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH - 4] = 1)) or ((gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 0) and (gGameBoard[gGo4WinV - 4][gGo4WinH - 4] = 2) and (gGameBoard[gGo4WinV - 5][gGo4WinH - 5] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Up&Left2"
end if
end if
else
if (gGo4WinH = 4) and (gGo4WinV = 4) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) then
gBalls = 2
if (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] <> 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 0) then
gBalls = 3
end if
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 0) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 1) then
gBalls = 1
gSpecial = 0
put "distaste Up&Left3"
end if
else
if (gGo4WinH = 3) and (gGo4WinV = 3) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) then
gBalls = 2
end if
end if
end if
end if
if gBalls >= gSaveLength then
gNuMapPosY = gGo4WinV - (gBalls - gSpecial)
gNuMapPosX = gGo4WinH - (gBalls - gSpecial)
gSaveLength = gBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gBalls = 1
gSpecial = 0
if gGo4WinH >= 5 then
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) then
gBalls = 2
end if
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 0) then
gBalls = 3
end if
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
gBalls = 4
end if
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
gBalls = 4
gSpecial = 2
end if
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 1) then
gBalls = 3
gSpecial = 1
end if
if ((gGameBoard[gGo4WinV][gGo4WinH - 1] = 0) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 1)) or ((gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 4] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Left1"
end if
if gGo4WinH >= 6 then
if ((gGameBoard[gGo4WinV][gGo4WinH - 1] = 0) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 1)) or ((gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 4] = 1)) or ((gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 0) and (gGameBoard[gGo4WinV][gGo4WinH - 4] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 5] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Left2"
end if
end if
else
if gGo4WinH = 4 then
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) then
gBalls = 2
if (gGameBoard[gGo4WinV][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 3] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 0) then
gBalls = 3
end if
end if
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 0) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 1) then
gBalls = 0
gSpecial = 0
put "distaste Left3"
end if
else
if gGo4WinH = 3 then
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) then
gBalls = 2
end if
end if
end if
end if
if gBalls >= gSaveLength then
gNuMapPosY = gGo4WinV
gNuMapPosX = gGo4WinH - (gBalls - gSpecial)
gSaveLength = gBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gBalls = 1
gSpecial = 0
if (gGo4WinH >= 5) and (gGo4WinV <= 9) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) then
gBalls = 2
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 0) then
gBalls = 3
end if
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
gBalls = 4
end if
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
gBalls = 4
gSpecial = 2
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 1) then
gBalls = 3
gSpecial = 1
end if
if ((gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 0) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 1)) or ((gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH - 4] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Down&Left1"
end if
if (gGo4WinH >= 6) and (gGo4WinV <= 8) then
if ((gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 0) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 1)) or ((gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH - 4] = 1)) or ((gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 0) and (gGameBoard[gGo4WinV + 4][gGo4WinH - 4] = 2) and (gGameBoard[gGo4WinV + 5][gGo4WinH - 5] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Down&Left2"
end if
end if
else
if (gGo4WinH = 4) and (gGo4WinV = 10) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) then
gBalls = 2
if (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] <> 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 0) then
gBalls = 3
end if
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 0) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 1) then
gBalls = 1
gSpecial = 0
put "distaste Down&Left3"
end if
else
if (gGo4WinH = 3) and (gGo4WinV = 11) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) then
gBalls = 2
end if
end if
end if
end if
if gBalls >= gSaveLength then
gNuMapPosY = gGo4WinV + (gBalls - gSpecial)
gNuMapPosX = gGo4WinH - (gBalls - gSpecial)
gSaveLength = gBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gBalls = 1
gSpecial = 0
if gGo4WinV <= 9 then
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) then
gBalls = 2
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 0) then
gBalls = 3
end if
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
gBalls = 4
end if
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
gBalls = 4
gSpecial = 2
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 1) then
gBalls = 3
gSpecial = 1
end if
if ((gGameBoard[gGo4WinV + 1][gGo4WinH] = 0) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 1)) or ((gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Down1"
end if
if gGo4WinV <= 8 then
if ((gGameBoard[gGo4WinV + 1][gGo4WinH] = 0) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 1)) or ((gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH] = 1)) or ((gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 0) and (gGameBoard[gGo4WinV + 4][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 5][gGo4WinH] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Down2"
end if
end if
else
if gGo4WinV = 10 then
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) then
gBalls = 2
if (gGameBoard[gGo4WinV + 2][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 0) then
gBalls = 3
end if
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 0) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 1) then
gBalls = 1
gSpecial = 0
put "distaste Down3"
end if
else
if gGo4WinV = 11 then
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) then
gBalls = 2
end if
end if
end if
end if
if gBalls >= gSaveLength then
gNuMapPosY = gGo4WinV + (gBalls - gSpecial)
gNuMapPosX = gGo4WinH
gSaveLength = gBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gBalls = 1
gSpecial = 0
if (gGo4WinH <= 9) and (gGo4WinV <= 9) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) then
gBalls = 2
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 0) then
gBalls = 3
end if
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
gBalls = 4
end if
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
gBalls = 4
gSpecial = 2
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 1) then
gBalls = 3
gSpecial = 1
end if
if ((gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 0) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 1)) or ((gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH + 4] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Down&Right1"
end if
if (gGo4WinH <= 8) and (gGo4WinV <= 8) then
if ((gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 0) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 1)) or ((gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH + 4] = 1)) or ((gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 0) and (gGameBoard[gGo4WinV + 4][gGo4WinH + 4] = 2) and (gGameBoard[gGo4WinV + 5][gGo4WinH + 5] = 1)) then
gBalls = 0
gSpecial = 0
put "distaste Down&Right2"
end if
end if
else
if (gGo4WinH = 10) and (gGo4WinV = 10) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) then
gBalls = 2
if (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] <> 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 0) then
gBalls = 3
end if
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 0) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 1) then
gBalls = 1
gSpecial = 0
put "distaste Down&Right3"
end if
else
if (gGo4WinH = 11) and (gGo4WinV = 11) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] <> 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) then