Frame 1
_root.n = 5;
_root.hlp._visible = false;
stop();
Instance of Symbol 17 MovieClip "table" in Frame 1
onClipEvent (load) {
_x = ((550 - (_root.n * 95)) / 2);
_y = ((400 - (_root.n * 64)) / 2);
}
Symbol 7 MovieClip [box] Frame 1
stop();
Symbol 7 MovieClip [box] Frame 2
stop();
Symbol 14 Button
on (release) {
getURL ("http://www.2flashgames.com");
}
Symbol 17 MovieClip Frame 1
function update(x, y) {
if (!((((x < 0) || (x >= n)) || (y < 0)) || (y >= n))) {
var k = this["b" + (x + (y * n))]._currentframe;
k = (k % 2) + 1;
this["b" + (x + (y * n))].gotoAndStop(k);
}
}
function clicked(x, y) {
update(x, y);
var i = 0;
while (i < 4) {
update(x + d[i][0], y + d[i][1]);
i++;
}
}
n = _root.n;
d = [[1, 0], [0, 1], [-1, 0], [0, -1]];
var i = 0;
while (i < n) {
var k = 0;
while (k < n) {
if ((i + k) != 0) {
duplicateMovieClip ("b0", "b" + (i + (k * n)), i + (k * n));
}
this["b" + (i + (k * n))]._x = i * 50;
this["b" + (i + (k * n))]._y = k * 50;
this["b" + (i + (k * n))].x = i;
this["b" + (i + (k * n))].y = k;
this["b" + (i + (k * n))].hint._visible = false;
k++;
}
i++;
}
Instance of Symbol 7 MovieClip [box] "b0" in Symbol 17 MovieClip Frame 1
onClipEvent (mouseDown) {
if (hitTest(_root._xmouse, _root._ymouse, false)) {
_parent.clicked(x, y);
hint._visible = false;
_root.hlp._visible = false;
var z = 0;
var i = 0;
while (i < (_root.n * _root.n)) {
if (_parent["b" + i]._currentframe == 1) {
z = 1;
break;
}
i++;
}
if (z == 0) {
_root.cpl.play();
}
}
}
Symbol 21 Button
on (release) {
n = _root.n;
var z = 0;
var i = 0;
while (i < n) {
var k = 0;
while (k < n) {
var t = random(2);
j = 0;
while (j < t) {
_root.table.clicked(i, k);
j++;
}
_root.table["b" + (i + (k * n))].hint._visible = false;
k++;
}
i++;
}
}
Symbol 24 Button
on (release) {
function clicked(x, y) {
a2[x][y] = (a2[x][y] + 1) % 2;
var i = 0;
while (i < 4) {
p = x + d[i][0];
q = y + d[i][1];
if (!((((p < 0) || (p >= n)) || (q < 0)) || (q >= n))) {
a2[p][q] = (a2[p][q] + 1) % 2;
}
i++;
}
}
function ok() {
var i = 0;
while (i < n) {
var k = 0;
while (k < n) {
a2[i][k] = a[i][k];
k++;
}
i++;
}
var k = 0;
while (k < n) {
kq[k * n] = false;
if (b[k] == 1) {
clicked(0, k);
kq[k * n] = true;
}
k++;
}
var i = 1;
while (i < n) {
var k = 0;
while (k < n) {
kq[i + (k * n)] = false;
if (a2[i - 1][k] == 0) {
clicked(i, k);
kq[i + (k * n)] = true;
}
k++;
}
i++;
}
var k = 0;
while (k < n) {
if (a2[n - 1][k] == 0) {
return(false);
}
k++;
}
return(true);
}
function dq(i) {
var k = 0;
while (k < 2) {
b[i] = k;
if (i == n) {
if (ok()) {
var j = 0;
while (j < (n * n)) {
if (kq[j]) {
_root.table["b" + j].hint._visible = true;
}
j++;
}
th = true;
}
} else {
dq(i + 1);
}
if (th) {
return;
}
k++;
}
}
n = _root.n;
a = new Array(n);
a2 = new Array(n);
b = new Array(n);
kq = new Array(n * n);
th = false;
_root.hlp._visible = true;
d = [[1, 0], [0, 1], [-1, 0], [0, -1]];
var i = 0;
while (i < n) {
a[i] = new Array();
a2[i] = new Array(n);
var k = 0;
while (k < n) {
if (_root.table["b" + (i + (k * n))]._currentframe == 2) {
a[i].push(1);
} else {
a[i].push(0);
}
k++;
}
i++;
}
dq(0);
}
Symbol 31 MovieClip Frame 1
stop();