Frame 2
DifficultyDrop.SetItems(DifficultyArr);
DifficultyDrop.SelectNo(1);
WhtDrop.SetItems(PlayerArr);
WhtDrop.SelectNo(1);
BlkDrop.SetItems(PlayerArr);
BlkDrop.SelectNo(0);
NewGame();
Frame 3
stop();
stop();
Symbol 3 MovieClip Frame 1
if (!hasOwnProperty("_load0242F440")) {
_load0242F440 = true;
tellTarget ("..") {
function Init() {
tellTarget (getProperty("..", _target)) {
PieceFunctions();
PieceArr = new Array();
SquaresArr = new Array();
Board = new Array();
EnPassant = new Array();
EnPassant.W = new Array();
EnPassant.B = new Array();
BorderT = 80;
BorderL = 80;
BoxW = 40;
BoardSize = 8;
Alphabet = ["a", "b", "c", "d", "e", "f", "g", "h"];
PieceVals = {K:1000, Q:900, B:325, N:310, R:500, P:100};
DrawBoard();
TimingQ = false;
TimeLimit = 3;
TimesUpQ = false;
if (!TimingQ) {
CircleTimerBG._visible = false;
}
ClrArr = ["W", "B"];
whosFirst = "W";
WhtScore = 0;
BlkScore = 0;
GameOverQ = false;
UserTurnQ = true;
CaptureCount = 0;
DoLang();
Success.swapDepths(10200);
}
}
}
} else {
// unexpected jump
}
function DoLang() {
tellTarget (getProperty("..", _target)) {
Lang = "en";
if (Lang != "en") {
if (Lang != "es") {
// unexpected jump
LangNo = 0;
DifficultyArr = ["Beginner", "Easy", "Medium"];
PlayerArr = ["Computer", "Human"];
LangTurnStt = "";
LangTurnEnd = "'s Turn";
LangWon = " Wins !";
LangDraw = "It's a Draw!";
LangWellDone = "Well Done!";
LangStillInCheck = "Still in Check ... try another move";
// unexpected jump
}
} else {
LangNo = 0;
DifficultyArr = ["Beginner", "Easy", "Medium"];
PlayerArr = ["Computer", "Human"];
LangTurnStt = "";
LangTurnEnd = "'s Turn";
LangWon = " Wins !";
LangDraw = "It's a Draw!";
LangWellDone = "Well Done!";
LangStillInCheck = "Still in Check ... try another move";
// unexpected jump
LangNo = 1;
DifficultyArr = ["principiante", "f\u00E1cil", "medio"];
PlayerArr = ["ordenador", "humano"];
LangNewGame = "Nuevo juego";
LangNewMatch = "Nuevo campeonato";
LangTurnStt = "Es el turno de ";
LangTurnEnd = "";
LangWon = " ha ganado";
LangDraw = "es un empate";
LangWellDone = "\u00A1Bien hecho!";
LangFull = "Aqu\u00ED no, est\u00E1 lleno";
LangStillInCheck = "Todav\u00EDa en Jaque ... otro movimiento";
StatusText.text = "Nuevo juego";
DifficultyText.text = "Dificultad";
WhtPlayerText.text = "Blanco";
BlkPlayerText.text = "Negro";
}
ComputerNo = 0;
}
}
// unexpected jump
// unexpected jump
function NewGame() {
tellTarget (getProperty("..", _target)) {
moves = 0;
ClearBoard();
ClearAttackArray();
ClearPieces();
SetUpPieces();
MoveNo.text = 1;
History1Text.text = "";
History2Text.text = "";
GameOverQ = false;
UserTurnQ = true;
CurrClr = whosFirst;
if (!((CurrClr == "W") ? (WhtDrop.GetItemNo() != ComputerNo) : true)) {
UserTurnQ = false;
Comp.gotoAndPlay(2);
}
}
}
// unexpected jump
// unexpected jump
function ClearBoard() {
tellTarget (getProperty("..", _target)) {
Board = new Array();
var row = 0;
for ( ; row < 8 ; row++) {
Board[row] = Array();
var col = 0;
for ( ; col < 8 ; col++) {
Board[row][col] = null;
}
}
}
}
// unexpected jump
// unexpected jump
function ClearAttackArray() {
tellTarget (getProperty("..", _target)) {
AttackArr = new Array();
var row = 0;
for ( ; row < 8 ; row++) {
AttackArr[row] = Array();
var col = 0;
for ( ; col < 8 ; col++) {
AttackArr[row][col] = new Array();
}
}
}
}
// unexpected jump
// unexpected jump
function ClearPieces() {
tellTarget (getProperty("..", _target)) {
delete _global.__resolve;
var varname;
_global.__resolve = _global.__debugResolve;
for (varname in PieceArr) {
var Piece = PieceArr[varname];
Piece.removeMovieClip();
}
PieceArr = new Array();
}
}
// unexpected jump
// unexpected jump
function NewTurn() {
tellTarget (getProperty("..", _target)) {
UserTurnQ = false;
if (TimingQ) {
CircleTimer.ResetMe();
}
if (InCheckmate(OtherClr(CurrClr))) {
if (CurrClr == "W") {
StatusText.text = (((WhtPlayerText.text + " (") + WhtDrop.GetItem()) + ")") + LangWon;
WhtScore = WhtScore + 1;
if (WhtDrop.GetItemNo() != ComputerNo) {
Success.Go();
}
} else {
StatusText.text = (((BlkPlayerText.text + " (") + BlkDrop.GetItem()) + ")") + LangWon;
BlkScore = BlkScore + 1;
if (BlkDrop.GetItemNo() != ComputerNo) {
Success.Go();
}
}
GameOverQ = true;
} else if (InStalemate()) {
StatusText.text = LangDraw;
GameOverQ = true;
} else {
NewTurnGo();
}
}
}
// unexpected jump
// unexpected jump
function NewTurnGo() {
tellTarget (getProperty("..", _target)) {
CurrClr = OtherClr(CurrClr);
if (CurrClr == "W") {
MoveNo.text = (int(MoveNo.text)+1);
}
if (CurrClr == "W") {
StatusText.text = ((((LangTurnStt + WhtPlayerText.text) + " (") + WhtDrop.GetItem()) + ")") + LangTurnEnd;
} else {
StatusText.text = ((((LangTurnStt + BlkPlayerText.text) + " (") + BlkDrop.GetItem()) + ")") + LangTurnEnd;
}
UserTurnQ = true;
if (!((CurrClr == "W") ? (WhtDrop.GetItemNo() != ComputerNo) : true)) {
UserTurnQ = false;
Comp.gotoAndPlay(2);
}
if (!((CurrClr == "B") ? (BlkDrop.GetItemNo() != ComputerNo) : true)) {
UserTurnQ = false;
Comp.gotoAndPlay(2);
}
_root.ShowThreats();
if (UserTurnQ) {
if (TimingQ) {
var TimerClr = 255;
if (CurrClr == "W") {
TimerClr = 16711680 /* 0xFF0000 */;
}
CircleTimer.StartMe(TimeLimit, TimerClr);
TimesUpQ = false;
}
}
}
}
// unexpected jump
// unexpected jump
function ComputersTurn() {
tellTarget (getProperty("..", _target)) {
if (int(MoveNo.text) > 100) {
return(undefined);
}
Clr = CurrClr;
_root.Debug = "";
_root.Debug = _root.Debug + ("\nComputersTurn Clr=" + Clr);
_root.HereClip.Here("Start");
Move = AlphaBeta.GetBestMove(Clr);
_root.HereClip.Here("End");
FromPiece = Move[4];
if (FromPiece != null) {
FromPiece.PieceFinishMove(Move[2], Move[3]);
History(Move);
NewTurn();
}
return(undefined);
}
}
// unexpected jump
// unexpected jump
function TimesUp() {
tellTarget (getProperty("..", _target)) {
TimesUpQ = true;
}
}
// unexpected jump
// unexpected jump
function DrawBoard() {
tellTarget (getProperty("..", _target)) {
depth = 100;
Board = Array();
row = 0;
for ( ; row < BoardSize ; row++) {
Board[row] = Array();
SquaresArr[row] = new Array();
col = 0;
for ( ; col < BoardSize ; col++) {
if (((row + col) / 2) == Math.floor((row + col) / 2)) {
obj = BlkSquare.duplicateMovieClip((("S_" + row) + "_") + col, depth);
} else {
obj = WhtSquare.duplicateMovieClip((("S_" + row) + "_") + col, depth);
}
depth++;
obj._x = BoxLeft(col);
obj._y = BoxTop(row);
SquaresArr[row][col] = obj;
Board[row][col] = null;
}
}
row = 0;
for ( ; row < BoardSize ; row++) {
obj = RowColText.duplicateMovieClip("R_" + row, depth);
depth++;
obj.text = row + 1;
obj._x = BoxLeft(0) - 20;
obj._y = BoxTop(row) + 7;
}
col = 0;
for ( ; col < BoardSize ; col++) {
obj = RowColText.duplicateMovieClip("C_" + col, depth);
depth++;
obj.text = Alphabet[col];
obj._x = BoxLeft(col) + 10;
obj._y = BoxTop(0) + 40;
}
}
}
// unexpected jump
// unexpected jump
function SetUpPieces() {
tellTarget (getProperty("..", _target)) {
SetUpPiece("BR", "BR0", 10001, 7, 0);
SetUpPiece("BN", "BN0", 10002, 7, 1);
SetUpPiece("BB", "BB0", 10003, 7, 2);
SetUpPiece("BQ", "BQ0", 10004, 7, 3);
SetUpPiece("BK", "BK0", 10005, 7, 4);
SetUpPiece("BB", "BB1", 10006, 7, 5);
SetUpPiece("BN", "BN1", 10007, 7, 6);
SetUpPiece("BR", "BR1", 10008, 7, 7);
var i = 0;
for ( ; i < 8 ; i++) {
SetUpPiece("BP", "BP" + i, 10009 + i, 6, i);
SetUpPiece("WP", "WP" + i, 10017 + i, 1, i);
}
SetUpPiece("WR", "WR0", 10025, 0, 0);
SetUpPiece("WN", "WN0", 10026, 0, 1);
SetUpPiece("WB", "WB0", 10027, 0, 2);
SetUpPiece("WQ", "WQ0", 10028, 0, 3);
SetUpPiece("WK", "WK0", 10029, 0, 4);
SetUpPiece("WB", "WB1", 10030, 0, 5);
SetUpPiece("WN", "WN1", 10031, 0, 6);
SetUpPiece("WR", "WR1", 10032, 0, 7);
SetUpPiece("WQ", "WQ1", 10033, 0, -4);
SetUpPiece("BQ", "BQ1", 10034, 0, -4);
}
}
// unexpected jump
// unexpected jump
function SetUpPiece(BaseSpriteName, PieceName, newdepth, row, col) {
tellTarget (getProperty("..", _target)) {
BaseSprite = eval (BaseSpriteName);
obj = BaseSprite.duplicateMovieClip(PieceName, newdepth);
PieceArr[PieceName] = obj;
obj.row = row;
obj.col = col;
obj.PieceGo(row, col);
return(obj);
}
}
// unexpected jump
// unexpected jump
function BoxTop(RowNo) {
tellTarget (getProperty("..", _target)) {
return(BorderT + ((BoxW * (7 - RowNo)) + 0));
}
}
// unexpected jump
// unexpected jump
function BoxLeft(ColNo) {
tellTarget (getProperty("..", _target)) {
return(BorderL + ((BoxW * ColNo) + 0));
}
}
// unexpected jump
// unexpected jump
function PieceFunctions() {
tellTarget (getProperty("..", _target)) {
MovieClip.prototype.PieceLoad = function () {
this.Clr = this._name.charAt(0);
this.PieceType = this._name.charAt(1);
this.PieceVal = _root.PieceVals[this.PieceType];
this.isDragging = false;
this.DidCaptureQ = false;
this.DidCastleQ = false;
this.MovedQ = false;
};
MovieClip.prototype.SelfPress = function () {
if (this.col < 0) {
return(undefined);
}
var Moves = new Array();
this.PushMoves(Moves);
var i = 0;
for ( ; i < Moves.length ; i++) {
Move = Moves[i];
_root.SquaresArr[Move[2]][Move[3]].FlashMe();
}
if (this.Clr == _root.CurrClr) {
this.isDragging = true;
this.swapDepths(10100);
this.startDrag(false);
}
};
MovieClip.prototype.MarkAttacks = function () {
this.PieceType;
if (this.PieceType != "P") {
if (this.PieceType != "R") {
if (this.PieceType != "B") {
if (this.PieceType != "N") {
if (this.PieceType != "Q") {
if (this.PieceType != "K") {
return;
var ClrDir = ((this.Clr == "W") ? 1 : -1);
_root.AttackArr[this.row + ClrDir][this.col - 1][this.Clr]++;
_root.AttackArr[this.row + ClrDir][this.col + 1][this.Clr]++;
return;
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row, this.col - i));
return;
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col - i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col - i));
return;
this.MarkAttack(this.row + 1, this.col + 2);
this.MarkAttack(this.row + 1, this.col - 2);
this.MarkAttack(this.row + 2, this.col + 1);
this.MarkAttack(this.row + 2, this.col - 1);
this.MarkAttack(this.row - 1, this.col + 2);
this.MarkAttack(this.row - 1, this.col - 2);
this.MarkAttack(this.row - 2, this.col + 1);
this.MarkAttack(this.row - 2, this.col - 1);
return;
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row, this.col - i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col - i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col - i));
return;
}
}
}
}
}
} else {
var ClrDir = ((this.Clr == "W") ? 1 : -1);
_root.AttackArr[this.row + ClrDir][this.col - 1][this.Clr]++;
_root.AttackArr[this.row + ClrDir][this.col + 1][this.Clr]++;
return;
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row, this.col - i));
return;
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col - i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col - i));
return;
this.MarkAttack(this.row + 1, this.col + 2);
this.MarkAttack(this.row + 1, this.col - 2);
this.MarkAttack(this.row + 2, this.col + 1);
this.MarkAttack(this.row + 2, this.col - 1);
this.MarkAttack(this.row - 1, this.col + 2);
this.MarkAttack(this.row - 1, this.col - 2);
this.MarkAttack(this.row - 2, this.col + 1);
this.MarkAttack(this.row - 2, this.col - 1);
return;
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row, this.col - i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row + i, this.col - i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.MarkAttack(this.row - i, this.col - i));
return;
this.MarkAttack(this.row + 1, this.col);
this.MarkAttack(this.row + 1, this.col + 1);
this.MarkAttack(this.row, this.col + 1);
this.MarkAttack(this.row - 1, this.col + 1);
this.MarkAttack(this.row - 1, this.col);
this.MarkAttack(this.row - 1, this.col - 1);
this.MarkAttack(this.row, this.col - 1);
this.MarkAttack(this.row + 1, this.col - 1);
}
};
MovieClip.prototype.MarkAttack = function (NewRow, NewCol) {
if (!((NewRow >= 0) ? (NewRow <= 7) : false)) {
return(false);
}
if (!((NewCol >= 0) ? (NewCol <= 7) : false)) {
return(false);
}
var ClrNum = ((this.Clr == "W") ? 0 : 1);
_root.AttackArr[NewRow][NewCol][ClrNum]++;
_root.AttackArr[NewRow][NewCol][ClrNum + 2] = _root.AttackArr[NewRow][NewCol][ClrNum + 2] + this.PieceVal;
return(_root.Board[NewRow][NewCol] == null);
};
MovieClip.prototype.SelfRelease = function () {
this.stopDrag();
this.isDragging = false;
var WasRow = this.row;
var WasCol = this.col;
var TestCol = Math.floor(((this._x - _root.BorderL) + (_root.BoxW / 2)) / _root.BoxW);
var TestRow = (7 - Math.floor(((this._y - _root.BorderT) + (_root.BoxW / 2)) / _root.BoxW));
var GoodMoveQ = true;
if (!((TestRow >= 0) ? (((TestRow < 8) ? (((TestCol >= 0) ? (TestCol >= 8) : true)) : true)) : true)) {
if (!this.PieceMove(TestRow, TestCol)) {
this.PieceGo(WasRow, WasCol);
GoodMoveQ = false;
}
} else {
this.PieceGo(WasRow, WasCol);
GoodMoveQ = false;
}
if (GoodMoveQ) {
this.MovedQ = true;
_root.History([WasRow, WasCol, TestRow, TestCol, this]);
_root.NewTurn();
}
};
MovieClip.prototype.PieceGo = function (NewRow, NewCol) {
if (this.col >= 0) {
_root.Board[this.row][this.col] = null;
}
var WasRow = this.row;
var WasCol = this.col;
this.row = NewRow;
this.col = NewCol;
this._x = _root.BoxLeft(this.col) + 3;
this._y = _root.BoxTop(this.row) + 5;
if (this.col >= 0) {
_root.Board[this.row][this.col] = this;
}
return([WasRow, WasCol, NewRow, NewCol, this, this.MovedQ, this.CastledQ]);
};
MovieClip.prototype.PieceMove = function (NewRow, NewCol) {
if (this.PieceCanMove(NewRow, NewCol)) {
return(this.PieceFinishMove(NewRow, NewCol).length > 0);
}
};
MovieClip.prototype.PieceFinishMove = function (NewRow, NewCol) {
var MovedArr = new Array();
var WasRow = this.row;
var WasCol = this.col;
var p = _root.Board[NewRow][NewCol];
if (p.Clr == this.Clr) {
return(MovedArr);
}
if (p.PieceType == "K") {
return(MovedArr);
}
if (p == null) {
this.DidCaptureQ = false;
} else {
MovedArr.push(p.Capture(true));
this.DidCaptureQ = true;
}
_root.EnPassant[this.Clr] = null;
if (this.PieceType == "P") {
var EP = _root.EnPassant[_root.OtherClr(this.Clr)];
if (EP != null) {
if (!((NewRow == EP[1]) ? (NewCol != EP[2]) : true)) {
var CapturePiece = _root.EnPassant[0];
MovedArr.push(EP[0].Capture(true));
this.DidCaptureQ = true;
}
}
if (Math.abs(NewRow - WasRow) == 2) {
_root.EnPassant[this.Clr] = [this, WasRow + ((NewRow - WasRow) / 2), WasCol];
}
}
this.DidCastleQ = false;
if (this.PieceType == "K") {
if (Math.abs(NewCol - WasCol) == 2) {
_root.Debug = _root.Debug + ((((",Castling(" + NewRow) + ",") + NewCol) + ")");
var RookName = (this.Clr + (((NewCol - WasCol) < 0) ? "R0" : "R1"));
var RookPiece = _root.PieceArr[RookName];
var RookNewCol = (((NewCol - WasCol) < 0) ? 3 : 5);
MovedArr.push(RookPiece.PieceGo(RookPiece.row, RookNewCol));
this.DidCastleQ = true;
}
}
MovedArr.push(this.PieceGo(NewRow, NewCol));
if (DidCastleQ) {
this.CastledQ = true;
}
this.MovedQ = true;
if (this.PieceType == "P") {
EndRow = ((this.Clr == "W") ? 7 : 0);
if (NewRow == EndRow) {
var QueenPiece = null;
delete _global.__resolve;
var varname;
_global.__resolve = _global.__debugResolve;
for (varname in _root.PieceArr) {
var Piece = _root.PieceArr[varname];
if (Piece.col < 0) {
if (Piece.Clr == this.Clr) {
if (Piece.PieceType == "Q") {
QueenPiece = Piece;
// unexpected jump
}
}
}
// unexpected jump
do {
} while ("PieceFinishMove" != null);
}
if (QueenPiece == null) {
var QueenName = (this.Clr + "Q");
var NewQueenNum = 0;
while (_root.PieceArr[QueenName + NewQueenNum] != null) {
NewQueenNum++;
}
var NewDepth = ((10050 + ((this.Clr == "W") ? 0 : 10)) + NewQueenNum);
QueenPiece = _root.SetUpPiece(QueenName, QueenName + NewQueenNum, NewDepth, NewRow, -2);
}
MovedArr.push(this.Capture(false));
MovedArr.push(QueenPiece.PieceGo(NewRow, NewCol));
QueenPiece.MovedQ = true;
}
}
var KingPiece = _root.PieceArr[this.Clr + "K0"];
if (_root.IsThreatened(KingPiece.row, KingPiece.col, this.Clr)) {
_root.UndoMoves(MovedArr);
var MovedArr = new Array();
_root.StatusText.text = _root.LangStillInCheck;
}
return(MovedArr);
};
MovieClip.prototype.Capture = function (ShowQ) {
var NewRow = 0;
var NewCol = -4;
if (ShowQ) {
delete _global.__resolve;
var varname;
_global.__resolve = _global.__debugResolve;
for (varname in _root.PieceArr) {
if (_root.PieceArr[varname].col == -2) {
NewRow++;
}
}
NewRow = 8 - (NewRow * 0.6);
NewCol = -2;
}
this.MovedQ = true;
return(this.PieceGo(NewRow, NewCol));
};
MovieClip.prototype.IsEmpty = function (NewRow, NewCol) {
return(_root.Board[NewRow][NewCol] == null);
};
MovieClip.prototype.IsEnemy = function (NewRow, NewCol) {
if (this.IsEmpty(NewRow, NewCol)) {
return(false);
}
return(_root.Board[NewRow][NewCol].Clr != this.Clr);
};
MovieClip.prototype.PushMove = function (MoveArr, NewRow, NewCol) {
if (!((NewRow >= 0) ? (NewRow <= 7) : false)) {
return(false);
}
if (!((NewCol >= 0) ? (NewCol <= 7) : false)) {
return(false);
}
if (this.PieceCanMove(NewRow, NewCol)) {
MoveArr.push([this.row, this.col, NewRow, NewCol, this]);
return(true);
}
return(false);
};
MovieClip.prototype.IsRouteClear = function (NewRow, NewCol, IgnoreRow, IgnoreCol) {
var trow = this.row;
var tcol = this.col;
var First = true;
while (!((trow == NewRow) ? (tcol == NewCol) : false)) {
if (!((trow == IgnoreRow) ? (tcol != IgnoreCol) : true)) {
} else if (!First) {
if (_root.Board[trow][tcol] != null) {
return(false);
}
}
if (NewRow < trow) {
trow--;
}
if (NewRow > trow) {
trow++;
}
if (NewCol < tcol) {
tcol--;
}
if (NewCol > tcol) {
tcol++;
}
First = false;
}
return(true);
};
}
}
// unexpected jump
// unexpected jump
function IsThreatened(NewRow, NewCol, Clr) {
tellTarget (getProperty("..", _target)) {
var ThreatQ = false;
delete _global.__resolve;
var varname1;
_global.__resolve = _global.__debugResolve;
for (varname1 in _root.PieceArr) {
var Piece1 = _root.PieceArr[varname1];
if (Piece1.Clr != Clr) {
if (Piece1.col >= 0) {
if (!((Piece1.row == NewRow) ? (Piece1.col == NewCol) : false)) {
if (Piece1.PieceCanAttack(NewRow, NewCol, -1, -1)) {
ThreatQ = true;
// unexpected jump
}
}
}
}
// unexpected jump
do {
} while (() != null);
}
return(ThreatQ);
}
}
// unexpected jump
// unexpected jump
function ShowThreats() {
tellTarget (getProperty("..", _target)) {
var i = 0;
for ( ; i < 2 ; i++) {
var Clr = ClrArr[i];
var KPiece = PieceArr[Clr + "K0"];
if (IsThreatened(KPiece.row, KPiece.col, Clr)) {
SquaresArr[KPiece.row][KPiece.col].FlashMe();
}
}
}
}
// unexpected jump
// unexpected jump
function PieceCount() {
tellTarget (getProperty("..", _target)) {
var count = 0;
for (varname in PieceArr) {
count++;
}
return(count);
}
}
// unexpected jump
// unexpected jump
function FillMovesRP(Clr) {
tellTarget (getProperty("..", _target)) {
var posmoves = new Array();
delete _global.__resolve;
var varname;
_global.__resolve = _global.__debugResolve;
for (varname in PieceArr) {
var Piece = PieceArr[varname];
if (!((Piece.col >= 0) ? (Piece.Clr != Clr) : true)) {
Piece.PushMoves(posmoves);
}
}
return(posmoves);
}
}
// unexpected jump
// unexpected jump
function ShowPieces() {
tellTarget (getProperty("..", _target)) {
var s = "";
delete _global.__resolve;
var varname;
_global.__resolve = _global.__debugResolve;
for (varname in PieceArr) {
Piece = PieceArr[varname];
s = s + (((((("(" + Piece._name) + " ") + Piece.row) + ",") + Piece.col) + ")");
}
return(s);
}
}
// unexpected jump
// unexpected jump
function ShowBoard() {
tellTarget (getProperty("..", _target)) {
var s = "";
row = 0;
for ( ; row < BoardSize ; row++) {
s = s + newline;
col = 0;
for ( ; col < BoardSize ; col++) {
s = s + (Board[row][col]._name + ",");
}
}
return(s);
}
}
// unexpected jump
// unexpected jump
function OtherClr(Clr) {
tellTarget (getProperty("..", _target)) {
if (Clr == "W") {
return("B");
}
return("W");
}
}
// unexpected jump
// unexpected jump
function InCheckmate(Clr) {
tellTarget (getProperty("..", _target)) {
CheckQ = false;
MateQ = false;
var KingPiece = _root.PieceArr[Clr + "K0"];
if (_root.IsThreatened(KingPiece.row, KingPiece.col, Clr)) {
CheckQ = true;
MateQ = true;
var CheckMoves = new Array();
CheckMoves = FillMovesRP(Clr);
var i = 0;
// unexpected jump
do {
i++;
if (i >= CheckMoves.length) {
break;
}
var CheckMove = CheckMoves[i];
var CheckMovedArr = CheckMove[4].PieceFinishMove(CheckMove[2], CheckMove[3]);
if (!_root.IsThreatened(KingPiece.row, KingPiece.col, Clr)) {
MateQ = false;
}
_root.UndoMoves(CheckMovedArr);
} while (MateQ);
}
return(MateQ);
}
}
// unexpected jump
// unexpected jump
function InStalemate(Clr) {
tellTarget (getProperty("..", _target)) {
return(false);
}
}
// unexpected jump
// unexpected jump
function History(TheMove) {
tellTarget (getProperty("..", _target)) {
s = "";
var MovePiece = TheMove[4];
var MoveNo = MoveNo.text;
if (MovePiece.Clr == "W") {
s = s + (MoveNo + ": ");
} else {
s = s + " ";
}
if (MovePiece.DidCastleQ) {
if (MovePiece.col == 2) {
s = s + "O-O-O";
} else {
s = s + "O-O";
}
} else {
if (MovePiece.PieceType != "P") {
s = s + MovePiece.PieceType;
}
if (MovePiece.DidCaptureQ) {
if (MovePiece.PieceType == "P") {
s = s + Alphabet[TheMove[1]];
}
s = s + "x";
}
s = s + (Alphabet[TheMove[3]] + (TheMove[2] + 1));
}
var OppClr = _root.OtherClr(MovePiece.Clr);
if (MovePiece.Clr == "W") {
} else {
s = s + newline;
}
if (25 >= MoveNo) {
_root.History1Text.text = _root.History1Text.text + s;
} else {
_root.History2Text.text = _root.History2Text.text + s;
}
}
}
// unexpected jump
// unexpected jump
function ScrollDebug() {
tellTarget (getProperty("..", _target)) {
Debug.scroll = Debug.scroll + 10;
}
}
// unexpected jump
// unexpected jump
function UndoMoves(MovedArr) {
tellTarget (getProperty("..", _target)) {
var j = (MovedArr.length - 1);
for ( ; j >= 0 ; j--) {
var UndoMove = MovedArr[j];
UndoMove[4].PieceGo(UndoMove[0], UndoMove[1]);
UndoMove[4].MovedQ = UndoMove[5];
UndoMove[4].CastledQ = UndoMove[6];
}
}
}
// unexpected jump
// unexpected jump
Init();
// unexpected jump
// unexpected jump
};
stop();
Symbol 8 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function Go() {
tellTarget (getProperty("..", _target)) {
gotoAndPlay(2);
}
}
}
} else {
// unexpected jump
}
};
stop();
Symbol 13 MovieClip Frame 1
stop();
Symbol 13 MovieClip Frame 2
WellDoneText.text = _root.LangWellDone;
WellDoneShadowText.text = _root.LangWellDone;
Symbol 14 MovieClip Frame 1
stop();
Symbol 14 MovieClip Frame 4
_root.ScrollDebug();
_root.ComputersTurn();
Symbol 15 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function PieceCanMove(NewRow, NewCol) {
tellTarget (getProperty("..", _target)) {
if (_root.Board[NewRow][NewCol].Clr == this.Clr) {
return(false);
}
if (!((Math.abs(this.row - NewRow) <= 1) ? (Math.abs(this.col - NewCol) <= 1) : false)) {
if (!((Math.abs(this.row - NewRow) == 0) ? (Math.abs(this.col - NewCol) != 2) : true)) {
return(CanCastle((NewCol - this.col) / 2));
}
return(false);
}
if (_root.IsThreatened(NewRow, NewCol, this.Clr)) {
return(false);
}
return(true);
}
}
}
} else {
// unexpected jump
}
function PieceCanAttack(NewRow, NewCol, IgnoreRow, IgnoreCol) {
tellTarget (getProperty("..", _target)) {
if (!((Math.abs(this.row - NewRow) <= 1) ? (Math.abs(this.col - NewCol) <= 1) : false)) {
return(false);
}
return(true);
}
}
// unexpected jump
// unexpected jump
function PushMoves(MoveArr) {
tellTarget (getProperty("..", _target)) {
this.PushMove(MoveArr, this.row + 1, this.col);
this.PushMove(MoveArr, this.row + 1, this.col + 1);
this.PushMove(MoveArr, this.row, this.col + 1);
this.PushMove(MoveArr, this.row - 1, this.col + 1);
this.PushMove(MoveArr, this.row - 1, this.col);
this.PushMove(MoveArr, this.row - 1, this.col - 1);
this.PushMove(MoveArr, this.row, this.col - 1);
this.PushMove(MoveArr, this.row + 1, this.col - 1);
this.PushMove(MoveArr, this.row, this.col - 2);
this.PushMove(MoveArr, this.row, this.col + 2);
}
}
// unexpected jump
// unexpected jump
function CanCastle(Dir) {
tellTarget (getProperty("..", _target)) {
if (this.MovedQ) {
return(false);
}
var RookCol = ((Dir < 0) ? 0 : 7);
if (!this.IsRouteClear(this.row, RookCol, this.row, RookCol)) {
return(false);
}
if (_root.IsThreatened(this.row, this.col, this.Clr)) {
return(false);
}
if (_root.IsThreatened(this.row, this.col + Dir, this.Clr)) {
return(false);
}
if (_root.IsThreatened(this.row, this.col + (Dir * 2), this.Clr)) {
return(false);
}
var RookName = (this.Clr + ((Dir < 0) ? "R0" : "R1"));
var RookPiece = _root.PieceArr[RookName];
if (RookPiece.MovedQ) {
return(false);
}
return(true);
}
}
// unexpected jump
// unexpected jump
PieceLoad();
CastledQ = false;
// unexpected jump
// unexpected jump
};
stop();
Symbol 16 Button
on (press) {
SelfPress();
}
on (release) {
SelfRelease();
}
Symbol 21 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function PieceCanMove(NewRow, NewCol) {
tellTarget (getProperty("..", _target)) {
if (_root.Board[NewRow][NewCol].Clr == this.Clr) {
return(false);
}
if (_root.IsThreatened(NewRow, NewCol, this.Clr)) {
return(false);
}
if (!((Math.abs(this.row - NewRow) <= 1) ? (Math.abs(this.col - NewCol) <= 1) : false)) {
if (!((Math.abs(this.row - NewRow) == 0) ? (Math.abs(this.col - NewCol) != 2) : true)) {
return(CanCastle((NewCol - this.col) / 2));
}
return(false);
}
return(true);
}
}
}
} else {
// unexpected jump
}
function PieceCanAttack(NewRow, NewCol, IgnoreRow, IgnoreCol) {
tellTarget (getProperty("..", _target)) {
if (!((Math.abs(this.row - NewRow) <= 1) ? (Math.abs(this.col - NewCol) <= 1) : false)) {
return(false);
}
return(true);
}
}
// unexpected jump
// unexpected jump
function PushMoves(MoveArr) {
tellTarget (getProperty("..", _target)) {
this.PushMove(MoveArr, this.row + 1, this.col);
this.PushMove(MoveArr, this.row + 1, this.col + 1);
this.PushMove(MoveArr, this.row, this.col + 1);
this.PushMove(MoveArr, this.row - 1, this.col + 1);
this.PushMove(MoveArr, this.row - 1, this.col);
this.PushMove(MoveArr, this.row - 1, this.col - 1);
this.PushMove(MoveArr, this.row, this.col - 1);
this.PushMove(MoveArr, this.row + 1, this.col - 1);
this.PushMove(MoveArr, this.row, this.col - 2);
this.PushMove(MoveArr, this.row, this.col + 2);
}
}
// unexpected jump
// unexpected jump
function CanCastle(Dir) {
tellTarget (getProperty("..", _target)) {
if (this.MovedQ) {
return(false);
}
var RookCol = ((Dir < 0) ? 0 : 7);
if (!this.IsRouteClear(this.row, RookCol, this.row, RookCol)) {
return(false);
}
if (_root.IsThreatened(this.row, this.col, this.Clr)) {
return(false);
}
if (_root.IsThreatened(this.row, this.col + Dir, this.Clr)) {
return(false);
}
if (_root.IsThreatened(this.row, this.col + (Dir * 2), this.Clr)) {
return(false);
}
var RookName = (this.Clr + ((Dir < 0) ? "R0" : "R1"));
var RookPiece = _root.PieceArr[RookName];
if (RookPiece.MovedQ) {
return(false);
}
return(true);
}
}
// unexpected jump
// unexpected jump
PieceLoad();
CastledQ = false;
// unexpected jump
// unexpected jump
};
stop();
Symbol 25 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function PieceCanMove(NewRow, NewCol) {
tellTarget (getProperty("..", _target)) {
if (_root.Board[NewRow][NewCol].Clr == this.Clr) {
return(false);
}
var drow = (this.row - NewRow);
var dcol = (this.col - NewCol);
var ok = false;
if (!((drow != 0) ? (dcol != 0) : false)) {
ok = true;
}
if (Math.abs(drow) == Math.abs(dcol)) {
ok = true;
}
if (!ok) {
return(false);
}
return(this.IsRouteClear(NewRow, NewCol, -1, -1));
}
}
}
} else {
// unexpected jump
}
function PieceCanAttack(NewRow, NewCol, IgnoreRow, IgnoreCol) {
tellTarget (getProperty("..", _target)) {
var drow = (this.row - NewRow);
var dcol = (this.col - NewCol);
var ok = false;
if (!((drow != 0) ? (dcol != 0) : false)) {
ok = true;
}
if (Math.abs(drow) == Math.abs(dcol)) {
ok = true;
}
if (!ok) {
return(false);
}
return(this.IsRouteClear(NewRow, NewCol, IgnoreRow, IgnoreCol));
}
}
// unexpected jump
// unexpected jump
function PushMoves(MoveArr) {
tellTarget (getProperty("..", _target)) {
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row, this.col - i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row + i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row - i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row + i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row - i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row - i, this.col - i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row + i, this.col - i));
}
}
// unexpected jump
// unexpected jump
PieceLoad();
// unexpected jump
// unexpected jump
};
stop();
Symbol 32 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function PieceCanMove(NewRow, NewCol) {
tellTarget (getProperty("..", _target)) {
if (!(((this.row - NewRow) != 0) ? ((this.col - NewCol) == 0) : true)) {
return(false);
}
if (_root.Board[NewRow][NewCol].Clr == this.Clr) {
return(false);
}
return(this.IsRouteClear(NewRow, NewCol, -1, -1));
}
}
}
} else {
// unexpected jump
}
function PieceCanAttack(NewRow, NewCol, IgnoreRow, IgnoreCol) {
tellTarget (getProperty("..", _target)) {
if (!(((this.row - NewRow) != 0) ? ((this.col - NewCol) == 0) : true)) {
return(false);
}
return(this.IsRouteClear(NewRow, NewCol, IgnoreRow, IgnoreCol));
}
}
// unexpected jump
// unexpected jump
function PushMoves(MoveArr) {
tellTarget (getProperty("..", _target)) {
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row, this.col - i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row + i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row - i, this.col));
}
}
// unexpected jump
// unexpected jump
PieceLoad();
// unexpected jump
// unexpected jump
};
stop();
Symbol 36 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function PieceCanMove(NewRow, NewCol) {
tellTarget (getProperty("..", _target)) {
if (_root.Board[NewRow][NewCol].Clr == this.Clr) {
return(false);
}
if (!(((this.row - NewRow) != 0) ? ((this.col - NewCol) == 0) : true)) {
return(false);
}
return(this.IsRouteClear(NewRow, NewCol, -1, -1));
}
}
}
} else {
// unexpected jump
}
function PieceCanAttack(NewRow, NewCol, IgnoreRow, IgnoreCol) {
tellTarget (getProperty("..", _target)) {
if (!(((this.row - NewRow) != 0) ? ((this.col - NewCol) == 0) : true)) {
return(false);
}
return(this.IsRouteClear(NewRow, NewCol, IgnoreRow, IgnoreCol));
}
}
// unexpected jump
// unexpected jump
function PushMoves(MoveArr) {
tellTarget (getProperty("..", _target)) {
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row, this.col - i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row + i, this.col));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row - i, this.col));
}
}
// unexpected jump
// unexpected jump
PieceLoad();
// unexpected jump
// unexpected jump
};
stop();
Symbol 40 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function PieceCanMove(NewRow, NewCol) {
tellTarget (getProperty("..", _target)) {
if (_root.Board[NewRow][NewCol].Clr == this.Clr) {
return(false);
}
var drow = Math.abs(this.row - NewRow);
var dcol = Math.abs(this.col - NewCol);
if (!((!((drow == 1) ? (dcol == 2) : false)) ? (!((drow == 2) ? (dcol == 1) : false)) : false)) {
return(true);
}
return(false);
}
}
}
} else {
// unexpected jump
}
function PieceCanAttack(NewRow, NewCol, IgnoreRow, IgnoreCol) {
tellTarget (getProperty("..", _target)) {
var drow = Math.abs(this.row - NewRow);
var dcol = Math.abs(this.col - NewCol);
if (!((!((drow == 1) ? (dcol == 2) : false)) ? (!((drow == 2) ? (dcol == 1) : false)) : false)) {
return(true);
}
return(false);
}
}
// unexpected jump
// unexpected jump
function PushMoves(MoveArr) {
tellTarget (getProperty("..", _target)) {
this.PushMove(MoveArr, this.row + 1, this.col + 2);
this.PushMove(MoveArr, this.row + 1, this.col - 2);
this.PushMove(MoveArr, this.row + 2, this.col + 1);
this.PushMove(MoveArr, this.row + 2, this.col - 1);
this.PushMove(MoveArr, this.row - 1, this.col + 2);
this.PushMove(MoveArr, this.row - 1, this.col - 2);
this.PushMove(MoveArr, this.row - 2, this.col + 1);
this.PushMove(MoveArr, this.row - 2, this.col - 1);
}
}
// unexpected jump
// unexpected jump
PieceLoad();
// unexpected jump
// unexpected jump
};
stop();
Symbol 47 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function PieceCanMove(NewRow, NewCol) {
tellTarget (getProperty("..", _target)) {
if (_root.Board[NewRow][NewCol].Clr == this.Clr) {
return(false);
}
if (Math.abs(this.row - NewRow) != Math.abs(this.col - NewCol)) {
return(false);
}
return(this.IsRouteClear(NewRow, NewCol, -1, -1));
}
}
}
} else {
// unexpected jump
}
function PieceCanAttack(NewRow, NewCol, IgnoreRow, IgnoreCol) {
tellTarget (getProperty("..", _target)) {
if (Math.abs(this.row - NewRow) != Math.abs(this.col - NewCol)) {
return(false);
}
return(this.IsRouteClear(NewRow, NewCol, IgnoreRow, IgnoreCol));
}
}
// unexpected jump
// unexpected jump
function PushMoves(MoveArr) {
tellTarget (getProperty("..", _target)) {
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row + i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row - i, this.col + i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row - i, this.col - i));
var i = 1;
// unexpected jump
do {
i++;
if (i >= 8) {
break;
}
} while (this.PushMove(MoveArr, this.row + i, this.col - i));
}
}
// unexpected jump
// unexpected jump
PieceLoad();
// unexpected jump
// unexpected jump
};
stop();
Symbol 54 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function PieceCanMove(NewRow, NewCol) {
tellTarget (getProperty("..", _target)) {
var drow = (NewRow - this.row);
var dcol = (NewCol - this.col);
var Direction = ((this.Clr == "W") ? 1 : -1);
if (!((drow == Direction) ? (dcol != 0) : true)) {
return(this.IsEmpty(NewRow, NewCol));
}
if (!((drow == (Direction * 2)) ? (((dcol == 0) ? (this.row != (3.5 - (Direction * 2.5))) : true)) : true)) {
if (!this.IsEmpty(this.row + Direction, this.col)) {
return(false);
}
return(this.IsEmpty(NewRow, NewCol));
}
if (!((drow == Direction) ? (Math.abs(dcol) != 1) : true)) {
if (_root.EnPassant[_root.OtherClr(this.Clr)] != null) {
if (!((NewRow == _root.EnPassant[_root.OtherClr(this.Clr)][1]) ? (NewCol != _root.EnPassant[_root.OtherClr(this.Clr)][2]) : true)) {
return(true);
}
}
return(this.IsEnemy(NewRow, NewCol));
}
if (_root.Board[NewRow][NewCol].Clr == this.Clr) {
return(false);
}
return(false);
}
}
}
} else {
// unexpected jump
}
function PieceCanAttack(NewRow, NewCol, IgnoreRow, IgnoreCol) {
tellTarget (getProperty("..", _target)) {
var drow = (NewRow - this.row);
var dcol = (NewCol - this.col);
var Direction = ((this.Clr == "W") ? 1 : -1);
if (!((drow == Direction) ? (Math.abs(dcol) != 1) : true)) {
return(true);
}
return(false);
}
}
// unexpected jump
// unexpected jump
function PushMoves(MoveArr) {
tellTarget (getProperty("..", _target)) {
var Direction = ((this.Clr == "W") ? 1 : -1);
this.PushMove(MoveArr, this.row + Direction, this.col);
this.PushMove(MoveArr, this.row + (Direction * 2), this.col);
this.PushMove(MoveArr, this.row + Direction, this.col - 1);
this.PushMove(MoveArr, this.row + Direction, this.col + 1);
}
}
// unexpected jump
// unexpected jump
PieceLoad();
// unexpected jump
// unexpected jump
};
stop();
Symbol 61 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function FlashMe() {
tellTarget (getProperty("..", _target)) {
Flasher.gotoAndPlay(2);
}
}
}
} else {
// unexpected jump
}
function ClearAttacks() {
tellTarget (getProperty("..", _target)) {
Attack.W = 0;
Attack.B = 0;
}
}
// unexpected jump
// unexpected jump
function MarkAttack(Clr) {
tellTarget (getProperty("..", _target)) {
Attack[Clr]++;
}
}
// unexpected jump
// unexpected jump
function AttackBal(Clr) {
tellTarget (getProperty("..", _target)) {
return(Attack.W - Attack.B);
}
}
// unexpected jump
// unexpected jump
Attack = new Array();
ClearAttacks();
// unexpected jump
// unexpected jump
};
stop();
Symbol 64 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function SetColor(HexCol) {
tellTarget (getProperty("..", _target)) {
mycolor.setRGB(HexCol);
}
}
}
} else {
// unexpected jump
}
mycolor = new Color(this._parent);
// unexpected jump
// unexpected jump
};
stop();
Symbol 65 Button
on (press) {
tellTarget ("..") {
Outline.SetColor(_root.ColArr[_root.ColTabGroup.GetItemNo()]);
SetNum(_root.NumTabGroup.GetItemNo() + 1);
_root.NumTabGroup.Incr();
}
}
Symbol 67 MovieClip Frame 1
stop();
Symbol 67 MovieClip Frame 8
stop();
gotoAndStop(1);
Symbol 72 MovieClip Frame 1
stop();
Symbol 84 Button
on (release) {
_root.NewGame();
}
Symbol 88 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function Sector(DrawOnObj, X, Y, Size, FromDeg, ToDeg, LineCol, FillCol, FillQ) {
tellTarget (getProperty("..", _target)) {
with (DrawOnObj) {
if (FillQ) {
beginFill(FillCol, 100);
}
lineStyle(0, LineCol, 100);
var Steps = Math.max(int((ToDeg - FromDeg) / 5), 1);
moveTo(X, Y);
var i = 0;
for ( ; Steps >= i ; i++) {
deg = FromDeg + ((ToDeg - FromDeg) * (i / Steps));
ThisX = X + (Math.cos(deg * (Math.PI/180)) * Size);
ThisY = Y + (Math.sin(deg * (Math.PI/180)) * Size);
lineTo(ThisX, ThisY);
}
lineTo(X, Y);
if (FillQ) {
endFill();
}
}
}
}
}
} else {
// unexpected jump
}
function StartMe(TheSeconds, TheClr) {
tellTarget (getProperty("..", _target)) {
Seconds = TheSeconds;
Clr = TheClr;
gotoAndPlay(10);
}
}
// unexpected jump
// unexpected jump
function StopMe() {
tellTarget (getProperty("..", _target)) {
gotoAndStop(1);
}
}
// unexpected jump
// unexpected jump
function ResetMe() {
tellTarget (getProperty("..", _target)) {
this.clear();
gotoAndStop(1);
}
}
// unexpected jump
// unexpected jump
};
stop();
Symbol 89 MovieClip Frame 1
stop();
Symbol 89 MovieClip Frame 10
TimeStt = getTimer();
Symbol 89 MovieClip Frame 11
Elapsed = (getTimer() - TimeStt) / 1000;
Pct = Elapsed / Seconds;
degrees = Math.min(360 * Pct, 360);
this.clear();
Sector(this, 0, 0, 30, -90, degrees - 90, Clr, Clr, true);
Symbol 89 MovieClip Frame 12
if (degrees < 360) {
gotoAndPlay(11);
}
Symbol 89 MovieClip Frame 13
_root.TimesUp();
Symbol 95 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function DoState() {
tellTarget (getProperty("..", _target)) {
OnState._visible = OnQ;
OffState._visible = !OnQ;
}
}
}
} else {
// unexpected jump
}
function Chosen(newval) {
tellTarget (getProperty("..", _target)) {
TheText.text = newval;
OnQ = true;
DoState();
_root.UpdateBase();
}
}
// unexpected jump
// unexpected jump
function SetItems(ItemArr) {
tellTarget (getProperty("..", _target)) {
OffState.MyRadioGroup.setRadioNames(ItemArr);
SelectNo(0);
}
}
// unexpected jump
// unexpected jump
function SelectNo(ItemNo) {
tellTarget (getProperty("..", _target)) {
OffState.MyRadioGroup.setRadioNum(ItemNo);
TheText.text = OffState.MyRadioGroup.getRadioName();
}
}
// unexpected jump
// unexpected jump
function GetItemNo() {
tellTarget (getProperty("..", _target)) {
return(OffState.MyRadioGroup.getRadioNum());
}
}
// unexpected jump
// unexpected jump
function GetItem() {
tellTarget (getProperty("..", _target)) {
return(OffState.MyRadioGroup.getRadioName());
}
}
// unexpected jump
// unexpected jump
OverState._visible = false;
OnQ = true;
this._parent.DoState();
// unexpected jump
// unexpected jump
};
stop();
Symbol 99 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function checkMe(a_radio) {
tellTarget (getProperty("..", _target)) {
var cnt = 0;
for ( ; cnt < pRadio.length ; cnt++) {
if (pRadio[cnt] == a_radio) {
setRadioNum(cnt);
}
}
_parent._parent.Chosen(a_radio.label);
}
}
}
} else {
// unexpected jump
}
function setRadioNum(a_num) {
tellTarget (getProperty("..", _target)) {
var cnt = 0;
for ( ; cnt < pRadio.length ; cnt++) {
pRadio[cnt].checked = false;
}
pRadio[a_num].checked = true;
pRadioNum = a_num;
}
}
// unexpected jump
// unexpected jump
function getRadioNum() {
tellTarget (getProperty("..", _target)) {
return(pRadioNum);
}
}
// unexpected jump
// unexpected jump
function getRadioName() {
tellTarget (getProperty("..", _target)) {
return(pRadio[pRadioNum].label);
}
}
// unexpected jump
// unexpected jump
function setRadioNames(new_names) {
tellTarget (getProperty("..", _target)) {
delete _global.__resolve;
var cnt;
var a_radio;
_global.__resolve = _global.__debugResolve;
cnt = 0;
for ( ; cnt < new_names.length ; cnt++) {
a_radio = radiobox_default.duplicateMovieClip("radiobox" + cnt, cnt);
a_radio._x = 0;
a_radio._y = cnt * BoxHeight;
a_radio._visble = true;
a_radio.label = new_names[cnt];
pRadio.push(a_radio);
}
BottomLine._y = cnt * BoxHeight;
}
}
// unexpected jump
// unexpected jump
var pRadioNum = 0;
var pRadio = new Array();
BoxHeight = 22;
// unexpected jump
// unexpected jump
};
stop();
Symbol 100 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function setStatus(val) {
tellTarget (getProperty("..", _target)) {
checked = val;
gotoAndStop((checked ? 1 : 2));
}
}
}
} else {
// unexpected jump
}
function setName(a_name) {
tellTarget (getProperty("..", _target)) {
label = a_name;
}
}
// unexpected jump
// unexpected jump
delete _global.__resolve;
var label;
var checked;
_global.__resolve = _global.__debugResolve;
// unexpected jump
// unexpected jump
gotoAndStop((checked ? 1 : 2));
// unexpected jump
// unexpected jump
};
nextFrame();
play();
Symbol 100 MovieClip Frame 3
tellTarget ("..") {
gotoAndStop((checked ? 1 : 2));
};
gotoAndPlay (2);
Symbol 106 Button
on (release) {
_parent.checkMe(this);
}
Symbol 111 Button
on (release) {
_parent.checkMe(this);
}
Symbol 115 MovieClip Frame 1
stop();
Symbol 115 MovieClip Frame 2
stop();
Symbol 116 MovieClip Frame 1
radiobox_default._visible = false;
stop();
Symbol 123 Button
on (release) {
tellTarget ("..") {
OnQ = !OnQ;
DoState();
}
}
on (rollOver) {
_parent.OverState._visible = true;
}
on (rollOut) {
_parent.OverState._visible = false;
}
Symbol 129 Button
on (press) {
OnQ = !OnQ;
DoState();
}
Symbol 130 MovieClip Frame 2
stop();
Symbol 134 MovieClip Frame 2
stop();
Symbol 138 MovieClip Frame 2
stop();
Symbol 146 Button
on (release) {
_root.EvalF.ExposedSum();
}
Symbol 147 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function Init() {
tellTarget (getProperty("..", _target)) {
expRatio = 0.2;
PieceVals = {K:1000, Q:900, B:325, N:310, R:500, P:100};
bishop = [-5, -5, -5, -5, -5, -5, -5, -5, -5, 10, 5, 10, 10, 5, 10, -5, -5, 5, 3, 12, 12, 3, 5, -5, -5, 3, 12, 3, 3, 12, 3, -5, -5, 3, 12, 3, 3, 12, 3, -5, -5, 5, 3, 12, 12, 3, 5, -5, -5, 10, 5, 10, 10, 5, 10, -5, -5, -5, -5, -5, -5, -5, -5, -5];
knight = [-10, -5, -5, -5, -5, -5, -5, -10, -5, 0, 0, 3, 3, 0, 0, -5, -5, 0, 5, 5, 5, 5, 0, -5, -5, 0, 5, 10, 10, 5, 0, -5, -5, 0, 5, 10, 10, 5, 0, -5, -5, 0, 5, 5, 5, 5, 0, -5, -5, 0, 0, 3, 3, 0, 0, -5, -10, -5, -5, -5, -5, -5, -5, -10];
white_pawn = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -5, -5, 0, 0, 0, 1, 2, 3, 4, 4, 3, 2, 1, 2, 4, 6, 8, 8, 6, 4, 2, 3, 6, 9, 12, 12, 9, 6, 3, 4, 8, 12, 16, 16, 12, 8, 4, 5, 10, 15, 20, 20, 15, 10, 5, 0, 0, 0, 0, 0, 0, 0, 0];
black_pawn = [0, 0, 0, 0, 0, 0, 0, 0, 5, 10, 15, 20, 20, 15, 10, 5, 4, 8, 12, 16, 16, 12, 8, 4, 3, 6, 9, 12, 12, 9, 6, 3, 2, 4, 6, 8, 8, 6, 4, 2, 1, 2, 3, 4, 4, 3, 2, 1, 0, 0, 0, -5, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
white_king = [2, 10, 4, 0, 0, 7, 10, 2, -3, -3, -5, -5, -5, -5, -3, -3, -5, -5, -8, -8, -8, -8, -5, -5, -8, -8, -13, -13, -13, -13, -8, -8, -13, -13, -21, -21, -21, -21, -13, -13, -21, -21, -34, -34, -34, -34, -21, -21, -34, -34, -55, -55, -55, -55, -34, -34, -55, -55, -89, -89, -89, -89, -55, -55];
black_king = [-55, -55, -89, -89, -89, -89, -55, -55, -34, -34, -55, -55, -55, -55, -34, -34, -21, -21, -34, -34, -34, -34, -21, -21, -13, -13, -21, -21, -21, -21, -13, -13, -8, -8, -13, -13, -13, -13, -8, -8, -5, -5, -8, -8, -8, -8, -5, -5, -3, -3, -5, -5, -5, -5, -3, -3, 2, 10, 4, 0, 0, 7, 10, 2];
end_king = [-5, -3, -1, 0, 0, -1, -3, -5, -3, 5, 5, 5, 5, 5, 5, -3, -1, 5, 10, 10, 10, 10, 5, -1, 0, 5, 10, 15, 15, 10, 5, 0, 0, 5, 10, 15, 15, 10, 5, 0, -1, 5, 10, 10, 10, 10, 5, -1, -3, 5, 5, 5, 5, 5, 5, -3, -5, -3, -1, 0, 0, -1, -3, -5];
rev_row = [7, 6, 5, 4, 3, 2, 1];
}
}
}
} else {
// unexpected jump
}
function HasMoved(PieceName) {
tellTarget (getProperty("..", _target)) {
return(_root.PieceArr[PieceName].MovedQ);
}
}
// unexpected jump
// unexpected jump
function GetScore(Clr) {
tellTarget (getProperty("..", _target)) {
piece_count = 0;
for (varname in _root.PieceArr) {
Piece = _root.PieceArr[varname];
if (Piece.col >= 0) {
piece_count++;
}
}
MoveNo = int(_root.MoveNo.text);
var score = 0;
if (12 >= MoveNo) {
score = opn_eval();
} else if (piece_count > 15) {
score = mid_eval();
} else {
score = end_eval();
}
if (_root.DifficultyDrop.GetItemNo() > 0) {
score = score + MaterialSum();
}
if (_root.DifficultyDrop.GetItemNo() > 1) {
score = score + ExposedSum();
}
if (Clr == "W") {
return(score);
}
return(-score);
}
}
// unexpected jump
// unexpected jump
function MaterialSum() {
tellTarget (getProperty("..", _target)) {
var x = 0;
delete _global.__resolve;
var varname;
_global.__resolve = _global.__debugResolve;
for (varname in _root.PieceArr) {
Piece = _root.PieceArr[varname];
if (Piece.col < 0) {
continue;
}
if (Piece.Clr == "W") {
x = x + PieceVals[Piece.PieceType];
} else {
x = x - PieceVals[Piece.PieceType];
}
}
return(x);
}
}
// unexpected jump
// unexpected jump
function PieceVal(PieceType) {
tellTarget (getProperty("..", _target)) {
return(PieceVals[PieceType]);
}
}
// unexpected jump
// unexpected jump
function ExposedSum() {
tellTarget (getProperty("..", _target)) {
_root.ClearAttackArray();
for (varname in _root.PieceArr) {
Piece = _root.PieceArr[varname];
if (Piece.col < 0) {
continue;
}
Piece.MarkAttacks();
}
var s = "";
var expScore = 0;
var exchangeSum = 0;
delete _global.__resolve;
var varname;
_global.__resolve = _global.__debugResolve;
for (varname in _root.PieceArr) {
Piece = _root.PieceArr[varname];
if (Piece.col < 0) {
continue;
}
var AttackBal = (_root.AttackArr[Piece.row][Piece.col][0] - _root.AttackArr[Piece.row][Piece.col][1]);
if (!((Piece.Clr == "W") ? (AttackBal >= 0) : true)) {
s = s + (("," + Piece._name) + " exposed");
exchangeSum = ((-PieceVal(Piece.PieceType)) - (_root.AttackArr[Piece.row][Piece.col][2] / 2)) + (_root.AttackArr[Piece.row][Piece.col][3] / 2);
s = s + (",exchangeSum=" + exchangeSum);
expScore = expScore + (exchangeSum * expRatio);
}
if (!((Piece.Clr == "B") ? (AttackBal <= 0) : true)) {
s = s + (("," + Piece._name) + " exposed");
exchangeSum = (PieceVal(Piece.PieceType) - (_root.AttackArr[Piece.row][Piece.col][2] / 2)) + (_root.AttackArr[Piece.row][Piece.col][3] / 2);
s = s + (",exchangeSum=" + exchangeSum);
expScore = expScore + (exchangeSum * expRatio);
}
}
return(expScore);
}
}
// unexpected jump
// unexpected jump
function opn_eval() {
tellTarget (getProperty("..", _target)) {
delete _global.__resolve;
var i;
var pawn_col;
_global.__resolve = _global.__debugResolve;
var pawns = new Array();
var white_back_pawn = new Array();
var black_back_pawn = new Array();
delete _global.__resolve;
var row;
var wking_pawn_col;
var bking_pawn_col;
var j;
_global.__resolve = _global.__debugResolve;
var score = 0;
delete _global.__resolve;
var isolated;
var backwards;
_global.__resolve = _global.__debugResolve;
pawns[0] = new Array();
pawns[1] = new Array();
i = 0;
for ( ; i < 8 ; i++) {
pawns[0][i] = 0;
pawns[1][i] = 0;
white_back_pawn[i] = 7;
black_back_pawn[i] = 2;
}
for (varname in _root.PieceArr) {
Piece = _root.PieceArr[varname];
if (Piece.col < 0) {
continue;
}
if (Piece.PieceType == "P") {
i = (Piece.row * 8) + Piece.col;
pawn_col = Piece.col + 1;
row = Piece.row + 1;
if (Piece.Clr == "W") {
pawns[1][pawn_col]++;
if (row < white_back_pawn[pawn_col]) {
white_back_pawn[pawn_col] = row;
}
} else {
pawns[0][pawn_col]++;
if (row > black_back_pawn[pawn_col]) {
black_back_pawn[pawn_col] = row;
}
}
}
}
var prevscore = 0;
for (varname in _root.PieceArr) {
Piece = _root.PieceArr[varname];
if (Piece.col < 0) {
continue;
}
i = (Piece.row * 8) + Piece.col;
pawn_col = Piece.col + 1;
row = Piece.row + 1;
var ClrSign = ((Piece.Clr == "W") ? 1 : -1);
Piece.PieceType;
if (Piece.PieceType != "P") {
if (Piece.PieceType != "R") {
if (Piece.PieceType != "B") {
if (Piece.PieceType != "N") {
if (Piece.PieceType != "Q") {
if (Piece.PieceType != "K") {
// unexpected jump
if (Piece.Clr == "W") {
isolated = false;
backwards = false;
score = score + white_pawn[i];
if (!((white_back_pawn[pawn_col + 1] > row) ? (white_back_pawn[pawn_col - 1] <= row) : true)) {
if (row != 2) {
score = score - 3;
}
backwards = true;
if (!((!pawns[1][pawn_col + 1]) ? pawns[1][pawn_col - 1] : true)) {
score = score - 2;
isolated = true;
}
}
if (!pawns[0][pawn_col]) {
if (backwards) {
score = score - 3;
}
if (isolated) {
score = score - 5;
}
}
if (pawns[1][pawn_col] > 1) {
score = score - (2 * (pawns[1][pawn_col] - 1));
}
if (!((!pawns[0][pawn_col]) ? ((row >= black_back_pawn[pawn_col - 1]) ? (row < black_back_pawn[pawn_col + 1]) : true) : true)) {
score = score + white_pawn[i];
if (!isolated) {
score = score + 10;
}
}
} else {
isolated = false;
backwards = false;
score = score - black_pawn[i];
if (!((black_back_pawn[pawn_col + 1] < row) ? (black_back_pawn[pawn_col - 1] >= row) : true)) {
if (row != 2) {
score = score + 3;
}
backwards = true;
if (!((!pawns[0][pawn_col + 1]) ? pawns[0][pawn_col - 1] : true)) {
score = score + 2;
isolated = true;
}
}
if (!pawns[1][pawn_col]) {
if (backwards) {
score = score + 3;
}
if (isolated) {
score = score + 5;
}
}
if (pawns[0][pawn_col] > 1) {
score = score + (2 * (pawns[0][pawn_col] - 1));
}
if (!((!pawns[1][pawn_col]) ? ((white_back_pawn[pawn_col - 1] >= row) ? (white_back_pawn[pawn_col + 1] < row) : true) : true)) {
score = score - black_pawn[i];
if (!isolated) {
score = score - 10;
}
}
}
// unexpected jump
if (Piece.Clr == "W") {
if (row == 7) {
score = score + 8;
}
if (!pawns[1][pawn_col]) {
score = score + 5;
if (!pawns[0][pawn_col]) {
score = score + 3;
}
}
} else {
if (row == 2) {
score = score - 8;
}
if (!pawns[0][pawn_col]) {
score = score - 5;
if (!pawns[1][pawn_col]) {
score = score - 3;
}
}
}
// unexpected jump
score = score + (bishop[i] * ClrSign);
// unexpected jump
score = score + (knight[i] * ClrSign);
// unexpected jump
if (Piece.Clr == "W") {
if (Piece.MovedQ) {
if (!(HasMoved("WN0") ? (HasMoved("WB0") ? (HasMoved("WB1") ? HasMoved("WN1") : false) : false) : false)) {
score = score - 4;
}
}
} else if (Piece.MovedQ) {
if (!(HasMoved("BN0") ? (HasMoved("BB0") ? (HasMoved("BB1") ? HasMoved("BN1") : false) : false) : false)) {
score = score + 4;
}
}
// unexpected jump
}
}
}
}
}
} else {
if (Piece.Clr == "W") {
isolated = false;
backwards = false;
score = score + white_pawn[i];
if (!((white_back_pawn[pawn_col + 1] > row) ? (white_back_pawn[pawn_col - 1] <= row) : true)) {
if (row != 2) {
score = score - 3;
}
backwards = true;
if (!((!pawns[1][pawn_col + 1]) ? (pawns[1][pawn_col - 1]) : true)) {
score = score - 2;
isolated = true;
}
}
if (!pawns[0][pawn_col]) {
if (backwards) {
score = score - 3;
}
if (isolated) {
score = score - 5;
}
}
if (pawns[1][pawn_col] > 1) {
score = score - (2 * (pawns[1][pawn_col] - 1));
}
if (!((!pawns[0][pawn_col]) ? (((row >= black_back_pawn[pawn_col - 1]) ? (row < black_back_pawn[pawn_col + 1]) : true)) : true)) {
score = score + white_pawn[i];
if (!isolated) {
score = score + 10;
}
}
} else {
isolated = false;
backwards = false;
score = score - black_pawn[i];
if (!((black_back_pawn[pawn_col + 1] < row) ? (black_back_pawn[pawn_col - 1] >= row) : true)) {
if (row != 2) {
score = score + 3;
}
backwards = true;
if (!((!pawns[0][pawn_col + 1]) ? (pawns[0][pawn_col - 1]) : true)) {
score = score + 2;
isolated = true;
}
}
if (!pawns[1][pawn_col]) {
if (backwards) {
score = score + 3;
}
if (isolated) {
score = score + 5;
}
}
if (pawns[0][pawn_col] > 1) {
score = score + (2 * (pawns[0][pawn_col] - 1));
}
if (!((!pawns[1][pawn_col]) ? (((white_back_pawn[pawn_col - 1] >= row) ? (white_back_pawn[pawn_col + 1] < row) : true)) : true)) {
score = score - black_pawn[i];
if (!isolated) {
score = score - 10;
}
}
}
// unexpected jump
if (Piece.Clr == "W") {
if (row == 7) {
score = score + 8;
}
if (!pawns[1][pawn_col]) {
score = score + 5;
if (!pawns[0][pawn_col]) {
score = score + 3;
}
}
} else {
if (row == 2) {
score = score - 8;
}
if (!pawns[0][pawn_col]) {
score = score - 5;
if (!pawns[1][pawn_col]) {
score = score - 3;
}
}
}
// unexpected jump
score = score + (bishop[i] * ClrSign);
// unexpected jump
score = score + (knight[i] * ClrSign);
// unexpected jump
if (Piece.Clr == "W") {
if (Piece.MovedQ) {
if (!(HasMoved("WN0") ? ((HasMoved("WB0") ? ((HasMoved("WB1") ? (HasMoved("WN1")) : false)) : false)) : false)) {
score = score - 4;
}
}
} else if (Piece.MovedQ) {
if (!(HasMoved("BN0") ? ((HasMoved("BB0") ? ((HasMoved("BB1") ? (HasMoved("BN1")) : false)) : false)) : false)) {
score = score + 4;
}
}
// unexpected jump
if (_root.IsThreatened(Piece.row, Piece.col, Piece.Clr)) {
score = score - (100 * ClrSign);
}
if (Piece.Clr == "W") {
score = score + white_king[i];
if (Piece.CastledQ) {
score = score + 120;
} else if (Piece.MovedQ) {
score = score - 4;
if (!pawns[1][pawn_col]) {
score = score - 6;
}
}
if (!((row < white_back_pawn[pawn_col]) ? (!pawns[1][pawn_col]) : true)) {
score = score - (5 * ((white_back_pawn[pawn_col] - row)-1));
} else {
score = score - 8;
}
if (!((row < white_back_pawn[pawn_col + 1]) ? (!pawns[1][pawn_col + 1]) : true)) {
score = score - (4 * ((white_back_pawn[pawn_col + 1] - row)-1));
} else {
score = score - 8;
}
if (!((row < white_back_pawn[pawn_col - 1]) ? (!pawns[1][pawn_col - 1]) : true)) {
score = score - (4 * ((white_back_pawn[pawn_col - 1] - row)-1));
} else {
score = score - 8;
}
} else {
score = score - black_king[i];
if (Piece.CastledQ) {
score = score - 120;
} else if (Piece.MovedQ) {
score = score + 4;
if (!pawns[0][pawn_col]) {
score = score + 6;
}
}
if (!((row > black_back_pawn[pawn_col]) ? (!pawns[0][pawn_col]) : true)) {
score = score + (5 * ((row - black_back_pawn[pawn_col])-1));
} else {
score = score + 8;
}
if (!((row > black_back_pawn[pawn_col + 1]) ? (!pawns[0][pawn_col + 1]) : true)) {
score = score + (4 * ((row - black_back_pawn[pawn_col + 1])-1));
} else {
score = score + 8;
}
if (!((row > black_back_pawn[pawn_col - 1]) ? (!pawns[0][pawn_col - 1]) : true)) {
score = score + (4 * ((row - black_back_pawn[pawn_col - 1])-1));
} else {
score = score + 8;
}
}
}
prevscore = score;
}
if (!((!HasMoved("WP3")) ? (_root.Board[2][3] == null) : true)) {
score = score - 7;
}
if (!((!HasMoved("WP4")) ? (_root.Board[2][4] == null) : true)) {
score = score - 7;
}
if (!((!HasMoved("BP3")) ? (_root.Board[5][3] == null) : true)) {
score = score + 7;
}
if (!((!HasMoved("BP4")) ? (_root.Board[5][4] == null) : true)) {
score = score + 7;
}
wking_pawn_col = _root.PieceArr.WK0.col;
bking_pawn_col = _root.PieceArr.BK0.col;
if (Math.abs(wking_pawn_col - bking_pawn_col) > 2) {
score = score - (rev_row[black_back_pawn[wking_pawn_col]] - 2);
score = score - (rev_row[black_back_pawn[wking_pawn_col + 1]] - 2);
score = score - (rev_row[black_back_pawn[wking_pawn_col - 1]] - 2);
score = score + (white_back_pawn[bking_pawn_col] - 2);
score = score + (white_back_pawn[bking_pawn_col + 1] - 2);
score = score + (white_back_pawn[bking_pawn_col - 1] - 2);
if (!pawns[0][wking_pawn_col]) {
score = score - 6;
}
if (!pawns[0][wking_pawn_col + 1]) {
score = score - 4;
}
if (!pawns[0][wking_pawn_col - 1]) {
score = score - 4;
}
if (!pawns[1][bking_pawn_col]) {
score = score + 6;
}
if (!pawns[1][bking_pawn_col + 1]) {
score = score + 4;
}
if (!pawns[1][bking_pawn_col - 1]) {
score = score + 4;
}
}
return(score);
}
}
// unexpected jump
// unexpected jump
function mid_eval() {
tellTarget (getProperty("..", _target)) {
delete _global.__resolve;
var i;
var pawn_col;
_global.__resolve = _global.__debugResolve;
var pawns = new Array();
var white_back_pawn = new Array();
var black_back_pawn = new Array();
delete _global.__resolve;
var row;
var wking_pawn_col;
var bking_pawn_col;
var j;
_global.__resolve = _global.__debugResolve;
var score = 0;
delete _global.__resolve;
var isolated;
var backwards;
_global.__resolve = _global.__debugResolve;
pawns[0] = new Array();
pawns[1] = new Array();
i = 0;
for ( ; i < 8 ; i++) {
pawns[0][i] = 0;
pawns[1][i] = 0;
white_back_pawn[i] = 7;
black_back_pawn[i] = 2;
}
for (varname in _root.PieceArr) {
Piece = _root.PieceArr[varname];
if (Piece.col < 0) {
continue;
}
if (Piece.PieceType == "P") {
i = (Piece.row * 8) + Piece.col;
pawn_col = Piece.col + 1;
row = Piece.row + 1;
if (Piece.Clr == "W") {
pawns[1][pawn_col]++;
if (row < white_back_pawn[pawn_col]) {
white_back_pawn[pawn_col] = row;
}
} else {
pawns[0][pawn_col]++;
if (row > black_back_pawn[pawn_col]) {
black_back_pawn[pawn_col] = row;
}
}
}
}
var prevscore = 0;
for (varname in _root.PieceArr) {
Piece = _root.PieceArr[varname];
if (Piece.col < 0) {
continue;
}
i = (Piece.row * 8) + Piece.col;
pawn_col = Piece.col + 1;
row = Piece.row + 1;
var ClrSign = ((Piece.Clr == "W") ? 1 : -1);
Piece.PieceType;
if (Piece.PieceType != "P") {
if (Piece.PieceType != "R") {
if (Piece.PieceType != "B") {
if (Piece.PieceType != "N") {
if (Piece.PieceType != "Q") {
if (Piece.PieceType != "K") {
// unexpected jump
if (Piece.Clr == "W") {
isolated = false;
backwards = false;
score = score + white_pawn[i];
if (!((white_back_pawn[pawn_col + 1] > row) ? (white_back_pawn[pawn_col - 1] <= row) : true)) {
score = score - 5;
backwards = true;
if (!((!pawns[1][pawn_col + 1]) ? pawns[1][pawn_col - 1] : true)) {
score = score - 3;
isolated = true;
}
}
if (!pawns[0][pawn_col]) {
if (backwards) {
score = score - 4;
}
if (isolated) {
score = score - 8;
}
}
if (pawns[1][pawn_col] > 1) {
score = score - (2 * (pawns[1][pawn_col] - 1));
}
if (!((!pawns[0][pawn_col]) ? ((row >= black_back_pawn[pawn_col - 1]) ? (row < black_back_pawn[pawn_col + 1]) : true) : true)) {
score = score + (2 * white_pawn[i]);
if (!isolated) {
score = score + 15;
}
}
} else {
isolated = false;
backwards = false;
score = score - black_pawn[i];
if (!((black_back_pawn[pawn_col + 1] < row) ? (black_back_pawn[pawn_col - 1] >= row) : true)) {
score = score + 5;
backwards = true;
if (!((!pawns[0][pawn_col + 1]) ? pawns[0][pawn_col - 1] : true)) {
score = score + 3;
isolated = true;
}
}
if (!pawns[1][pawn_col]) {
if (backwards) {
score = score + 4;
}
if (isolated) {
score = score + 8;
}
}
if (pawns[0][pawn_col] > 1) {
score = score + (2 * (pawns[0][pawn_col] - 1));
}
if (!((!pawns[1][pawn_col]) ? ((white_back_pawn[pawn_col - 1] >= row) ? (white_back_pawn[pawn_col + 1] < row) : true) : true)) {
score = score - (2 * black_pawn[i]);
if (!isolated) {
score = score - 15;
}
}
}
// unexpected jump
if (Piece.Clr == "W") {
if (row == 7) {
score = score + 8;
}
if (!pawns[1][pawn_col]) {
score = score + 5;
if (!pawns[0][pawn_col]) {
score = score + 3;
}
}
} else {
if (row == 2) {
score = score - 8;
}
if (!pawns[0][pawn_col]) {
score = score - 5;
if (!pawns[1][pawn_col]) {
score = score - 3;
}
}
}
// unexpected jump
score = score + (bishop[i] * ClrSign);
// unexpected jump
score = score + (knight[i] * ClrSign);
// unexpected jump
// unexpected jump
}
}
}
}
}
} else {
if (Piece.Clr == "W") {
isolated = false;
backwards = false;
score = score + white_pawn[i];
if (!((white_back_pawn[pawn_col + 1] > row) ? (white_back_pawn[pawn_col - 1] <= row) : true)) {
score = score - 5;
backwards = true;
if (!((!pawns[1][pawn_col + 1]) ? (pawns[1][pawn_col - 1]) : true)) {
score = score - 3;
isolated = true;
}
}
if (!pawns[0][pawn_col]) {
if (backwards) {
score = score - 4;
}
if (isolated) {
score = score - 8;
}
}
if (pawns[1][pawn_col] > 1) {
score = score - (2 * (pawns[1][pawn_col] - 1));
}
if (!((!pawns[0][pawn_col]) ? (((row >= black_back_pawn[pawn_col - 1]) ? (row < black_back_pawn[pawn_col + 1]) : true)) : true)) {
score = score + (2 * white_pawn[i]);
if (!isolated) {
score = score + 15;
}
}
} else {
isolated = false;
backwards = false;
score = score - black_pawn[i];
if (!((black_back_pawn[pawn_col + 1] < row) ? (black_back_pawn[pawn_col - 1] >= row) : true)) {
score = score + 5;
backwards = true;
if (!((!pawns[0][pawn_col + 1]) ? (pawns[0][pawn_col - 1]) : true)) {
score = score + 3;
isolated = true;
}
}
if (!pawns[1][pawn_col]) {
if (backwards) {
score = score + 4;
}
if (isolated) {
score = score + 8;
}
}
if (pawns[0][pawn_col] > 1) {
score = score + (2 * (pawns[0][pawn_col] - 1));
}
if (!((!pawns[1][pawn_col]) ? (((white_back_pawn[pawn_col - 1] >= row) ? (white_back_pawn[pawn_col + 1] < row) : true)) : true)) {
score = score - (2 * black_pawn[i]);
if (!isolated) {
score = score - 15;
}
}
}
// unexpected jump
if (Piece.Clr == "W") {
if (row == 7) {
score = score + 8;
}
if (!pawns[1][pawn_col]) {
score = score + 5;
if (!pawns[0][pawn_col]) {
score = score + 3;
}
}
} else {
if (row == 2) {
score = score - 8;
}
if (!pawns[0][pawn_col]) {
score = score - 5;
if (!pawns[1][pawn_col]) {
score = score - 3;
}
}
}
// unexpected jump
score = score + (bishop[i] * ClrSign);
// unexpected jump
score = score + (knight[i] * ClrSign);
// unexpected jump
// unexpected jump
if (Piece.Clr == "W") {
score = score + white_king[i];
if (Piece.HasCastledQ) {
score = score + 20;
} else if (Piece.MovedQ) {
score = score - 7;
if (!pawns[1][pawn_col]) {
score = score - 8;
}
}
if (!((row < white_back_pawn[pawn_col]) ? (!pawns[1][pawn_col]) : true)) {
score = score - (8 * ((white_back_pawn[pawn_col] - row)-1));
} else {
score = score - 12;
}
if (!((row < white_back_pawn[pawn_col + 1]) ? (!pawns[1][pawn_col + 1]) : true)) {
score = score - (7 * ((white_back_pawn[pawn_col + 1] - row)-1));
} else {
score = score - 12;
}
if (!((row < white_back_pawn[pawn_col - 1]) ? (!pawns[1][pawn_col - 1]) : true)) {
score = score - (7 * ((white_back_pawn[pawn_col - 1] - row)-1));
} else {
score = score - 12;
}
} else {
score = score - black_king[i];
if (Piece.HasCastledQ) {
score = score - 20;
} else if (Piece.MovedQ) {
score = score + 7;
if (!pawns[0][pawn_col]) {
score = score + 8;
}
}
if (!((row > black_back_pawn[pawn_col]) ? (!pawns[0][pawn_col]) : true)) {
score = score + (8 * ((row - black_back_pawn[pawn_col])-1));
} else {
score = score + 12;
}
if (!((row > black_back_pawn[pawn_col + 1]) ? (!pawns[0][pawn_col + 1]) : true)) {
score = score + (7 * ((row - black_back_pawn[pawn_col + 1])-1));
} else {
score = score + 12;
}
if (!((row > black_back_pawn[pawn_col - 1]) ? (!pawns[0][pawn_col - 1]) : true)) {
score = score + (7 * ((row - black_back_pawn[pawn_col - 1])-1));
} else {
score = score + 12;
}
}
}
prevscore = score;
}
if (!((!HasMoved("WP3")) ? (_root.Board[2][3] == null) : true)) {
score = score - 5;
}
if (!((!HasMoved("WP4")) ? (_root.Board[2][4] == null) : true)) {
score = score - 5;
}
if (!((!HasMoved("BP3")) ? (_root.Board[5][3] == null) : true)) {
score = score + 5;
}
if (!((!HasMoved("BP4")) ? (_root.Board[5][4] == null) : true)) {
score = score + 5;
}
wking_pawn_col = _root.PieceArr.WK0.col;
bking_pawn_col = _root.PieceArr.BK0.col;
if (Math.abs(wking_pawn_col - bking_pawn_col) > 2) {
score = score - (3 * (rev_row[black_back_pawn[wking_pawn_col]] - 2));
score = score - (3 * (rev_row[black_back_pawn[wking_pawn_col + 1]] - 2));
score = score - (3 * (rev_row[black_back_pawn[wking_pawn_col - 1]] - 2));
score = score + (3 * (white_back_pawn[bking_pawn_col] - 2));
score = score + (3 * (white_back_pawn[bking_pawn_col + 1] - 2));
score = score + (3 * (white_back_pawn[bking_pawn_col - 1] - 2));
if (!pawns[0][wking_pawn_col]) {
score = score - 8;
}
if (!pawns[0][wking_pawn_col + 1]) {
score = score - 6;
}
if (!pawns[0][wking_pawn_col - 1]) {
score = score - 6;
}
if (!pawns[1][bking_pawn_col]) {
score = score + 8;
}
if (!pawns[1][bking_pawn_col + 1]) {
score = score + 6;
}
if (!pawns[1][bking_pawn_col - 1]) {
score = score + 6;
}
}
if (!((score > 90) ? (start_piece_count >= piece_count) : true)) {
score = score + 10;
} else if (!((score < 90) ? (start_piece_count >= piece_count) : true)) {
score = score - 10;
}
return(score);
}
}
// unexpected jump
// unexpected jump
function end_eval() {
tellTarget (getProperty("..", _target)) {
delete _global.__resolve;
var i;
var pawn_col;
_global.__resolve = _global.__debugResolve;
var pawns = new Array();
var white_back_pawn = new Array();
var black_back_pawn = new Array();
delete _global.__resolve;
var row;
var j;
_global.__resolve = _global.__debugResolve;
var score = 0;
delete _global.__resolve;
var isolated;
var backwards;
_global.__resolve = _global.__debugResolve;
pawns[0] = new Array();
pawns[1] = new Array();
i = 0;
for ( ; i < 8 ; i++) {
pawns[0][i] = 0;
pawns[1][i] = 0;
white_back_pawn[i] = 7;
black_back_pawn[i] = 2;
}
for (varname in _root.PieceArr) {
Piece = _root.PieceArr[varname];
if (Piece.col < 0) {
continue;
}
if (Piece.PieceType == "P") {
i = (Piece.row * 8) + Piece.col;
pawn_col = Piece.col + 1;
row = Piece.row + 1;
if (Piece.Clr == "W") {
pawns[1][pawn_col]++;
if (row < white_back_pawn[pawn_col]) {
white_back_pawn[pawn_col] = row;
}
} else {
pawns[0][pawn_col]++;
if (row > black_back_pawn[pawn_col]) {
black_back_pawn[pawn_col] = row;
}
}
}
}
var prevscore = 0;
for (varname in _root.PieceArr) {
Piece = _root.PieceArr[varname];
if (Piece.col < 0) {
continue;
}
i = (Piece.row * 8) + Piece.col;
pawn_col = Piece.col + 1;
row = Piece.row + 1;
var ClrSign = ((Piece.Clr == "W") ? 1 : -1);
Piece.PieceType;
if (Piece.PieceType != "P") {
if (Piece.PieceType != "R") {
if (Piece.PieceType != "B") {
if (Piece.PieceType != "N") {
if (Piece.PieceType != "Q") {
if (Piece.PieceType != "K") {
// unexpected jump
if (Piece.Clr == "W") {
isolated = false;
backwards = false;
score = score + white_pawn[i];
if (!((white_back_pawn[pawn_col + 1] > row) ? (white_back_pawn[pawn_col - 1] <= row) : true)) {
score = score - 8;
backwards = true;
if (!((!pawns[1][pawn_col + 1]) ? pawns[1][pawn_col - 1] : true)) {
score = score - 5;
isolated = true;
}
}
if (!pawns[0][pawn_col]) {
if (backwards) {
score = score - 3;
}
if (isolated) {
score = score - 5;
}
}
if (pawns[1][pawn_col] > 1) {
score = score - (3 * (pawns[1][pawn_col] - 1));
}
if (!((!pawns[0][pawn_col]) ? ((row >= black_back_pawn[pawn_col - 1]) ? (row < black_back_pawn[pawn_col + 1]) : true) : true)) {
score = score + (3 * white_pawn[i]);
if (!isolated) {
score = score + 18;
}
}
} else {
isolated = false;
backwards = false;
score = score - black_pawn[i];
if (!((black_back_pawn[pawn_col + 1] < row) ? (black_back_pawn[pawn_col - 1] >= row) : true)) {
score = score + 8;
backwards = true;
if (!((!pawns[0][pawn_col + 1]) ? pawns[0][pawn_col - 1] : true)) {
score = score + 5;
isolated = true;
}
}
if (!pawns[1][pawn_col]) {
if (backwards) {
score = score + 3;
}
if (isolated) {
score = score + 5;
}
}
if (pawns[0][pawn_col] > 1) {
score = score + (3 * (pawns[0][pawn_col] - 1));
}
if (!((!pawns[1][pawn_col]) ? ((white_back_pawn[pawn_col - 1] >= row) ? (white_back_pawn[pawn_col + 1] < row) : true) : true)) {
score = score - (3 * black_pawn[i]);
if (!isolated) {
score = score - 18;
}
}
}
// unexpected jump
if (Piece.Clr == "W") {
if (row == 7) {
score = score + 12;
}
if (!pawns[1][pawn_col]) {
score = score + 5;
if (!pawns[0][pawn_col]) {
score = score + 3;
}
}
} else {
if (row == 2) {
score = score - 12;
}
if (!pawns[0][pawn_col]) {
score = score - 5;
if (!pawns[1][pawn_col]) {
score = score - 3;
}
}
}
// unexpected jump
score = score + (bishop[i] * ClrSign);
// unexpected jump
score = score + (knight[i] * ClrSign);
// unexpected jump
// unexpected jump
}
}
}
}
}
} else {
if (Piece.Clr == "W") {
isolated = false;
backwards = false;
score = score + white_pawn[i];
if (!((white_back_pawn[pawn_col + 1] > row) ? (white_back_pawn[pawn_col - 1] <= row) : true)) {
score = score - 8;
backwards = true;
if (!((!pawns[1][pawn_col + 1]) ? (pawns[1][pawn_col - 1]) : true)) {
score = score - 5;
isolated = true;
}
}
if (!pawns[0][pawn_col]) {
if (backwards) {
score = score - 3;
}
if (isolated) {
score = score - 5;
}
}
if (pawns[1][pawn_col] > 1) {
score = score - (3 * (pawns[1][pawn_col] - 1));
}
if (!((!pawns[0][pawn_col]) ? (((row >= black_back_pawn[pawn_col - 1]) ? (row < black_back_pawn[pawn_col + 1]) : true)) : true)) {
score = score + (3 * white_pawn[i]);
if (!isolated) {
score = score + 18;
}
}
} else {
isolated = false;
backwards = false;
score = score - black_pawn[i];
if (!((black_back_pawn[pawn_col + 1] < row) ? (black_back_pawn[pawn_col - 1] >= row) : true)) {
score = score + 8;
backwards = true;
if (!((!pawns[0][pawn_col + 1]) ? (pawns[0][pawn_col - 1]) : true)) {
score = score + 5;
isolated = true;
}
}
if (!pawns[1][pawn_col]) {
if (backwards) {
score = score + 3;
}
if (isolated) {
score = score + 5;
}
}
if (pawns[0][pawn_col] > 1) {
score = score + (3 * (pawns[0][pawn_col] - 1));
}
if (!((!pawns[1][pawn_col]) ? (((white_back_pawn[pawn_col - 1] >= row) ? (white_back_pawn[pawn_col + 1] < row) : true)) : true)) {
score = score - (3 * black_pawn[i]);
if (!isolated) {
score = score - 18;
}
}
}
// unexpected jump
if (Piece.Clr == "W") {
if (row == 7) {
score = score + 12;
}
if (!pawns[1][pawn_col]) {
score = score + 5;
if (!pawns[0][pawn_col]) {
score = score + 3;
}
}
} else {
if (row == 2) {
score = score - 12;
}
if (!pawns[0][pawn_col]) {
score = score - 5;
if (!pawns[1][pawn_col]) {
score = score - 3;
}
}
}
// unexpected jump
score = score + (bishop[i] * ClrSign);
// unexpected jump
score = score + (knight[i] * ClrSign);
// unexpected jump
// unexpected jump
score = score + (end_king[i] * ClrSign);
}
}
if (!((score > 90) ? (start_piece_count >= piece_count) : true)) {
score = score + 10;
} else if (!((score < 90) ? (start_piece_count >= piece_count) : true)) {
score = score - 10;
}
return(score);
}
}
// unexpected jump
// unexpected jump
Init();
// unexpected jump
// unexpected jump
};
stop();
Symbol 149 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function alphaBeta(depth, alpha, beta, Clr) {
tellTarget (getProperty("..", _target)) {
if (!((depth != 0) ? (!_root.TimesUpQ) : false)) {
var val = _root.EvalF.GetScore(Clr);
return([val, null]);
}
var Elapsed = ((getTimer() - TimeStt) / 1000);
if (Elapsed > 12.9) {
var val = _root.EvalF.GetScore(Clr);
return([val, null]);
}
var posmoves = _root.FillMovesRP(Clr);
var SortedMoves = new Array();
var i = 0;
for ( ; i < posmoves.length ; i++) {
var Move = posmoves[i];
var MoveName = ((Move[4]._name + Move[2]) + Move[3]);
if (MoveScoreArr[MoveName] != null) {
Score = -MoveScoreArr[MoveName];
} else {
Score = i;
}
SortedMoves[i] = {sortby:Score, moveno:i};
}
SortedMoves.sortOn("sortby");
var value = 0;
var bestmove = null;
var i = 0;
for ( ; i < posmoves.length ; i++) {
var Move = posmoves[SortedMoves[i].moveno];
var MovedArr = Move[4].PieceFinishMove(move[2], move[3]);
var KingPiece = _root.PieceArr[Clr + "K0"];
if (_root.IsThreatened(KingPiece.row, KingPiece.col, Clr)) {
value = alpha;
} else {
var Rtn = alphaBeta(depth - 1, -beta, -alpha, _root.OtherClr(Clr));
value = -Rtn[0];
}
var MoveName = ((Move[4]._name + Move[2]) + Move[3]);
MoveScoreArr[MoveName] = value;
_root.UndoMoves(MovedArr);
if (value > alpha) {
bestmove = Move;
alpha = value;
if (alpha >= beta) {
break;
}
}
}
return([alpha, bestmove]);
}
}
}
} else {
// unexpected jump
}
function GetBestMove(Clr) {
tellTarget (getProperty("..", _target)) {
TimeStt = getTimer();
MoveScoreArr = new Array();
var Rtn = alphaBeta(2, -99999, 99999, Clr);
Move = Rtn[1];
var Elapsed = ((getTimer() - TimeStt) / 1000);
return(Move);
}
}
// unexpected jump
// unexpected jump
function Indent(depth) {
tellTarget (getProperty("..", _target)) {
var s = "";
var i = 0;
for ( ; i < (2 - depth) ; i++) {
s = s + " ";
}
return(s);
}
}
// unexpected jump
// unexpected jump
};
stop();
Symbol 154 Button
on (release) {
getURL("http://www.mathsisfun.com");
}
Symbol 155 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function DoMoves() {
tellTarget (getProperty("..", _target)) {
var MoveStr = "f4 Nf6,Nc3 Nc6,e4 Nd4,Nf3 Nxf3+,Qxf3 c5,Bc4 d6";
var MoveStr = "f4 Nf6,Nc3 Nc6,e4 Nd4";
MoveStr = MoveStr.split(" ").join(" ");
MovePairs = MoveStr.split(",");
MoveNo = 0;
gotoAndPlay(10);
}
}
}
} else {
// unexpected jump
}
function DoMove(Clr, MoveStr) {
tellTarget (getProperty("..", _target)) {
if (MoveStr.length == 0) {
return(undefined);
}
_root.Debug = "";
_root.CurrClr = Clr;
_root.MoveNo.text = MoveNo + 1;
var xrc = "";
var r = "";
var c = "";
var p = "";
var FromCol = -1;
MoveStr.charAt(0);
if (MoveStr.charAt(0) != "R") {
if (MoveStr.charAt(0) != "N") {
if (MoveStr.charAt(0) != "B") {
if (MoveStr.charAt(0) != "Q") {
if (MoveStr.charAt(0) != "K") {
// unexpected jump
}
}
}
}
} else {
p = MoveStr.charAt(0);
xrc = MoveStr.substr(1);
// unexpected jump
}
p = "P";
xrc = MoveStr;
if (xrc.charAt(0) == "x") {
xrc = xrc.substr(1);
}
if (xrc.charAt(1) == "x") {
p = "P";
FromCol = ord(xrc.charAt(0)) - 97;
xrc = xrc.substr(2);
}
r = xrc.charAt(0);
c = xrc.charAt(1);
var NewCol = (ord(r) - 97);
var NewRow = (c - 1);
delete _global.__resolve;
var varname;
_global.__resolve = _global.__debugResolve;
for (varname in _root.PieceArr) {
var Piece = _root.PieceArr[varname];
if (Piece.Clr == Clr) {
if (!((FromCol >= 0) ? (Piece.col != FromCol) : false)) {
if (Piece.PieceType == p) {
if (Piece.PieceCanMove(NewRow, NewCol)) {
var WasRow = Piece.row;
var WasCol = Piece.col;
Piece.PieceFinishMove(NewRow, NewCol);
_root.History([WasRow, WasCol, NewRow, NewCol, Piece]);
_root.CurrClr = _root.OtherClr(Clr);
}
}
}
}
}
}
}
// unexpected jump
// unexpected jump
// unexpected jump
// unexpected jump
};
stop();
Symbol 156 MovieClip Frame 1
stop();
Symbol 156 MovieClip Frame 10
_root.ScrollDebug();
var _local1 = mblength(MovePairs[MoveNo]);
var _local2 = 1;
while (_local1 >= _local2) {
if ((mbsubstring(MovePairs[MoveNo], _local2, 2)) ge "!") {
_local1 = mblength(mbsubstring(MovePairs[MoveNo], _local2, 2147483647));
// unexpected jump
}
_local2++;
}
// unexpected jump
_local2 = _local1;
while (_local2 >= 1) {
if ((mbsubstring(MovePairs[MoveNo], _local2, 1)) ge "!") {
(mbsubstring(MovePairs[MoveNo], 0, _local2));// not popped
// unexpected jump
}
_local2--;
}
Set(1, "".split());
DoMove("W", MovePair[0]);
Symbol 156 MovieClip Frame 15
DoMove("B", MovePair[1]);
Symbol 156 MovieClip Frame 20
MoveNo++;
if (MoveNo >= MovePairs.length) {
gotoAndStop(1);
}
gotoAndPlay(10);
Symbol 157 MovieClip Frame 1
if (!hasOwnProperty("_load")) {
_load = true;
tellTarget ("..") {
function Here(TheLocn) {
tellTarget (getProperty("..", _target)) {
if (TheLocn == "Start") {
HereCount = 0;
}
if (_root.HereCount < 30000) {
HereLocn[HereCount] = TheLocn;
HereWhen[HereCount] = getTimer();
HereCount++;
}
if (TheLocn == "End") {
var HereObjCount = 0;
HereObj = new Array();
var i = 0;
for ( ; i < HereCount ; i++) {
if (i != 0) {
Elapsed = HereWhen[i] - HereWhen[i - 1];
LocnPrev = HereLocn[i - 1];
} else {
Elapsed = 0;
LocnPrev = "Start";
}
FoundQ = false;
var j = 1;
for ( ; HereObjCount >= j ; j++) {
if (HereLocn[i] == HereObj[j].LocnNow) {
if (LocnPrev == HereObj[j].LocnPrev) {
HereObj[j].Count = HereObj[j].Count + 1;
HereObj[j].Elapsed = HereObj[j].Elapsed + Elapsed;
FoundQ = true;
}
}
}
if (!FoundQ) {
HereObj[HereObjCount] = [HereType];
j = HereObjCount;
HereObj[HereObjCount].Count = 1;
HereObj[HereObjCount].Elapsed = Elapsed;
HereObj[HereObjCount].LocnNow = HereLocn[i];
HereObj[HereObjCount].LocnPrev = LocnPrev;
HereObjCount++;
}
}
var j = 0;
for ( ; j < HereObjCount ; j++) {
_root.Debug = _root.Debug + newline;
_root.Debug = _root.Debug + ((((((((((HereObj[j].LocnPrev + ", ") + HereObj[j].LocnNow) + ", ") + HereObj[j].Count) + ", ") + HereObj[j].Elapsed) + "ms") + ", (") + (HereObj[j].Elapsed / HereObj[j].Count)) + "ms)");
}
Count = 0;
}
}
}
}
} else {
// unexpected jump
}
HereCount = 0;
HereLocn = new Array();
HereWhen = new Array();
HereType = {Count:0, Elapsed:0, LocnPrev:"huh", LocnNow:"what"};
// unexpected jump
// unexpected jump
};
stop();