Frame 1
function randRange(min, max) {
var _local1 = Math.floor(Math.random() * ((max - min) + 1)) + min;
return(_local1);
}
function rst() {
cdui = emp;
cduj = emp;
j = 0;
while (j < cy) {
i = 0;
while (i < cx) {
prf = 0;
_root[("c" + j) + i].ins.enabled = true;
_root[("c" + j) + i].ins.gotoAndStop(1);
_root[("c" + j) + i].ins.tx._visible = false;
i++;
}
j++;
}
n = 0;
while (n < bmq) {
do {
rr = 1;
bb1 = randRange(0, cx - 1);
bb2 = randRange(0, cy - 1);
n1 = 0;
while (n1 < bx.length) {
if ((bx[n1] == bb1) & (by[n1] == bb2)) {
rr = 0;
}
n1++;
}
} while (rr < 1);
bx[n] = bb1;
by[n] = bb2;
n++;
}
}
function rf(i, j) {
byn = 0;
n = 0;
while (n < cdui.length) {
if ((i == cdui[n]) & (j == cduj[n])) {
byn = 1;
}
n++;
}
if (byn == 0) {
_root[("c" + j) + i].ins.gotoAndStop(2);
_root[("c" + j) + i].ins.tx._visible = true;
cdui.push(i);
cduj.push(j);
if (_root[("c" + j) + i].ins.tx.text == "") {
lp = 0;
n = 1;
while (n < cdm.length) {
if (cdm[n] == "c") {
lp = n + 1;
}
if (((cdm[n] % cx) == i) & (Math.floor(cdm[n] / cx) == j)) {
n1 = lp;
while (n1 < cdm.length) {
j1 = Math.floor(cdm[n1] / cx);
i1 = cdm[n1] % cx;
mj = j1 - 1;
while (mj < (j1 + 2)) {
mi = i1 - 1;
while (mi < (i1 + 2)) {
_root[("c" + mj) + mi].ins.gotoAndStop(2);
_root[("c" + mj) + mi].ins.tx._visible = true;
cdui.push(mi);
cduj.push(mj);
mi++;
}
mj++;
}
n1++;
}
}
n++;
}
}
}
n = 0;
while (n < bx.length) {
if ((i == bx[n]) & (j == by[n])) {
_root[("c" + j) + i].ins.gotoAndStop(3);
duplicateMovieClip (ppcp, "pp1", this.getNextHighestDepth());
_root.pp1.gotoAndStop(2);
op();
}
n++;
}
if (prf == (((cx * cy) - bmq) - 1)) {
duplicateMovieClip (ppcp, "pp1", this.getNextHighestDepth());
_root.pp1.gotoAndStop(3);
}
}
function lf(i, j) {
d = 0;
mj = j - 1;
while (mj < (j + 2)) {
mi = i - 1;
while (mi < (i + 2)) {
n = 0;
while (n < bx.length) {
if ((mi == bx[n]) & (mj == by[n])) {
d++;
}
n++;
}
mi++;
}
mj++;
}
cdx.push(d);
_root[("c" + j) + i].ins.tx.text = d;
if (d == 0) {
_root[("c" + j) + i].ins.tx.text = "";
}
}
function op() {
j = 0;
while (j < cy) {
i = 0;
while (i < cx) {
_root[("c" + j) + i].ins.gotoAndStop(2);
_root[("c" + j) + i].ins.tx._visible = true;
_root[("c" + j) + i].ins.tx.enabled = false;
n = 0;
while (n < bx.length) {
if ((i == bx[n]) & (j == by[n])) {
_root[("c" + j) + i].ins.gotoAndStop(3);
}
n++;
}
i++;
}
j++;
}
}
function chkit(i) {
cdx[i] = "c";
cdm.push(i);
if ((cdx[i - 1] == 0) & ((i % cx) != 0)) {
chkit(i - 1);
}
if (cdx[i + cx] == 0) {
chkit(i + cx);
}
if ((cdx[i + 1] == 0) & ((i + (1 % cx)) != 0)) {
chkit(i + 1);
}
if (cdx[i - cx] == 0) {
chkit(i - cx);
}
}
cw = 40;
cx = 7;
cy = 9;
bmq = 9;
prf = 0;
var emp = Array("f");
var bx = Array();
var by = Array();
var cdx = Array();
var cdm = Array();
var cdui = Array();
var cduj = Array();
n = 0;
while (n < bmq) {
do {
rr = 1;
bb1 = randRange(0, cx - 1);
bb2 = randRange(0, cy - 1);
n1 = 0;
while (n1 < bx.length) {
if ((bx[n1] == bb1) & (by[n1] == bb2)) {
rr = 0;
}
n1++;
}
} while (rr < 1);
bx[n] = bb1;
by[n] = bb2;
n++;
}
j = 0;
while (j < cy) {
i = 0;
while (i < cx) {
duplicateMovieClip (cc, ("c" + j) + i, this.getNextHighestDepth());
_root[("c" + j) + i]._x = 35 + (i * cw);
_root[("c" + j) + i]._y = 35 + (j * cw);
i++;
}
j++;
}
j = 0;
while (j < cy) {
i = 0;
while (i < cx) {
lf(i, j);
_root[("c" + j) + i].ins.tx._visible = false;
i++;
}
j++;
}
i = 0;
while (i < (cx * cy)) {
if (cdx[i] == 0) {
chkit(i);
cdm.push("c");
}
i++;
}
cc.ins.enabled = false;
Symbol 6 MovieClip Frame 1
stop();
Symbol 8 MovieClip Frame 1
stop();
Symbol 8 MovieClip Frame 12
_parent.gotoAndStop(4);
en = 1;
Symbol 24 MovieClip Frame 1
stop();
Symbol 24 MovieClip Frame 2
_root.prf = _root.prf + 1;
Instance of Symbol 24 MovieClip "ins" in Symbol 25 MovieClip Frame 1
on (rollOver) {
this.ss.gotoAndPlay(2);
}
on (press) {
tmm.en = 0;
tmm.gotoAndPlay(2);
}
on (release) {
trace(tmm.en);
tmm.gotoAndStop(1);
if (tmm.en == 0) {
ny = Number(String(this).charAt(9));
nx = Number(String(this).charAt(10));
_root.rf(nx, ny);
tmm.en = 0;
}
}
Symbol 31 Button
on (press) {
_root.rst();
removeMovieClip(this);
}
Symbol 36 MovieClip Frame 1
stop();