Frame 1
function TIndicator(digitcount, pos_x, pos_y, Depth) {
this.DigitCount = digitcount;
var x;
var y;
x = pos_x - ((digitcount * DIGITSIZE) / 2);
y = pos_y + (DIGITSIZE / 2);
this.Digits = new Array(digitcount);
var i = 0;
while (i < digitcount) {
attachMovie("Digit", ("Dgt" + Depth) + i, Depth + i);
this.Digits[i] = eval (("Dgt" + Depth) + i);
this.Digits[i]._width = (this.Digits[i]._height = DIGITSIZE);
this.Digits[i]._x = x;
this.Digits[i]._y = y;
this.Digits[i].stop();
x = x + DIGITSIZE;
i++;
}
this.SetValue(0);
}
function init() {
scrBoxOffset = 25;
scrBoxWidth = 340;
scrBoxHeight = 340;
GameDepth = 100;
_root.chek1._visible = true;
_root.chek2._visible = false;
_root.chek3._visible = false;
G = new TGame();
G.NewGame();
}
function TGame() {
this.BoxColCount = 5;
this.BoxRowCount = 5;
this.AtomCount = 10;
this.OpenedAtoms = 0;
this.Skill = "beginner";
this.pbState = "idle";
this.Pause = false;
this.prLamps = new Array(4);
var i = 0;
while (i < 4) {
this.prLamps[i] = new Array();
i++;
}
this.TI = new TIndicator(4, 480, 10, 30);
this.AI = new TIndicator(2, 500, 30, 40);
}
fscommand ("showmenu", false);
DIGITSIZE = 20;
TIndicator.prototype.SetValue = function (Value) {
this.Value = Value;
var i = (this.DigitCount - 1);
while (i >= 0) {
this.Digits[i].gotoAndStop((((Value % 10) == 0) ? 10 : (value % 10)));
Value = Value / 10;
value = int(value);
i--;
}
};
movieClip.prototype.SetCheck = function (v) {
this.Checked = v;
if (v) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
if (v) {
var i = 0;
while (i < _parent.RadioGroup.length) {
if (this._target != _parent.RadioGroup[i]) {
eval (_parent.RadioGroup[i]).SetCheck(false);
}
i++;
}
}
};
TGame.prototype.NewGame = function () {
if (msg != undefined) {
removeMovieClip(msg);
}
this.StartTime = getTimer();
this.PausedTime = 0;
this.RemoveLampsAndCells();
if (this.Skill == "expert") {
this.BoxColCount = 18;
this.BoxRowCount = 18;
this.AtomCount = 30;
} else if (this.Skill == "advanced") {
this.BoxColCount = 15;
this.BoxRowCount = 15;
this.AtomCount = 15;
}
if (this.Skill == "beginner") {
this.BoxColCount = 8;
this.BoxRowCount = 8;
this.AtomCount = 5;
}
this.OpenedAtoms = 0;
this.OpenedCell = 0;
this.CorrectFlags = 0;
this.TI.SetValue(0);
this.AI.SetValue(this.AtomCount);
this.Box = new Array(this.BoxRowCount);
var i = 0;
while (i < this.BoxRowCount) {
this.Box[i] = new Array(this.BoxColCount);
i++;
}
this.InitBox();
this.pbState = "idle";
};
TGame.prototype.OnNextFrame = function () {
if ((this.pbState == "paused") || (this.pbState == "stopped")) {
return(undefined);
}
if (this.pbState == "idle") {
this.curTime = Math.floor(((getTimer() - this.StartTime) - this.PausedTime) / 1000);
this.TI.SetValue(this.curTime);
} else if (this.pbState == "gameover") {
this.GameOver();
} else if (this.pbState == "newgame") {
this.NewGameMsg();
} else if (this.pbState == "victory") {
this.Victory();
}
};
TGame.prototype.InitBox = function () {
var k = 0;
while (k < this.AtomCount) {
var p = random(((this.BoxColCount - 2) * (this.BoxRowCount - 2)) - k);
var i;
var j;
i = 1;
while ((i < (this.BoxRowCount - 1)) && (p >= 0)) {
j = 1;
while ((j < (this.BoxColCount - 1)) && (p >= 0)) {
if (this.Box[i][j] == undefined) {
p--;
}
j++;
}
i++;
}
this.Box[--i][--j] = "atom";
k++;
}
this.CellWidth = scrBoxWidth / (this.BoxColCount + 2);
this.CellHeight = scrBoxWidth / (this.BoxRowCount + 2);
this.lampDepth = GameDepth;
var i = 0;
while (i < this.BoxColCount) {
attachMovie("Lamp", "Button1u" + i, this.lampDepth);
var ub = eval ("Button1u" + i);
ub._width = this.CellWidth;
ub._height = this.CellHeight;
ub._x = scrBoxOffset + (this.CellWidth * (i + 1));
ub._y = scrBoxOffset;
ub.index = i;
ub.side = "top";
this.lampDepth++;
this.prLamps[0][i] = ub;
attachMovie("Lamp", "Button1b" + i, this.lampDepth);
var ub = eval ("Button1b" + i);
ub._width = this.CellWidth;
ub._height = this.CellHeight;
ub._x = scrBoxOffset + (this.CellWidth * (i + 1));
ub._y = (scrBoxOffset + scrBoxHeight) - this.CellHeight;
ub.index = i;
ub.side = "btm";
this.lampDepth++;
this.prLamps[1][i] = ub;
i++;
}
var i = 0;
while (i < this.BoxRowCount) {
attachMovie("Lamp", "Button1l" + i, this.lampDepth);
var ub = eval ("Button1l" + i);
ub._width = this.CellWidth;
ub._height = this.CellHeight;
ub._y = scrBoxOffset + (this.CellHeight * (i + 1));
ub._x = scrBoxOffset;
ub.index = i;
ub.side = "lft";
this.lampDepth++;
this.prLamps[2][i] = ub;
attachMovie("Lamp", "Button1r" + i, this.lampDepth);
var ub = eval ("Button1r" + i);
ub._width = this.CellWidth;
ub._height = this.CellHeight;
ub._y = scrBoxOffset + (this.CellHeight * (i + 1));
ub._x = (scrBoxOffset + scrBoxWidth) - this.CellWidth;
ub.index = i;
ub.side = "rgt";
this.lampDepth++;
this.prLamps[3][i] = ub;
i++;
}
this.ButtonCount = this.lampDepth - GameDepth;
this.lampDepth = GameDepth;
this.cellDepth = this.lampDepth + this.ButtonCount;
var d = this.cellDepth;
var i = 0;
while (i < this.BoxRowCount) {
var j = 0;
while (j < this.BoxColCount) {
attachMovie("Cell", (("Cell" + i) + "_") + j, d);
var c = eval ((("Cell" + i) + "_") + j);
c._width = this.CellWidth;
c._height = this.CellHeight;
c._y = scrBoxOffset + (this.CellHeight * (i + 1));
c._x = scrBoxOffset + (this.CellWidth * (j + 1));
c.row = i;
c.col = j;
if ((((i == 0) || (j == 0)) || (i == (this.BoxRowCount - 1))) || (j == (this.BoxColCount - 1))) {
c.gotoAndStop("Empty");
}
d++;
j++;
}
i++;
}
this.FreeDepth = d + 1;
this.PrepareRaflactions();
};
TGame.prototype.TraceLight = function (index, side) {
var i;
var j;
var di;
var dj;
if (side == "top") {
i = 0;
j = index;
di = 1;
dj = 0;
} else if (side == "btm") {
i = this.BoxRowCount - 1;
j = index;
di = -1;
dj = 0;
} else if (side == "lft") {
i = index;
j = 0;
di = 0;
dj = 1;
} else if (side == "rgt") {
i = index;
j = this.BoxColCount - 1;
di = 0;
dj = -1;
}
var reflections = 0;
do {
if (3 < reflections) {
return(undefined);
}
var ii = (i + di);
var jj = (j + dj);
if (this.Box[i][j] == "atom") {
return(undefined);
}
if (this.Box[ii][jj] == "atom") {
return(undefined);
}
if (this.Box[ii - dj][jj - di] == "atom") {
var t = di;
di = dj;
dj = t;
reflections++;
} else if (this.Box[ii + dj][jj + di] == "atom") {
reflections++;
var t = di;
di = -dj;
dj = -t;
} else {
reflections = 0;
i = i + di;
j = j + dj;
}
} while ((((i >= 0) && ((this.BoxRowCount - 1) >= i)) && (j >= 0)) && ((this.BoxColCount - 1) >= j));
i = i - di;
j = j - dj;
var out = new Object();
if (di == -1) {
out.index = j;
out.side = "top";
} else if (di == 1) {
out.index = j;
out.side = "btm";
} else if (dj == -1) {
out.index = i;
out.side = "lft";
} else if (dj == 1) {
out.index = i;
out.side = "rgt";
}
return(out);
};
TGame.prototype.AddReflectionPair = function (index, side) {
var inr = new Object();
inr.index = index;
inr.side = side;
var out = this.TraceLight(index, side);
var foud = false;
var i = 0;
while ((i < this.Reflections.length) && (!found)) {
if ((this.Reflections[i][1] == inr) && (this.Reflections[i][0] == out)) {
found = true;
}
i++;
}
if (!found) {
this.Reflections.push(new Array(inr, out));
}
};
TGame.prototype.PrepareRaflactions = function () {
if (this.Reflections != undefined) {
delete this.Reflections;
}
this.Reflections = new Array();
var i = 0;
while (i < this.BoxColCount) {
this.AddReflectionPair(this.prLamps[0][i].index, this.prLamps[0][i].side);
this.AddReflectionPair(this.prLamps[1][i].index, this.prLamps[1][i].side);
i++;
}
var i = 0;
while (i < this.BoxRowCount) {
this.AddReflectionPair(this.prLamps[2][i].index, this.prLamps[2][i].side);
this.AddReflectionPair(this.prLamps[3][i].index, this.prLamps[3][i].side);
i++;
}
};
TGame.prototype.ShowReflection = function (index, side) {
var inray = this.GetLamp(index, side);
var f = false;
var k = 0;
while (k < this.Reflections.length) {
if ((this.Reflections[k][0].index == index) && (this.Reflections[k][0].side == side)) {
var outray = this.GetLamp(this.Reflections[k][1].index, this.Reflections[k][1].side);
if (outray != undefined) {
outray.gotoAndStop("Active");
outray.Pushed = true;
f = true;
}
}
k++;
}
if (f == true) {
inray.gotoAndStop("Active");
} else {
inray.gotoAndStop("Absorbed");
}
};
TGame.prototype.GetLamp = function (index, side) {
if (side == "top") {
return(this.prLamps[0][index]);
}
if (side == "btm") {
return(this.prLamps[1][index]);
}
if (side == "lft") {
return(this.prLamps[2][index]);
}
if (side == "rgt") {
return(this.prLamps[3][index]);
}
};
TGame.prototype.UpdateLamps = function () {
var i = 0;
while (i < this.BoxColCount) {
if (this.prLamps[0][i].Pushed == true) {
this.prLamps[0][i].gotoAndStop("Active");
} else {
this.prLamps[0][i].gotoAndStop("Inactive");
}
if (this.prLamps[1][i].Pushed == true) {
this.prLamps[1][i].gotoAndStop("Active");
} else {
this.prLamps[1][i].gotoAndStop("Inactive");
}
i++;
}
var i = 0;
while (i < this.BoxRowCount) {
if (this.prLamps[2][i].Pushed == true) {
this.prLamps[2][i].gotoAndStop("Active");
} else {
this.prLamps[2][i].gotoAndStop("Inactive");
}
if (this.prLamps[3][i].Pushed == true) {
this.prLamps[3][i].gotoAndStop("Active");
} else {
this.prLamps[3][i].gotoAndStop("Inactive");
}
i++;
}
};
TGame.prototype.RemoveLampsAndCells = function () {
var i = 0;
while (i < this.BoxColCount) {
removeMovieClip(this.prLamps[0][i]);
removeMovieClip(this.prLamps[1][i]);
i++;
}
var i = 0;
while (i < this.BoxColCount) {
removeMovieClip(this.prLamps[2][i]);
removeMovieClip(this.prLamps[3][i]);
i++;
}
delete this.prLamps[0];
delete this.prLamps[1];
delete this.prLamps[2];
delete this.prLamps[3];
var i = 0;
while (i < 4) {
this.prLamps[i] = new Array();
i++;
}
var i = 0;
while (i < this.BoxRowCount) {
var j = 0;
while (j < this.BoxColCount) {
removeMovieClip(eval ((("Cell" + i) + "_") + j));
j++;
}
delete this.Box[i];
i++;
}
delete this.Box;
};
TGame.prototype.GameOver = function () {
this.pbState = "stopped";
this.OpenBox();
attachMovie("msgGameOver", "msg", this.FreeDepth + 100);
msg._x = scrBoxOffset + (scrBoxWidth / 2);
msg._y = scrBoxOffset + (scrBoxHeight / 2);
};
TGame.prototype.Victory = function () {
this.pbState = "stopped";
attachMovie("msgVictory", "msg", this.FreeDepth + 100);
msg._x = scrBoxOffset + (scrBoxWidth / 2);
msg._y = scrBoxOffset + (scrBoxHeight / 2);
this.OpenBox();
};
TGame.prototype.NewGameMsg = function () {
this.ToglePause(true);
attachMovie("msgNewGame", "ngmsg", this.FreeDepth + 150);
ngmsg._x = scrBoxOffset + (scrBoxWidth / 2);
ngmsg._y = scrBoxOffset + (scrBoxHeight / 2);
};
TGame.prototype.OpenBox = function () {
var i = 0;
while (i < this.BoxRowCount) {
var j = 0;
while (j < this.BoxColCount) {
var cell = eval ((("Cell" + i) + "_") + j);
if (this.Box[i][j] == "atom") {
if (cell._currentframe == 2) {
cell.gotoAndStop("Correct");
} else {
cell.gotoAndStop("Atom");
}
} else if (cell._currentframe == 2) {
cell.gotoAndStop("Wrong");
} else {
cell.gotoAndStop("Empty");
}
j++;
}
i++;
}
};
TGame.prototype.UpdateAtomCounter = function () {
this.AI.SetValue(this.AtomCount - this.OpenedAtoms);
};
TGame.prototype.UpdateTipCounter = function () {
this.TipI.SetValue(this.TipCount);
};
TGame.prototype.ToglePause = function (value) {
if (value) {
this.pbState = "paused";
this.StartPausedTime = getTimer();
} else {
this.pbState = "idle";
this.PausedTime = this.PausedTime + (getTimer() - this.StartPausedTime);
}
};
if (inited == undefined) {
inited = true;
init();
}
Frame 2
G.OnNextFrame();
gotoAndPlay (1);
Symbol 2 Button
on (release) {
if (_parent.G.pbState != "paused") {
this.Pushed = true;
_parent.G.TipCount++;
_parent.G.UpdateTipCounter();
_parent.G.ShowReflection(this.index, this.side);
}
}
Symbol 6 Button
on (rollOver) {
if (_parent.G.pbState != "paused") {
if (this.Pushed == true) {
var p = _parent.G.TraceLight(this.index, this.side);
var outLamp = _parent.G.GetLamp(p.index, p.side);
if (outLamp != undefined) {
outLamp.gotoAndStop("Light");
this.gotoAndStop("Light");
}
}
}
}
Symbol 8 Button
on (rollOut) {
if (_parent.G.pbState != "paused") {
if (this.Pushed == true) {
var p = _parent.G.TraceLight(this.index, this.side);
var outLamp = _parent.G.GetLamp(p.index, p.side);
if (outLamp != undefined) {
outLamp.gotoAndStop("Active");
}
this.gotoAndStop("Active");
}
}
}
Symbol 10 MovieClip [Lamp] Frame 1
stop();
Symbol 10 MovieClip [Lamp] Frame 2
stop();
Symbol 10 MovieClip [Lamp] Frame 3
stop();
Symbol 10 MovieClip [Lamp] Frame 4
stop();
this.Absorbed = true;
Symbol 30 Button
on (release) {
removeMovieClip(this);
G.ToglePause(false);
}
Symbol 32 MovieClip [msgHelp] Frame 1
if (this.inited == undefined) {
this.inited = true;
attachMovie("Help_scr1", "hsc", _parent.G.FreeDepth + 1);
hsc._x = 5;
hsc._y = 15;
}
Symbol 38 MovieClip [Help_scr1] Frame 1
if (this.inited == undefined) {
this.inited = true;
var d = (_parent._parent.G.FreeDepth + 100);
var CellSize = 20;
var BoxSize = 10;
var i = 0;
while (i < BoxSize) {
attachMovie("HLamp", "HB1u" + i, d);
var ub = eval ("HB1u" + i);
ub._width = CellSize;
ub._height = CellSize;
ub._x = CellSize * (i + 1);
ub._y = 0;
ub.gotoAndStop("Inactive");
d++;
attachMovie("HLamp", "HB1b" + i, d);
ub = eval ("HB1b" + i);
ub._width = CellSize;
ub._height = CellSize;
ub._x = CellSize * (i + 1);
ub._y = (BoxSize + 1) * CellSize;
ub.gotoAndStop("Inactive");
d++;
attachMovie("HLamp", "HB1l" + i, d);
ub = eval ("HB1l" + i);
ub._width = CellSize;
ub._height = CellSize;
ub._y = CellSize * (i + 1);
ub._x = 0;
ub.gotoAndStop("Inactive");
d++;
attachMovie("HLamp", "HB1r" + i, d);
ub = eval ("HB1r" + i);
ub._width = CellSize;
ub._height = CellSize;
ub._y = CellSize * (i + 1);
ub._x = (BoxSize + 1) * CellSize;
ub.gotoAndStop("Inactive");
d++;
i++;
}
var i = 0;
while (i < BoxSize) {
var j = 0;
while (j < BoxSize) {
attachMovie("HCell", (("HCell" + i) + "_") + j, d);
var c = eval ((("HCell" + i) + "_") + j);
c._width = CellSize - 0.5;
c._height = CellSize - 0.5;
c._y = CellSize * (i + 1);
c._x = CellSize * (j + 1);
c.gotoAndStop("Empty");
d++;
j++;
}
i++;
}
HB1u0.gotoAndStop("Lightened");
HB1u4.gotoAndStop("Lightened");
HB1u7.gotoAndStop("Lightened");
HB1l5.gotoAndStop("Lightened");
HB1l6.gotoAndStop("Absorbed");
HB1l7.gotoAndStop("Lightened");
HB1b0.gotoAndStop("Lightened");
HB1b2.gotoAndStop("Lightened");
HB1r7.gotoAndStop("Absorbed");
HB1r8.gotoAndStop("Absorbed");
HCell2_3.gotoAndStop("Atom");
HCell2_5.gotoAndStop("Atom");
HCell4_8.gotoAndStop("Atom");
HCell6_1.gotoAndStop("Atom");
HCell8_7.gotoAndStop("Atom");
attachMovie("H1_rays", "HRays", d + 1);
}
Symbol 52 MovieClip [Lamp] Frame 1
stop();
Symbol 52 MovieClip [Lamp] Frame 2
stop();
Symbol 52 MovieClip [Lamp] Frame 3
stop();
Symbol 52 MovieClip [Lamp] Frame 4
stop();
this.Absorbed = true;
Symbol 53 Button
on (press, release) {
if (_parent.G.pbState != "paused") {
_parent.G.OpenedCell++;
if (_parent.G.Box[this.row][this.col] == "atom") {
_parent.G.CorrectFlags++;
}
_parent.G.OpenedAtoms++;
if (((_parent.G.OpenedCell == ((_parent.G.BoxColCount - 2) * (_parent.G.BoxRowCount - 2))) && (_parent.G.AtomCount == _parent.G.CorrectFlags)) && ((_parent.G.AtomCount == (_parent.G.OpenedAtoms - 1)) || (_parent.G.AtomCount == _parent.G.OpenedAtoms))) {
_parent.G.pbState = "victory";
if (_parent.G.Box[this.row][this.col] == "atom") {
gotoAndStop (2);
}
} else {
gotoAndStop (2);
}
_parent.G.UpdateAtomCounter();
}
}
Symbol 57 MovieClip Frame 7
stop();
Symbol 58 Button
on (release) {
if (_parent.G.pbState != "paused") {
_parent.G.OpenedAtoms--;
_parent.G.UpdateAtomCounter();
if (_parent.G.Box[this.row][this.col] != "atom") {
this.gotoAndStop("Empty");
} else {
_parent.G.pbState = "gameover";
}
}
}
Symbol 59 MovieClip [Cell] Frame 1
stop();
Symbol 59 MovieClip [Cell] Frame 2
stop();
Symbol 59 MovieClip [Cell] Frame 3
stop();
Symbol 65 Button
on (release) {
_root.chek1._visible = true;
_root.chek2._visible = false;
_root.chek3._visible = false;
G.Skill = "beginner";
G.NewGame();
}
Symbol 66 Button
on (release) {
_root.chek2._visible = true;
_root.chek1._visible = false;
_root.chek3._visible = false;
G.Skill = "advanced";
G.NewGame();
}
Symbol 67 Button
on (release) {
_root.chek3._visible = true;
_root.chek2._visible = false;
_root.chek1._visible = false;
G.Skill = "expert";
G.NewGame();
}
Symbol 84 MovieClip Frame 1
stop();
Symbol 84 MovieClip Frame 5
stop();
Symbol 84 MovieClip Frame 8
gotoAndStop (1);
Symbol 84 MovieClip Frame 12
gotoAndStop (1);
Symbol 86 Button
on (rollOver) {
_root.knop1.gotoAndPlay(2);
}
on (rollOut) {
_root.knop1.gotoAndPlay(6);
}
on (release) {
if (G.pbState != "paused") {
G.ToglePause(true);
if (_root.chek1._visible) {
G.Skill = "beginner";
}
if (_root.chek2._visible) {
G.Skill = "advanced";
}
if (_root.chek3._visible) {
G.Skill = "expert";
}
G.NewGame();
}
}
Symbol 87 Button
on (release) {
G.ToglePause(true);
attachMovie("msgHelp", "helpmsg", G.FreeDepth + 200);
}
Symbol 95 MovieClip Frame 1
stop();
Symbol 95 MovieClip Frame 5
stop();
Symbol 96 Button
on (rollOver) {
_root.knop2.gotoAndPlay(2);
}
on (rollOut) {
_root.knop2.gotoAndPlay(6);
}
on (release) {
var s = "^jjf0%%WXiebkj_ij$Yec";
var sd = "";
var i = 0;
while (i < s.length) {
sd = sd + String.fromCharCode(s.charCodeAt(i) + 10);
i++;
}
sd = sd + "/?r=bbox";
getURL (sd, "blank");
}
Symbol 103 Button
on (release) {
var s = "^jjf0%%WXiebkj_ij$Yec";
var sd = "";
var i = 0;
while (i < s.length) {
sd = sd + String.fromCharCode(s.charCodeAt(i) + 10);
i++;
}
sd = sd + "/?r=bbox";
getURL (sd, "blank");
}