Minesweeper clone made in Game Maker at age 12; uncover_squares() script:

**Code:**

var unc,uncI,uncJ,goagain,mx,my,clipl,clipu,clipr,clipd;

unc = 1;

uncI[0] = i;

uncJ[0] = j;

square[i,j] = false;

squares_left -= 1;

goagain = true;

if num[i,j] == 0

while(goagain == true)

{

goagain = false;

for(e = 0; e < unc; e += 1)

{

mx = uncI[e];

my = uncJ[e];

clipl = mx == 0;

clipu = my == 0;

clipr = mx == global.horizontal_squares-1;

clipd = my == global.vertical_squares-1;

if !clipl

{

if square[mx-1,my] && !bad[mx-1,my] begin square[mx-1,my] = false; squares_left -= 1; goagain = true; if num[mx-1,my] == 0 {uncI[unc] = mx-1; uncJ[unc] = my; unc += 1} end

if !clipu if square[mx-1,my-1] && !bad[mx-1,my-1] begin square[mx-1,my-1] = false; squares_left -= 1; goagain = true; if num[mx-1,my-1] == 0 {uncI[unc] = mx-1; uncJ[unc] = my-1; unc += 1} end

if !clipd if square[mx-1,my+1] && !bad[mx-1,my+1] begin square[mx-1,my+1] = false; squares_left -= 1; goagain = true; if num[mx-1,my+1] == 0 {uncI[unc] = mx-1; uncJ[unc] = my+1; unc += 1} end

}

if !clipr

{

if square[mx+1,my] && !bad[mx+1,my] begin square[mx+1,my] = false; squares_left -= 1; goagain = true; if num[mx+1,my] = 0 {uncI[unc] = mx+1; uncJ[unc] = my; unc += 1} end

if !clipu if square[mx+1,my-1] && !bad[mx+1,my-1] begin square[mx+1,my-1] = false; squares_left -= 1; goagain = true; if num[mx+1,my-1] == 0 {uncI[unc] = mx+1; uncJ[unc] = my-1; unc += 1} end

if !clipd if square[mx+1,my+1] && !bad[mx+1,my+1] begin square[mx+1,my+1] = false; squares_left -= 1; goagain = true; if num[mx+1,my+1] == 0 {uncI[unc] = mx+1; uncJ[unc] = my+1; unc += 1} end

}

if !clipu if square[mx,my-1] && !bad[mx,my-1] begin square[mx,my-1] = false; squares_left -= 1; goagain = true; if num[mx,my-1] == 0 {uncI[unc] = mx; uncJ[unc] = my-1; unc += 1} end

if !clipd if square[mx,my+1] && !bad[mx,my+1] begin square[mx,my+1] = false; squares_left -= 1; goagain = true; if num[mx,my+1] == 0 {uncI[unc] = mx; uncJ[unc] = my+1; unc += 1} end

if unc > global.horizontal_squares*global.vertical_squares begin show_message("Detected non-stop repeat. Terminating loop at once."); goagain = false; break; end

}

}

if squares_left == global.mines win = true;

Try to read it... haha. It's a bit interesting though.