if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) then
gEBalls = 2
end if
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 0) then
gEBalls = 3
end if
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 4] = 0) then
gEBalls = 4
end if
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 4] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 5] = 0) then
gEBalls = 5
end if
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 4] = 2) then
gBalls = 4
gSpecial = 2
end if
else
if gGo4WinH = 11 then
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 3] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 0) then
gEBalls = 3
if (gGameBoard[gGo4WinV][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 4] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH + 4] = 0) then
gEBalls = 4
end if
end if
end if
else
if gGo4WinH = 12 then
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 3] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH + 3] = 0) then
gEBalls = 3
end if
end if
else
if gGo4WinH = 13 then
if (gGameBoard[gGo4WinV][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH + 2] = 0) then
gEBalls = 2
end if
end if
end if
end if
end if
if gEBalls > gESaveLength then
gNuMapPosY = gGo4WinV
gNuMapPosX = gGo4WinH + (gEBalls - gSpecial)
gESaveLength = gEBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gEBalls = 1
gSpecial = 0
if (gGo4WinH <= 10) and (gGo4WinV >= 6) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) then
gEBalls = 2
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 0) then
gEBalls = 3
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH + 4] = 0) then
gEBalls = 4
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH + 4] = 2) and (gGameBoard[gGo4WinV - 5][gGo4WinH + 5] = 0) then
gEBalls = 5
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH + 4] = 2) then
gBalls = 4
gSpecial = 2
end if
else
if (gGo4WinH = 11) and (gGo4WinV = 5) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] <> 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 0) then
gEBalls = 3
if (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH + 4] <> 1) and (gGameBoard[gGo4WinV - 4][gGo4WinH + 4] = 0) then
gEBalls = 4
end if
end if
end if
else
if (gGo4WinH = 12) and (gGo4WinV = 4) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] <> 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH + 3] = 0) then
gEBalls = 3
end if
end if
else
if (gGo4WinH = 13) and (gGo4WinV = 3) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH + 2] = 0) then
gEBalls = 2
end if
end if
end if
end if
end if
if gEBalls > gESaveLength then
gNuMapPosY = gGo4WinV - (gEBalls - gSpecial)
gNuMapPosX = gGo4WinH + (gEBalls - gSpecial)
gESaveLength = gEBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gEBalls = 1
gSpecial = 0
if gGo4WinV >= 6 then
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) then
gEBalls = 2
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 0) then
gEBalls = 3
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH] = 0) then
gEBalls = 4
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 5][gGo4WinH] = 0) then
gEBalls = 5
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH] = 2) then
gBalls = 4
gSpecial = 2
end if
else
if gGo4WinV = 5 then
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV - 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 0) then
gEBalls = 3
if (gGameBoard[gGo4WinV - 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV - 4][gGo4WinH] = 0) then
gEBalls = 4
end if
end if
end if
else
if gGo4WinV = 4 then
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV - 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH] = 0) then
gEBalls = 3
end if
end if
else
if gGo4WinV = 3 then
if (gGameBoard[gGo4WinV - 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH] = 0) then
gEBalls = 2
end if
end if
end if
end if
end if
if gEBalls > gESaveLength then
gNuMapPosY = gGo4WinV - (gEBalls - gSpecial)
gNuMapPosX = gGo4WinH
gESaveLength = gEBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gEBalls = 1
gSpecial = 0
if (gGo4WinH >= 6) and (gGo4WinV >= 6) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) then
gEBalls = 2
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 0) then
gEBalls = 3
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH - 4] = 0) then
gEBalls = 4
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH - 4] = 2) and (gGameBoard[gGo4WinV - 5][gGo4WinH - 5] = 0) then
gEBalls = 5
end if
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH - 4] = 2) then
gBalls = 4
gSpecial = 2
end if
else
if (gGo4WinH = 5) and (gGo4WinV = 5) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] <> 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 0) then
gEBalls = 3
if (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV - 4][gGo4WinH - 4] <> 1) and (gGameBoard[gGo4WinV - 4][gGo4WinH - 4] = 0) then
gEBalls = 4
end if
end if
end if
else
if (gGo4WinH = 4) and (gGo4WinV = 4) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] <> 1) and (gGameBoard[gGo4WinV - 3][gGo4WinH - 3] = 0) then
gEBalls = 3
end if
end if
else
if (gGo4WinH = 3) and (gGo4WinV = 3) then
if (gGameBoard[gGo4WinV - 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV - 2][gGo4WinH - 2] = 0) then
gEBalls = 2
end if
end if
end if
end if
end if
if gEBalls > gESaveLength then
gNuMapPosY = gGo4WinV - (gEBalls - gSpecial)
gNuMapPosX = gGo4WinH - (gEBalls - gSpecial)
gESaveLength = gEBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gEBalls = 1
gSpecial = 0
if gGo4WinH >= 6 then
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) then
gEBalls = 2
end if
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 0) then
gEBalls = 3
end if
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 4] = 0) then
gEBalls = 4
end if
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 4] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 5] = 0) then
gEBalls = 5
end if
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 4] = 2) then
gBalls = 4
gSpecial = 2
end if
else
if gGo4WinH = 5 then
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 3] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 0) then
gEBalls = 3
if (gGameBoard[gGo4WinV][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 4] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH - 4] = 0) then
gEBalls = 4
end if
end if
end if
else
if gGo4WinH = 4 then
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 3] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH - 3] = 0) then
gEBalls = 3
end if
end if
else
if gGo4WinH = 3 then
if (gGameBoard[gGo4WinV][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV][gGo4WinH - 2] = 0) then
gEBalls = 2
end if
end if
end if
end if
end if
if gEBalls > gESaveLength then
gNuMapPosY = gGo4WinV
gNuMapPosX = gGo4WinH - (gEBalls - gSpecial)
gESaveLength = gEBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gEBalls = 1
gSpecial = 0
if (gGo4WinH >= 6) and (gGo4WinV <= 10) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) then
gEBalls = 2
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 0) then
gEBalls = 3
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH - 4] = 0) then
gEBalls = 4
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH - 4] = 2) and (gGameBoard[gGo4WinV + 5][gGo4WinH - 5] = 0) then
gEBalls = 5
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) and (gGameBoard[gGo4WinV + 4][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH - 4] = 2) then
gBalls = 4
gSpecial = 2
end if
else
if (gGo4WinH = 5) and (gGo4WinV = 11) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] <> 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 0) then
gEBalls = 3
if (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH - 4] <> 1) and (gGameBoard[gGo4WinV + 4][gGo4WinH - 4] = 0) then
gEBalls = 4
end if
end if
end if
else
if (gGo4WinH = 4) and (gGo4WinV = 12) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] <> 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH - 3] = 0) then
gEBalls = 3
end if
end if
else
if (gGo4WinH = 3) and (gGo4WinV = 13) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH - 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH - 2] = 0) then
gEBalls = 2
end if
end if
end if
end if
end if
if gEBalls > gESaveLength then
gNuMapPosY = gGo4WinV + (gEBalls - gSpecial)
gNuMapPosX = gGo4WinH - (gEBalls - gSpecial)
gESaveLength = gEBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gEBalls = 1
gSpecial = 0
if gGo4WinV <= 10 then
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) then
gEBalls = 2
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 0) then
gEBalls = 3
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH] = 0) then
gEBalls = 4
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 5][gGo4WinH] = 0) then
gEBalls = 5
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH] = 2) then
gBalls = 4
gSpecial = 2
end if
else
if gGo4WinV = 11 then
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV + 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 0) then
gEBalls = 3
if (gGameBoard[gGo4WinV + 3][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV + 4][gGo4WinH] = 0) then
gEBalls = 4
end if
end if
end if
else
if gGo4WinV = 12 then
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV + 2][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH] = 0) then
gEBalls = 3
end if
end if
else
if gGo4WinV = 13 then
if (gGameBoard[gGo4WinV + 1][gGo4WinH] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH] = 0) then
gEBalls = 2
end if
end if
end if
end if
end if
if gEBalls > gESaveLength then
gNuMapPosY = gGo4WinV + (gEBalls - gSpecial)
gNuMapPosX = gGo4WinH
gESaveLength = gEBalls
gEKountV = gNuMapPosY
gEKountH = gNuMapPosX
end if
gEBalls = 1
gSpecial = 0
if (gGo4WinH <= 10) and (gGo4WinV <= 10) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) then
gEBalls = 2
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 0) then
gEBalls = 3
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH + 4] = 0) then
gEBalls = 4
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH + 4] = 2) and (gGameBoard[gGo4WinV + 5][gGo4WinH + 5] = 0) then
gEBalls = 5
end if
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) and (gGameBoard[gGo4WinV + 4][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH + 4] = 2) then
gBalls = 4
gSpecial = 2
end if
else
if (gGo4WinH = 11) and (gGo4WinV = 11) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] <> 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 0) then
gEBalls = 3
if (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 2) and (gGameBoard[gGo4WinV + 4][gGo4WinH + 4] <> 1) and (gGameBoard[gGo4WinV + 4][gGo4WinH + 4] = 0) then
gEBalls = 4
end if
end if
end if
else
if (gGo4WinH = 12) and (gGo4WinV = 12) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) then
gEBalls = 2
if (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 2) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] <> 1) and (gGameBoard[gGo4WinV + 3][gGo4WinH + 3] = 0) then
gEBalls = 3
end if
end if
else
if (gGo4WinH = 13) and (gGo4WinV = 13) then
if (gGameBoard[gGo4WinV + 1][gGo4WinH + 1] = 2) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] <> 1) and (gGameBoard[gGo4WinV + 2][gGo4WinH + 2] = 0) then