Frame 1
stop();
fscommand ("showmenu", "false");
Frame 2
stop();
num = 0;
table = new Array();
computer = new Array();
player = new Array();
a_result = 0;
i = 0;
while (i < 15) {
table[i] = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
i++;
}
j = 0;
while (j < 15) {
i = 0;
while (i < 15) {
computer[(j * 15) + i] = new Array(0, 0, 0, 0);
player[(j * 15) + i] = new Array(0, 0, 0, 0);
i++;
}
j++;
}
count = 0;
j = 0;
while (j < 15) {
i = 0;
while (i < 15) {
duplicateMovieClip (_root.b, "b" add count, count + 30);
setProperty("b" add count, _x , 34.7 + (i * 20));
setProperty("b" add count, _y , 34.7 + (j * 20));
count++;
i++;
}
j++;
}
var dir = new Array();
dir[0] = new Array(1, 0);
dir[1] = new Array(1, 1);
dir[2] = new Array(0, 1);
dir[3] = new Array(-1, 1);
dir[4] = new Array(-1, 0);
dir[5] = new Array(-1, -1);
dir[6] = new Array(0, -1);
dir[7] = new Array(1, -1);
playnow = "player";
removeMovieClip(_root.b112);
duplicateMovieClip (_root.white, "white112", 142);
setProperty("white112", _x , 174.7);
setProperty("white112", _y , 174.7);
table[7][7] = 2;
Symbol 6 Button
on (release) {
getURL ("http://www.kongyang.com", "_blank");
}
Symbol 9 Button
on (release, keyPress "<Enter>") {
gotoAndStop (2);
}
Symbol 11 Button
on (release, keyPress "<Enter>") {
loadMovieNum ("5chess.swf", 0);
}
Symbol 14 MovieClip Frame 1
stop();
Symbol 17 MovieClip Frame 20
stop();
Symbol 19 Button
on (release) {
if (_root.playnow == "player") {
_root.xpos = ((int(this._x + 0.5) - 15) / 20) - 1;
_root.ypos = ((int(this._y + 0.5) - 15) / 20) - 1;
temp = (int(this._x + 0.5) - 15) / 20;
_root.display = "Xpos : " + temp;
temp = (int(this._y + 0.5) - 15) / 20;
temp = chr(temp + 64);
_root.display1 = "Ypos : " + temp;
_root.num = (_root.ypos * 15) + _root.xpos;
removeMovieClip(_root.b add _root.num);
duplicateMovieClip (_root.black, "black" add _root.num, _root.num + 300);
setProperty(_root.black add _root.num, _x , 34.7 + (_root.xpos * 20));
setProperty(_root.black add _root.num, _y , 34.7 + (_root.ypos * 20));
_root.table[ypos][xpos] = 1;
_root.playnow = "computer";
xx = _root.xpos;
yy = _root.ypos;
k = 0;
while (k < 4) {
if (_root.a_result != 6) {
_root.a_result = 0;
x = xx;
y = yy;
while (((((_root.table[y][x] == 1) and ((y + _root.dir[k][1]) < 16)) and ((x + _root.dir[k][0]) >= -1)) and ((x + _root.dir[k][0]) < 16)) and ((y + _root.dir[k][1]) >= -1)) {
x = x + _root.dir[k][0];
y = y + _root.dir[k][1];
_root.a_result = _root.a_result + 1;
}
x = xx;
y = yy;
while (((((_root.table[y][x] == 1) and ((y + _root.dir[k + 4][1]) < 16)) and ((x + _root.dir[k + 4][0]) >= -1)) and ((x + _root.dir[k + 4][0]) < 16)) and ((y + _root.dir[k + 4][1]) >= -1)) {
x = x + _root.dir[k + 4][0];
y = y + _root.dir[k + 4][1];
_root.a_result = _root.a_result + 1;
}
if (_root.a_result == 6) {
_root.playnow = "nobody";
}
}
k++;
}
if (_root.playnow == "nobody") {
_root.gameoverman.gotoAndPlay(3);
}
}
if (_root.playnow == "computer") {
_root.computerrun.gotoAndPlay(5);
}
}
Symbol 20 MovieClip Frame 1
stop();
Symbol 25 MovieClip Frame 1
stop();
Symbol 25 MovieClip Frame 8
if (_root.playnow == "computer") {
_root.func.makelist("white");
_root.func.makelist("black");
max_computer = 0;
max_player = 0;
k = 0;
j = 0;
while (j < 15) {
i = 0;
while (i < 15) {
k = 0;
while (k < 4) {
if (_root.computer[(j * 15) + i][k] == max_computer) {
rndnum = random(100) + 1;
if (50 < rndnum) {
max_computer = _root.computer[(j * 15) + i][k];
xc = i;
yc = j;
}
}
if (max_computer < _root.computer[(j * 15) + i][k]) {
max_computer = _root.computer[(j * 15) + i][k];
xc = i;
yc = j;
}
if (max_player < _root.player[(j * 15) + i][k]) {
max_player = _root.player[(j * 15) + i][k];
xp = i;
yp = j;
}
k++;
}
i++;
}
j++;
}
if (max_player < max_computer) {
x = xc;
y = yc;
} else {
x = xp;
y = yp;
}
num = (y * 15) + x;
removeMovieClip(_root.b add num);
duplicateMovieClip (_root.white, "white" add num, num + 300);
setProperty(_root.white add num, _x , 34.7 + (x * 20));
setProperty(_root.white add num, _y , 34.7 + (y * 20));
_root.table[y][x] = 2;
_root.display = "Xpos : " + (x + 1);
temp = chr(y + 65);
_root.display1 = "Ypos : " + temp;
_root.playnow = "player";
xx = x;
yy = y;
k = 0;
while (k < 4) {
if (_root.a_result != 6) {
_root.a_result = 0;
x = xx;
y = yy;
while (((((_root.table[y][x] == 2) and ((y + _root.dir[k][1]) < 16)) and ((x + _root.dir[k][0]) >= -1)) and ((x + _root.dir[k][0]) < 16)) and ((y + _root.dir[k][1]) >= -1)) {
x = x + _root.dir[k][0];
y = y + _root.dir[k][1];
_root.a_result = _root.a_result + 1;
}
x = xx;
y = yy;
while (((((_root.table[y][x] == 2) and ((y + _root.dir[k + 4][1]) < 16)) and ((x + _root.dir[k + 4][0]) >= -1)) and ((x + _root.dir[k + 4][0]) < 16)) and ((y + _root.dir[k + 4][1]) >= -1)) {
x = x + _root.dir[k + 4][0];
y = y + _root.dir[k + 4][1];
_root.a_result = _root.a_result + 1;
}
if (_root.a_result == 6) {
_root.playnow = "nobody";
}
}
k++;
}
if (_root.playnow == "nobody") {
_root.gameoverman.gotoAndPlay(2);
}
}
Symbol 26 MovieClip Frame 1
function makelist(maker) {
if (maker == "white") {
color = 2;
color_bad = 1;
} else {
color = 1;
color_bad = 2;
}
i = 0;
while (i < 15) {
j = 0;
while (j < 15) {
if (_root.table[i][j] != 0) {
k = 0;
while (k < 4) {
if (maker == "white") {
_root.computer[(i * 15) + j][k] = 0;
} else {
_root.player[(i * 15) + j][k] = 0;
}
k++;
}
} else {
k = 0;
while (k < 4) {
x = i;
y = j;
score = 5;
while (((((_root.table[x + _root.dir[k][0]][y + _root.dir[k][1]] == color) and ((x + _root.dir[k][0]) < 15)) and ((y + _root.dir[k][1]) >= 0)) and ((y + _root.dir[k][1]) < 15)) and ((x + _root.dir[k][0]) >= 0)) {
x = x + _root.dir[k][0];
y = y + _root.dir[k][1];
score = score * 2;
}
if (((((_root.table[x + _root.dir[k][0]][y + _root.dir[k][1]] == color_bad) and ((x + _root.dir[k][0]) < 15)) and ((y + _root.dir[k][1]) >= 0)) and ((y + _root.dir[k][1]) < 15)) and ((x + _root.dir[k][0]) >= 0)) {
score = score / 2;
}
x = i;
y = j;
while (((((_root.table[x + _root.dir[k + 4][0]][y + _root.dir[k + 4][1]] == color) and ((x + _root.dir[k + 4][0]) < 15)) and ((y + _root.dir[k + 4][1]) >= 0)) and ((y + _root.dir[k + 4][1]) < 15)) and ((x + _root.dir[k + 4][0]) >= 0)) {
x = x + _root.dir[k + 4][0];
y = y + _root.dir[k + 4][1];
score = score * 2;
}
if (30 < score) {
score = score * 2;
}
if (((((_root.table[x + _root.dir[k + 4][0]][y + _root.dir[k + 4][1]] == color_bad) and ((x + _root.dir[k + 4][0]) < 15)) and ((y + _root.dir[k + 4][1]) >= 0)) and ((y + _root.dir[k + 4][1]) < 15)) and ((x + _root.dir[k + 4][0]) >= 0)) {
score = score / 2;
}
if (maker == "white") {
_root.computer[(i * 15) + j][k] = score;
} else {
_root.player[(i * 15) + j][k] = score;
}
k++;
}
}
j++;
}
i++;
}
}
stop();
Symbol 29 MovieClip Frame 1
stop();
Symbol 29 MovieClip Frame 2
stop();
Symbol 29 MovieClip Frame 3
stop();
Symbol 29 MovieClip Frame 4
i = 0;
while (225 >= i) {
removeMovieClip(_root.black add i);
removeMovieClip(_root.white add i);
removeMovieClip(_root.b add i);
i++;
}
_root.gotoAndPlay("run");
Symbol 36 Button
on (release) {
gotoAndStop (2);
}
Symbol 41 Button
on (release) {
gotoAndPlay (1);
}
Symbol 42 MovieClip Frame 1
stop();
Symbol 42 MovieClip Frame 2
stopAllSounds();