Frame 1
tellTarget ("_level0") {
lbLoadingGame = "";
};
Frame 3
if (_framesloaded >= _totalframes) {
gotoAndPlay (4);
} else {
gotoAndPlay (2);
}
Frame 4
function NewGame() {
wndSaveScore._visible = false;
stScore = "0";
var n = 0;
while (n < (NumX * NumY)) {
if (Board[n]) {
removeMovieClip(Selected[i]);
}
n++;
}
var n = 0;
Colors = [0, 0, 0, 0, 0, 0];
var j = 0;
while (j < NumY) {
var i = 0;
while (i < NumX) {
var color = (1 + random(5));
var name = ("Cube_" + n);
Colors[color]++;
attachMovie("Cube" + color, name, n);
var c = eval (name);
Board[n] = c;
c._width = (c._height = Size);
c._x = i * c._width;
c._y = j * c._height;
c.color = color;
c.was = false;
n++;
i++;
}
j++;
}
num1 = Colors[1];
num2 = Colors[2];
num3 = Colors[3];
num4 = Colors[4];
num5 = Colors[5];
}
function Select(x, y) {
var c = Board[x + (y * NumX)];
if ((PrevX == x) and (PrevY == y)) {
return(undefined);
}
var i = 0;
while (i < Selected.length) {
Selected[i].gotoAndStop(1);
Selected[i].was = false;
i++;
}
Selected = [];
if (!c) {
stNumSelect = "";
PrevX = x;
PrevY = y;
return(0);
}
var num = Paint(x, y, c.color);
if (1 < num) {
stNumSelect = Fib[num];
} else {
stNumSelect = "";
var i = 0;
while (i < Selected.length) {
Selected[i].gotoAndStop(1);
Selected[i].was = false;
i++;
}
Selected = [];
}
PrevX = x;
PrevY = y;
}
function Paint(x, y, color) {
if ((x < 0) or (x >= NumX)) {
return(0);
}
if ((y < 0) or (y >= NumY)) {
return(0);
}
var c = Board[x + (y * NumX)];
if (!c) {
return(0);
}
if (c.color != color) {
return(0);
}
if (c.was) {
return(0);
}
c.gotoAndStop(2);
c.was = true;
Selected.push(c);
var n = 1;
n = n + Paint(x + 1, y, color);
n = n + Paint(x, y + 1, color);
n = n + Paint(x - 1, y, color);
n = n + Paint(x, y - 1, color);
return(n);
}
function UnvisiblePaint(x, y, color) {
if ((x < 0) or (x >= NumX)) {
return(0);
}
if ((y < 0) or (y >= NumY)) {
return(0);
}
var c = Board[x + (y * NumX)];
if (!c) {
return(0);
}
if (c.color != color) {
return(0);
}
if (c.was) {
return(0);
}
c.was = true;
Selected.push(c);
var n = 1;
n = n + UnvisiblePaint(x + 1, y, color);
n = n + UnvisiblePaint(x, y + 1, color);
n = n + UnvisiblePaint(x - 1, y, color);
n = n + UnvisiblePaint(x, y - 1, color);
return(n);
}
function Delete() {
if (Selected.length < 2) {
return(0);
}
var color = Selected[0].color;
if (color == 1) {
num1 = Number(num1) - Selected.length;
} else if (color == 2) {
num2 = Number(num2) - Selected.length;
} else if (color == 3) {
num3 = Number(num3) - Selected.length;
} else if (color == 4) {
num2 = Number(num4) - Selected.length;
} else if (color == 5) {
num2 = Number(num5) - Selected.length;
}
stScore = Number(stScore) + Fib[Selected.length];
var i = 0;
while (i < Selected.length) {
var x = int((Selected[i]._x + 1) / Size);
var y = int((Selected[i]._y + 1) / Size);
var n = (x + (y * NumX));
removeMovieClip(Selected[i]);
Board[n] = "";
var j = (y - 1);
while (j >= 0) {
Board[n] = Board[n - NumX];
if (!Board[n]) {
break;
}
Board[n]._y = (j + 1) * Size;
n = n - NumX;
Board[n] = "";
j--;
}
i++;
}
Selected = [];
var n = ((NumY * NumX) - 1);
var i = (NumX - 1);
while (i >= 0) {
if (!Board[n]) {
Compress(i);
}
n--;
i--;
}
if (EndGame()) {
wndSaveScore._visible = true;
return(undefined);
}
var i = 0;
while (i < Selected.length) {
Selected[i].was = false;
i++;
}
Selected = [];
PrevX = (PrevY = -1);
return(k + 1);
}
function Compress(x) {
var i = (x + 1);
while (i < NumX) {
var n2 = (i + ((NumY - 1) * NumX));
var newX = ((i - 1) * Size);
var j = (NumY - 1);
while (j >= 0) {
n1 = n2 - 1;
if (!Board[n2]) {
Board[n1] = "";
if (j == (NumY - 1)) {
return(undefined);
}
break;
}
Board[n1] = Board[n2];
Board[n1]._x = newX;
Board[n2] = "";
n2 = n2 - NumX;
j--;
}
i++;
}
}
function EndGame() {
var y = (NumY - 1);
while (y >= 0) {
var n = (y * NumX);
var sum = 0;
var x = 0;
while (x < NumX) {
if (!Board[n]) {
sum++;
n++;
} else {
if (1 < UnvisiblePaint(x, y, Board[n].color)) {
return(false);
}
n++;
}
x++;
}
if (sum == NumX) {
return(true);
}
y--;
}
return(true);
}
function Crypto(st) {
var sum1 = 0;
var sum2 = 0;
var i = 0;
while (i < st.length) {
sum1 = sum1 + st.charCodeAt(i);
sum2 = sum2 + (st.charCodeAt(i) ^ 175);
i++;
}
sum1 = sum1 % 256;
sum2 = sum2 % 256;
st = (String.fromCharCode(sum1) + String.fromCharCode(sum2)) + st;
var cryptSt = "";
var b0 = 193;
var i = 0;
while (i < st.length) {
var b = st.charCodeAt(i);
var CryptB = (b ^ b0);
CryptB = CryptB.toString();
var len = CryptB.length;
var j = 0;
while (j < (3 - len)) {
CryptB = "0" + CryptB;
j++;
}
cryptSt = cryptSt + CryptB;
b0 = b;
i++;
}
return(cryptSt);
}
if (init) {
return(undefined);
}
init = true;
fscommand ("allowscale", true);
fscommand ("showmenu", false);
Width = 375;
Height = 375;
Size = 25;
NumX = int(Width / Size);
NumY = int(Height / Size);
PrevColor = 0;
Board = new Array(NumX * NumY);
Selected = new Array();
Colors = new Array(6);
Fib = new Array(70);
Fib[0] = (Fib[1] = 1);
var n = 2;
while (n < 70) {
Fib[n] = int(((n * n) * n) / 3);
n++;
}
NewGame();
Frame 6
if (((Width < _xmouse) or (_xmouse < 0)) or ((Height < _ymouse) or (_ymouse < 0))) {
var i = 0;
while (i < Selected.length) {
Selected[i].gotoAndPlay(1);
Selected[i].was = false;
PrevX = (PrevY = -1);
i++;
}
Selected = [];
gotoAndPlay (5);
return(undefined);
}
var x = int(_xmouse / Size);
var y = int(_ymouse / Size);
Select(x, y);
gotoAndPlay (5);
Symbol 3 MovieClip [Cube5] Frame 1
stop();
Symbol 3 MovieClip [Cube5] Frame 2
stop();
Symbol 6 MovieClip [Cube4] Frame 1
stop();
Symbol 6 MovieClip [Cube4] Frame 2
stop();
Symbol 9 MovieClip [Cube3] Frame 1
stop();
Symbol 9 MovieClip [Cube3] Frame 2
stop();
Symbol 12 MovieClip [Cube2] Frame 1
stop();
Symbol 12 MovieClip [Cube2] Frame 2
stop();
Symbol 15 MovieClip [Cube1] Frame 1
stop();
Symbol 15 MovieClip [Cube1] Frame 2
stop();
Symbol 16 MovieClip [Cube5] Frame 1
stop();
Symbol 16 MovieClip [Cube5] Frame 2
stop();
Symbol 17 MovieClip [Cube4] Frame 1
stop();
Symbol 17 MovieClip [Cube4] Frame 2
stop();
Symbol 18 MovieClip [Cube3] Frame 1
stop();
Symbol 18 MovieClip [Cube3] Frame 2
stop();
Symbol 19 MovieClip [Cube2] Frame 1
stop();
Symbol 19 MovieClip [Cube2] Frame 2
stop();
Symbol 20 MovieClip [Cube1] Frame 1
stop();
Symbol 20 MovieClip [Cube1] Frame 2
stop();
Symbol 26 Button
on (release) {
var x = int(_xmouse / Size);
var y = int(_ymouse / Size);
if ((x < 0) or (x >= NumX)) {
return(0);
}
if ((y < 0) or (y >= NumY)) {
return(0);
}
if (Board[x + (y * NumX)]) {
Delete();
}
}
Symbol 52 Button
on (release) {
NewGame();
}
Symbol 57 Button
on (release) {
var stSend = ((((((((_parent.stScore + "\t") + 1) + "\t") + stName) + "\t") + "sqr") + "\t") + "out");
getURL ("http://absolutist.com/cgi-bin/gameres.pl?e=" + _parent.Crypto(stSend), "_top");
trace((stName + " = ") + _parent.stScore);
_visible = false;
_parent.NewGame();
}
Symbol 58 Button
on (release) {
_visible = false;
_parent.NewGame();
}
Symbol 62 Button
on (release) {
getURL ("http://absolutist.com/games.html", "_blank");
}