STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229494
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2575 · P5149

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/51608105?noj=FRM51608105-15DC" width="1" height="1"></div>

Flash Chess 3D.swf

This is the info page for
Flash #22628

(Click the ID number above for more basic data on this flash file.)


Text
thinking...

loading...

Featuring Digital Vision's FlashAI  and 3D Engine

©2002 Digital Vision Multimedia.
www.media-division.com

Choose AI playing mode:

• Shallow

for Pentium II-class  computers

- Game Tree depth 2

-requires medium computers

• Deep

for Pentium III/Athlon-class computers

- Game Tree depth 3

-requires fastcomputers

RESTART

YOU
MOVE

COMPUTER
MOVES

You Won !

Checkmate

Computer Won !

Pat !

You are in check !

Computer
is in check !

LAST MOVES

ActionScript [AS1/AS2]

Frame 2
stop();
Instance of Symbol 57 MovieClip "myscroll" in Frame 3
onClipEvent (enterFrame) { if (dragging == true) { _root.text.scroll = 1 + int(((_y - top) * totalLines) / (96.6 - _height)); } } onClipEvent (load) { update(); updateAfterEvent(); }
Frame 4
function MovementRules() { this.up = 0; this.down = 0; this.left = 0; this.right = 0; this.up_left = 0; this.up_right = 0; this.down_left = 0; this.down_right = 0; this.isKnight = false; this.isPawn = false; } function Move(firstPosX, firstPosY, lastPosX, lastPosY) { this.fPX = firstPosX; this.fPY = firstPosY; this.lPX = lastPosX; this.lPY = lastPosY; } function rulesFor(piece) { if ((piece == PAWN_W) || (piece == PAWN_B)) { return(pawnRules); } if ((piece == KNIGHT_W) || (piece == KNIGHT_B)) { return(knightRules); } if ((piece == ROOK_W) || (piece == ROOK_B)) { return(rookRules); } if ((piece == BISSHOP_W) || (piece == BISSHOP_B)) { return(bisshopRules); } if ((piece == QUEEN_W) || (piece == QUEEN_B)) { return(queenRules); } if ((piece == KING_W) || (piece == KING_B)) { return(kingRules); } } function initChessBoard() { chessBoard = new Array(8); chessBoard[0] = new Array(ROOK_B, KNIGHT_B, BISSHOP_B, QUEEN_B, KING_B, BISSHOP_B, KNIGHT_B, ROOK_B); chessBoard[1] = new Array(PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B); chessBoard[2] = new Array(VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID); chessBoard[3] = new Array(VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID); chessBoard[4] = new Array(VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID); chessBoard[5] = new Array(VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID); chessBoard[6] = new Array(PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W); chessBoard[7] = new Array(ROOK_W, KNIGHT_W, BISSHOP_W, QUEEN_W, KING_W, BISSHOP_W, KNIGHT_W, ROOK_W); var i = 0; while (i < 8) { var j = 0; while (j < 8) { _root[(("piece_" + i) + "_") + j].showPiece(chessBoard[i][j]); _root[(("piece_" + i) + "_") + j].row = i; _root[(("piece_" + i) + "_") + j].col = j; j++; } i++; } } function calculateMoves(row, col, side) { if (chessBoard[row][col] == VOID) { trace("Error: no piece to calculate moves for !!"); return(null); } var poMo = new Array(); rules = rulesFor(chessBoard[row][col]); var poTa; if (rules.isKnight) { var x = (row - 1); var y = (col + 2); if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } } x = row - 1; y = col - 2; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } } x = row + 1; y = col + 2; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } } x = row + 1; y = col - 2; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } } x = row - 2; y = col + 1; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } } x = row - 2; y = col - 1; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } } x = row + 2; y = col - 1; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } } x = row + 2; y = col + 1; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } } } else if (rules.isPawn) { if (side == SIDE_PLAYER) { var possibleEmpassant = false; var i = (row - 1); if (chessBoard[i][col] == VOID) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (i << 3)) | col; possibleEmpassant = true; } if ((row == 6) && (possibleEmpassant)) { i--; if (chessBoard[i][col] == VOID) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (i << 3)) | col; } } var x = (row - 1); var y = (col - 1); if (((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) && ((chessBoard[x][y] != VOID) && (side != (chessBoard[x][y] & 1)))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } var x = (row - 1); var y = (col + 1); if (((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) && ((chessBoard[x][y] != VOID) && (side != (chessBoard[x][y] & 1)))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } } else { var possibleEmpassant = false; var i = (row + 1); if (chessBoard[i][col] == VOID) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (i << 3)) | col; possibleEmpassant = true; } if ((row == 1) && (possibleEmpassant)) { i++; if (chessBoard[i][col] == VOID) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (i << 3)) | col; } } x = row + 1; y = col - 1; if (((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) && ((chessBoard[x][y] != VOID) && (side != (chessBoard[x][y] & 1)))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } x = row + 1; y = col + 1; if (((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) && ((chessBoard[x][y] != VOID) && (side != (chessBoard[x][y] & 1)))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (x << 3)) | y; } } } else { var delta = rules.up; var i = (row - 1); while ((0 < delta) && (i >= 0)) { if ((chessBoard[i][col] == VOID) || (side != (chessBoard[i][col] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (i << 3)) | col; } else { break; } if (chessBoard[i][col] != VOID) { break; } i--; delta--; } var delta = rules.down; var i = (row + 1); while ((0 < delta) && (i < 8)) { if ((chessBoard[i][col] == VOID) || (side != (chessBoard[i][col] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (i << 3)) | col; } else { break; } if (chessBoard[i][col] != VOID) { break; } i++; delta--; } var delta = rules.left; var j = (col - 1); while ((0 < delta) && (j >= 0)) { if ((chessBoard[row][j] == VOID) || (side != (chessBoard[row][j] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (row << 3)) | j; } else { break; } if (chessBoard[row][j] != VOID) { break; } j--; delta--; } var delta = rules.right; var j = (col + 1); while ((0 < delta) && (j < 8)) { if ((chessBoard[row][j] == VOID) || (side != (chessBoard[row][j] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (row << 3)) | j; } else { break; } if (chessBoard[row][j] != VOID) { break; } j++; delta--; } var delta = rules.up_left; var i = (row - 1); var j = (col - 1); while (((0 < delta) && (j >= 0)) && (i >= 0)) { if ((chessBoard[i][j] == VOID) || (side != (chessBoard[i][j] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (i << 3)) | j; } else { break; } if (chessBoard[i][j] != VOID) { break; } i--; j--; delta--; } var delta = rules.up_right; var i = (row - 1); var j = (col + 1); while (((0 < delta) && (j < 8)) && (i >= 0)) { if ((chessBoard[i][j] == VOID) || (side != (chessBoard[i][j] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (i << 3)) | j; } else { break; } if (chessBoard[i][j] != VOID) { break; } i--; j++; delta--; } var delta = rules.down_left; var i = (row + 1); var j = (col - 1); while (((0 < delta) && (j >= 0)) && (i < 8)) { if ((chessBoard[i][j] == VOID) || (side != (chessBoard[i][j] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (i << 3)) | j; } else { break; } if (chessBoard[i][j] != VOID) { break; } i++; j--; delta--; } var delta = rules.down_right; var i = (row + 1); var j = (col + 1); while (((0 < delta) && (j < 8)) && (i < 8)) { if ((chessBoard[i][j] == VOID) || (side != (chessBoard[i][j] & 1))) { poMo[poMo.length] = (((row << 9) | (col << 6)) | (i << 3)) | j; } else { break; } if (chessBoard[i][j] != VOID) { break; } i++; j++; delta--; } } return(poMo); } function checkChessState(side) { var row; var col; var i = 0; while (i < 8) { var j = 0; while (j < 8) { if (((chessBoard[i][j] & 1) == getOpponent(side)) && (chessBoard[i][j] != VOID)) { compMoves = calculateMoves(i, j, getOpponent(side)); var k = 0; while (k < compMoves.length) { row = (compMoves[k] >> 3) & 7; col = compMoves[k] & 7; if (((chessBoard[row][col] == KING_W) && (side == SIDE_PLAYER)) || ((chessBoard[row][col] == KING_B) && (side == SIDE_COMPUTER))) { if (side == SIDE_PLAYER) { kingInChess(row, col, side); } return(false); } k++; } } j++; } i++; } if (side == SIDE_PLAYER) { var totalMoves = 0; var i = 0; while (i < 8) { var j = 0; while (j < 8) { if (((chessBoard[i][j] & 1) == SIDE_PLAYER) && (chessBoard[i][j] != VOID)) { totalMoves = totalMoves + select(i, j, true); } j++; } i++; } if (totalMoves == 0) { invalidateAll(); messages.gotoAndStop("Pat"); } } return(true); } function computerLoose() { trace("ComputerLost"); invalidateAll(); messages.gotoAndStop(2); stop(); } function deselect(piece) { resetAllSelection(); pieceSelected = null; possiblePositions = null; } function displayMove(move, side) { var fPX = ((move >> 9) & 7); var fPY = ((move >> 6) & 7); var lPX = ((move >> 3) & 7); var lPY = (move & 7); var text = " "; if (side == SIDE_COMPUTER) { text = text + "Comp: "; } else { text = text + "You: "; } text = text + letters[fPY]; text = text + (9 - (fPX + 1)); text = text + " - "; text = text + letters[lPY]; text = text + (9 - (lPX + 1)); _root.myscroll.appendText(text); } function do_move(move, side) { var pieceCaptured = VOID; var fPX = ((move >> 9) & 7); var fPY = ((move >> 6) & 7); var lPX = ((move >> 3) & 7); var lPY = (move & 7); if (side == SIDE_COMPUTER) { if (chessBoard[lPX][lPY] != VOID) { pieceCaptured = chessBoard[lPX][lPY]; playerScore = playerScore - (chessBoard[lPX][lPY] >> 1); computerScore = computerScore + (chessBoard[lPX][lPY] >> 1); } chessBoard[lPX][lPY] = chessBoard[fPX][fPY]; chessBoard[fPX][fPY] = VOID; return(pieceCaptured); } if (chessBoard[lPX][lPY] != VOID) { pieceCaptured = chessBoard[lPX][lPY]; playerScore = playerScore + (chessBoard[lPX][lPY] >> 1); computerScore = computerScore - (chessBoard[lPX][lPY] >> 1); } chessBoard[lPX][lPY] = chessBoard[fPX][fPY]; chessBoard[fPX][fPY] = VOID; return(pieceCaptured); } function invalidateAll() { var i = 0; while (i < 8) { var j = 0; while (j < 8) { _root[(("piece_" + i) + "_") + j].marker.gotoAndStop("disabled"); j++; } i++; } } function movePlayer() { messages.gotoAndStop(0); resetAllSelection(); checkChessState(SIDE_PLAYER); signal.gotoAndStop("player"); } function moveRealPlayer(move, side) { var fPX = ((move >> 9) & 7); var fPY = ((move >> 6) & 7); var lPX = ((move >> 3) & 7); var lPY = (move & 7); if (pieceSelected == null) { trace("ERROR: no piece selected"); return(undefined); } if ((chessBoard[fPX][fPY] == KING_W) && (chessBoard[lPX][lPY] == ROOK_W)) { trace("rocade"); possibleRocade = false; chessBoard[fPX][fPY] = VOID; chessBoard[lPX][lPY] = VOID; if (fPY < lPY) { chessBoard[fPX][fPY + 2] = KING_W; chessBoard[fPX][fPY + 1] = ROOK_W; _root[(("piece_" + fPX) + "_") + (fPY + 1)].showPiece(chessBoard[fPX][fPY + 1]); _root[(("piece_" + fPX) + "_") + (fPY + 2)].showPiece(chessBoard[fPX][fPY + 2]); } else { chessBoard[fPX][fPY - 2] = KING_W; chessBoard[fPX][fPY - 1] = ROOK_W; _root[(("piece_" + fPX) + "_") + (fPY - 1)].showPiece(chessBoard[fPX][fPY - 1]); _root[(("piece_" + fPX) + "_") + (fPY - 2)].showPiece(chessBoard[fPX][fPY - 2]); } _root[(("piece_" + lPX) + "_") + lPY].showPiece(chessBoard[lPX][lPY]); _root[(("piece_" + fPX) + "_") + fPY].showPiece(chessBoard[fPX][fPY]); } else { if ((chessBoard[fPX][fPY] == KING_W) || (chessBoard[fPX][fPY] == ROOK_W)) { possibleRocade = false; } var target = chessBoard[lPX][lPY]; if (((target & 1) == SIDE_COMPUTER) && (target != VOID)) { trace("capture the computer piece"); } chessBoard[lPX][lPY] = chessBoard[fPX][fPY]; chessBoard[fPX][fPY] = VOID; _root[(("piece_" + lPX) + "_") + lPY].showPiece(chessBoard[lPX][lPY]); _root[(("piece_" + fPX) + "_") + fPY].showPiece(VOID); } invalidateAll(); if ((lPX == 0) && (chessBoard[lPX][lPY] == PAWN_W)) { trace("promotion"); chessBoard[lPX][lPY] = QUEEN_W; _root[(("piece_" + lPX) + "_") + lPY].showPiece(QUEEN_W); } displayMove(move, SIDE_PLAYER); gotoAndPlay (7); } function moveRealComputer(move) { var fPX = ((move >> 9) & 7); var fPY = ((move >> 6) & 7); var lPX = ((move >> 3) & 7); var lPY = (move & 7); var target = chessBoard[lPX][lPY]; if (((target & 1) == SIDE_PLAYER) && (target != VOID)) { trace("captures the player piece"); } chessBoard[lPX][lPY] = chessBoard[fPX][fPY]; chessBoard[fPX][fPY] = VOID; _root[(("piece_" + lPX) + "_") + lPY].showPiece(chessBoard[lPX][lPY]); _root[(("piece_" + fPX) + "_") + fPY].showPiece(VOID); if ((lPX == 7) && (chessBoard[lPX][lPY] == PAWN_B)) { trace("promotion"); chessBoard[lPX][lPY] = QUEEN_B; _root[(("piece_" + lPX) + "_") + lPY].showPiece(QUEEN_B); } displayMove(move, SIDE_COMPUTER); movePlayer(); } function resetAllSelection() { var i = 0; while (i < 8) { var j = 0; while (j < 8) { if ((chessBoard[i][j] == VOID) || ((chessBoard[i][j] & 1) == SIDE_COMPUTER)) { _root[(("piece_" + i) + "_") + j].marker.gotoAndStop("disabled"); } else { _root[(("piece_" + i) + "_") + j].marker.gotoAndStop("normal"); } j++; } i++; } } function select(row, col, real) { resetAllSelection(); var possibleMoves = calculateMoves(row, col, SIDE_PLAYER); if (possibleRocade && (real != true)) { if (chessBoard[row][col] == KING_W) { var k = col; var adv = true; while (adv) { k++; if (chessBoard[row][k] != VOID) { if (chessBoard[row][k] == ROOK_W) { if (verifyKingState((((row << 9) | (col << 6)) | (row << 3)) | (col + 2), SIDE_PLAYER)) { possibleMoves[possibleMoves.length] = (((row << 9) | (col << 6)) | (row << 3)) | k; } } adv = false; } } k = col; adv = true; while (adv) { k--; if (chessBoard[row][k] != VOID) { if (chessBoard[row][k] == ROOK_W) { if (verifyKingState((((row << 9) | (col << 6)) | (row << 3)) | (col - 2), SIDE_PLAYER)) { possibleMoves[possibleMoves.length] = (((row << 9) | (col << 6)) | (row << 3)) | k; } } adv = false; } } } } var validMoves = new Array(); var i = 0; while (i < possibleMoves.length) { if (verifyKingState(possibleMoves[i], SIDE_PLAYER)) { validMoves[validMoves.length] = possibleMoves[i]; } i++; } if (real != true) { var i = 0; while (i < validMoves.length) { _root[(("piece_" + ((validMoves[i] >> 3) & 7)) + "_") + (validMoves[i] & 7)].marker.gotoAndStop("selectedTo"); i++; } pieceSelected = _root[(("piece_" + row) + "_") + col]; } else { return(validMoves.length); } } function kingInChess(rowKing, colKing, side) { trace(" >>>> CHESS " + side); possibleRocade = false; if (side == SIDE_PLAYER) { messages.gotoAndStop("playerChess"); } else { messages.gotoAndStop("computerChess"); } var possibleMoves; var isChessMat = true; var i = 0; while (i < 8) { var j = 0; while (j < 8) { if (((chessBoard[i][j] & 1) == side) && (chessBoard[i][j] != VOID)) { possibleMoves = calculateMoves(i, j, side); disabled = true; var k = 0; while (k < possibleMoves.length) { if (verifyKingState(possibleMoves[k], side)) { isChessMat = false; } k++; } } j++; } i++; } if (isChessMat) { loose(side); } } function loose(side) { if (side == SIDE_COMPUTER) { computerLoose(); } else { playerLoose(); } } function playerLoose() { trace("Player Lost"); invalidateAll(); messages.gotoAndStop(3); stop(); } function search(side, depth, alpha, beta) { var bestScore = (-INFINITY); var aM = new Array(); var capturedPiece = null; var moveScore; var compMoves; var i = 0; while (i < 8) { var j = 0; while (j < 8) { if (((chessBoard[i][j] & 1) == side) && (chessBoard[i][j] != VOID)) { aM = aM.concat(calculateMoves(i, j, side)); } j++; } i++; } var i = 0; while (i < aM.length) { capturedPiece = do_move(aM[i], side); if (depth == 0) { moveScore = ((side == SIDE_COMPUTER) ? (computerScore) : (playerScore)); } else { moveScore = -search(getOpponent(side), depth - 1, -1 * beta, -1 * alpha); } undo_move(aM[i], side, capturedPiece); if (bestScore < moveScore) { bestScore = moveScore; } if (alpha < bestScore) { alpha = bestScore; } if (alpha >= beta) { return(alpha); } i++; } return(bestScore); } function shuffle(collection) { var nCollection = new Array(); var value; var val; while (collection.length != 0) { val = Math.round(Math.random() * (collection.length - 1)); value = collection[val]; collection.splice(val, 1); nCollection.push(value); } delete collection; return(nCollection); } function getOpponent(side) { if (side == SIDE_PLAYER) { return(SIDE_COMPUTER); } return(SIDE_PLAYER); } function undo_move(move, side, pieceCaptured) { var fPX = ((move >> 9) & 7); var fPY = ((move >> 6) & 7); var lPX = ((move >> 3) & 7); var lPY = (move & 7); if (side == SIDE_COMPUTER) { chessBoard[fPX][fPY] = chessBoard[lPX][lPY]; if (pieceCaptured != VOID) { chessBoard[lPX][lPY] = pieceCaptured; playerScore = playerScore + (chessBoard[lPX][lPY] >> 1); computerScore = computerScore - (chessBoard[lPX][lPY] >> 1); } else { chessBoard[lPX][lPY] = VOID; } } else { chessBoard[fPX][fPY] = chessBoard[lPX][lPY]; if (pieceCaptured != VOID) { chessBoard[lPX][lPY] = pieceCaptured; playerScore = playerScore - (chessBoard[lPX][lPY] >> 1); computerScore = computerScore + (chessBoard[lPX][lPY] >> 1); } else { chessBoard[lPX][lPY] = VOID; } } } function verifyKingState(move, side) { var capturedPiece; var compMoves; var row; var col; capturedPiece = do_move(move, side); var i = 0; while (i < 8) { var j = 0; while (j < 8) { if (((chessBoard[i][j] & 1) == getOpponent(side)) && (chessBoard[i][j] != VOID)) { compMoves = calculateMoves(i, j, getOpponent(side)); var k = 0; while (k < compMoves.length) { row = (compMoves[k] >> 3) & 7; col = compMoves[k] & 7; if (((chessBoard[row][col] == KING_W) && (side == SIDE_PLAYER)) || ((chessBoard[row][col] == KING_B) && (side == SIDE_COMPUTER))) { undo_move(move, side, capturedPiece); return(false); } k++; } } j++; } i++; } undo_move(move, side, capturedPiece); return(true); } VOID = -1; PAWN_W = 5; KNIGHT_W = 13; ROOK_W = 21; BISSHOP_W = 17; QUEEN_W = 29; KING_W = 2001; PAWN_B = 4; KNIGHT_B = 12; ROOK_B = 20; BISSHOP_B = 16; QUEEN_B = 28; KING_B = 4000; SIDE_COMPUTER = 0; SIDE_PLAYER = 1; letters = new Array("a", "b", "c", "d", "e", "f", "g", "h"); possibleRocade = true; pawnRules = new MovementRules(); pawnRules.isPawn = true; pawnRules.up = 1; knightRules = new MovementRules(); knightRules.isKnight = true; rookRules = new MovementRules(); rookRules.up = 8; rookRules.down = 8; rookRules.left = 8; rookRules.right = 8; bisshopRules = new MovementRules(); bisshopRules.up_left = 8; bisshopRules.up_right = 8; bisshopRules.down_left = 8; bisshopRules.down_right = 8; queenRules = new MovementRules(); queenRules.up = 8; queenRules.down = 8; queenRules.left = 8; queenRules.right = 8; queenRules.up_left = 8; queenRules.up_right = 8; queenRules.down_left = 8; queenRules.down_right = 8; kingRules = new MovementRules(); kingRules.up = 1; kingRules.down = 1; kingRules.left = 1; kingRules.right = 1; kingRules.up_left = 1; kingRules.up_right = 1; kingRules.down_left = 1; kingRules.down_right = 1; poMo = new Array(); initChessBoard(); movePlayer(); myscroll.clearText(); stop();
Frame 7
signal.gotoAndStop("comp"); messages.gotoAndStop(1); computerScore = 0; playerScore = 0; var i = 0; while (i < 8) { j = 0; while (j < 8) { if (chessBoard[i][j] != VOID) { if ((chessBoard[i][j] & 1) == SIDE_COMPUTER) { computerScore = computerScore + (chessBoard[i][j] >> 1); playerScore = playerScore - (chessBoard[i][j] >> 1); } else if ((chessBoard[i][j] & 1) == SIDE_PLAYER) { computerScore = computerScore - (chessBoard[i][j] >> 1); playerScore = playerScore + (chessBoard[i][j] >> 1); } } j++; } i++; }
Frame 8
computerScore = 0; INFINITY = 10000000 /* 0x989680 */; s = getTimer(); trace("my turn"); alpha = -INFINITY; beta = INFINITY; bestMove = null; bestScore = -INFINITY; allPossibleMoves = new Array(); capturedPiece = null; side = SIDE_COMPUTER; depth = MAXDEPTH; var i = 0; while (i < 8) { var j = 0; while (j < 8) { if (((chessBoard[i][j] & 1) == side) && (chessBoard[i][j] != VOID)) { compMoves = calculateMoves(i, j, side); allPossibleMoves = allPossibleMoves.concat(compMoves); } j++; } i++; } allPossibleMoves = shuffle(allPossibleMoves); index = 0;
Frame 9
if (index < allPossibleMoves.length) { progressBar.show(index, allPossibleMoves.length - 1); capturedPiece = do_move(allPossibleMoves[index], side); moveScore = -search(getOpponent(side), depth, -1 * beta, -1 * alpha); } else { gotoAndPlay (11); }
Frame 10
undo_move(allPossibleMoves[index], side, capturedPiece); if (bestScore < moveScore) { bestScore = moveScore; bestMove = allPossibleMoves[index]; } if (alpha < bestScore) { alpha = bestScore; } if (alpha >= beta) { gotoAndPlay (11); } index++; gotoAndPlay(_currentframe - 1);
Frame 11
trace("best: " + bestMove); delete allPossibleMoves; trace("time " + (getTimer() - s)); if (bestMove == null) { messages.gotoAndStop("Pat"); } isPat = checkChessState(SIDE_COMPUTER); tempP = do_move(bestMove, SIDE_COMPUTER); isNotMat = checkChessState(SIDE_COMPUTER); undo_move(bestMove, SIDE_COMPUTER, tempP); if (isNotMat) { moveRealComputer(bestMove); } else if (isPat) { messages.gotoAndStop("Pat"); } else { computerLoose(); } stop();
Symbol 6 MovieClip [energyBar] Frame 1
function show(value, maxValue) { _visible = true; var frame = Math.round((value * 20) / maxValue); if (frame == 0) { frame = 1; } gotoAndStop(frame); } function hide() { _visible = false; } stop();
Symbol 8 MovieClip Frame 1
stop();
Symbol 9 MovieClip Frame 1
_root.stop(); movieSize = _root.getBytesTotal();
Symbol 9 MovieClip Frame 2
movieLoaded = _root.getBytesLoaded(); percent = Math.round((movieLoaded / movieSize) * 100); loadbar.gotoAndStop(percent);
Symbol 9 MovieClip Frame 3
if (movieLoaded < movieSize) { gotoAndPlay(_currentframe - 1); }
Symbol 9 MovieClip Frame 4
_root.play();
Symbol 24 Button
on (release) { MAXDEPTH = 0; play(); }
Symbol 30 Button
on (release) { MAXDEPTH = 1; play(); }
Symbol 37 Button
on (release) { gotoAndPlay (1); }
Symbol 40 MovieClip Frame 1
_root.progressBar._visible = false; stop();
Symbol 40 MovieClip Frame 2
_root.progressBar._visible = true; _root.progressBar.gotoAndStop(1); stop();
Symbol 47 MovieClip Frame 1
stop();
Symbol 47 MovieClip Frame 2
stop();
Symbol 47 MovieClip Frame 3
stop();
Symbol 47 MovieClip Frame 4
stop();
Symbol 47 MovieClip Frame 5
stop();
Symbol 47 MovieClip Frame 6
stop();
Symbol 51 Button
on (release, keyPress "<Down>") { text.scroll++; if (myscroll._y < ((96.6 - myscroll._height) + myscroll.top)) { myscroll._y = myscroll._y + ((96.4 - myscroll._height) / myscroll.totalLines); } }
Symbol 52 Button
on (release, keyPress "<Up>") { text.scroll--; if (myscroll.top < myscroll._y) { myscroll._y = myscroll._y - ((96.4 - myscroll._height) / myscroll.totalLines); } }
Symbol 56 Button
on (press) { startDrag ("", false, left, top, right, bottom); dragging = true; } on (release, releaseOutside) { stopDrag(); dragging = false; }
Symbol 57 MovieClip Frame 1
function update() { _height = (576 / (totalLines + 5)); bottom = top + (96.6 - _height); } function appendText(tx) { moveNumber++; text = (((("" + moveNumber) + ".") + tx) + newline) + text; _root.text = title + text; totalLines++; update(); gotoBottom(); } function clearText() { _root.text = title; text = ""; totalLines = 1; update(); moveNumber = 0; } totalLines = 0; title = newline; text = ""; top = _y; left = _x; right = _x; clearText();
Symbol 57 MovieClip Frame 3
gotoAndPlay(_currentframe - 1);
Symbol 61 Button
on (release) { _root.select(this._parent.row, this._parent.col); gotoAndStop (3); }
Symbol 63 Button
on (release) { _root.moveRealPlayer((((_root.pieceSelected.row << 9) | (_root.pieceSelected.col << 6)) | (this._parent.row << 3)) | this._parent.col, _root.SIDE_PLAYER); }
Symbol 65 Button
on (release) { _root.deselect(this._parent); _root.gotoAndStop("normal"); }
Symbol 66 MovieClip Frame 1
stop();
Symbol 66 MovieClip Frame 2
stop();
Symbol 66 MovieClip Frame 3
stop();
Symbol 66 MovieClip Frame 4
stop();
Symbol 79 MovieClip Frame 1
function showPiece(piece) { if (piece == _root.VOID) { gotoAndStop (1); } else if (piece == _root.PAWN_W) { gotoAndStop (2); } else if (piece == _root.KNIGHT_W) { gotoAndStop (3); } else if (piece == _root.ROOK_W) { gotoAndStop (4); } else if (piece == _root.BISSHOP_W) { gotoAndStop (5); } else if (piece == _root.QUEEN_W) { gotoAndStop (6); } else if (piece == _root.KING_W) { gotoAndStop (7); } else if (piece == _root.PAWN_B) { gotoAndStop (9); } else if (piece == _root.KNIGHT_B) { gotoAndStop (10); } else if (piece == _root.ROOK_B) { gotoAndStop (11); } else if (piece == _root.BISSHOP_B) { gotoAndStop (12); } else if (piece == _root.QUEEN_B) { gotoAndStop (13); } else if (piece == _root.KING_B) { gotoAndStop (14); } } piece = "void"; stop();
Symbol 79 MovieClip Frame 2
piece = "pawn_w"; stop();
Symbol 79 MovieClip Frame 3
piece = "knight_w"; stop();
Symbol 79 MovieClip Frame 4
piece = "rook_w"; stop();
Symbol 79 MovieClip Frame 5
piece = "bisshop_w"; stop();
Symbol 79 MovieClip Frame 6
piece = "queen_w"; stop();
Symbol 79 MovieClip Frame 7
piece = "king_w"; stop();
Symbol 79 MovieClip Frame 9
piece = "pawn_b"; stop();
Symbol 79 MovieClip Frame 10
piece = "knight_b"; stop();
Symbol 79 MovieClip Frame 11
piece = "rook_b"; stop();
Symbol 79 MovieClip Frame 12
piece = "bisshop_b"; stop();
Symbol 79 MovieClip Frame 13
piece = "queen_b"; stop();
Symbol 79 MovieClip Frame 14
piece = "king_b"; stop();

Library Items

Symbol 1 GraphicUsed by:6
Symbol 2 FontUsed by:3 36 38 39 41 42 43 44 45 46 58 59
Symbol 3 TextUses:2Used by:6
Symbol 4 ShapeTweeningUsed by:6
Symbol 5 GraphicUsed by:6 8
Symbol 6 MovieClip [energyBar]Uses:1 3 4 5Used by:Timeline
Symbol 7 GraphicUsed by:8
Symbol 8 MovieClipUses:5 7Used by:9
Symbol 9 MovieClipUses:8Used by:Timeline
Symbol 10 FontUsed by:11 18 19 20 22 23 25 26 28 29
Symbol 11 TextUses:10Used by:Timeline
Symbol 12 GraphicUsed by:Timeline
Symbol 13 FontUsed by:14
Symbol 14 TextUses:13Used by:Timeline
Symbol 15 FontUsed by:16
Symbol 16 TextUses:15Used by:Timeline
Symbol 17 GraphicUsed by:Timeline
Symbol 18 TextUses:10Used by:Timeline
Symbol 19 TextUses:10Used by:24
Symbol 20 TextUses:10Used by:24
Symbol 21 GraphicUsed by:24
Symbol 22 TextUses:10Used by:24
Symbol 23 TextUses:10Used by:24
Symbol 24 ButtonUses:19 20 21 22 23Used by:Timeline
Symbol 25 TextUses:10Used by:30
Symbol 26 TextUses:10Used by:30
Symbol 27 GraphicUsed by:30
Symbol 28 TextUses:10Used by:30
Symbol 29 TextUses:10Used by:30
Symbol 30 ButtonUses:25 26 27 28 29Used by:Timeline
Symbol 31 GraphicUsed by:Timeline
Symbol 32 GraphicUsed by:Timeline
Symbol 33 GraphicUsed by:Timeline
Symbol 34 GraphicUsed by:Timeline
Symbol 35 GraphicUsed by:37
Symbol 36 TextUses:2Used by:37
Symbol 37 ButtonUses:35 36Used by:Timeline
Symbol 38 TextUses:2Used by:40
Symbol 39 TextUses:2Used by:40
Symbol 40 MovieClipUses:38 39Used by:Timeline
Symbol 41 TextUses:2Used by:47
Symbol 42 TextUses:2Used by:47
Symbol 43 TextUses:2Used by:47
Symbol 44 TextUses:2Used by:47
Symbol 45 TextUses:2Used by:47
Symbol 46 TextUses:2Used by:47
Symbol 47 MovieClipUses:41 42 43 44 45 46Used by:Timeline
Symbol 48 GraphicUsed by:51 52
Symbol 49 GraphicUsed by:51 52
Symbol 50 GraphicUsed by:51 52
Symbol 51 ButtonUses:48 49 50Used by:Timeline
Symbol 52 ButtonUses:48 49 50Used by:Timeline
Symbol 53 GraphicUsed by:Timeline
Symbol 54 GraphicUsed by:56
Symbol 55 GraphicUsed by:56
Symbol 56 ButtonUses:54 55Used by:57
Symbol 57 MovieClipUses:56Used by:Timeline
Symbol 58 TextUses:2Used by:Timeline
Symbol 59 EditableTextUses:2Used by:Timeline
Symbol 60 GraphicUsed by:61 63 65
Symbol 61 ButtonUses:60Used by:66
Symbol 62 GraphicUsed by:66
Symbol 63 ButtonUses:60Used by:66
Symbol 64 GraphicUsed by:66
Symbol 65 ButtonUses:60Used by:66
Symbol 66 MovieClipUses:61 62 63 64 65Used by:79
Symbol 67 GraphicUsed by:79
Symbol 68 GraphicUsed by:79
Symbol 69 GraphicUsed by:79
Symbol 70 GraphicUsed by:79
Symbol 71 GraphicUsed by:79
Symbol 72 GraphicUsed by:79
Symbol 73 GraphicUsed by:79
Symbol 74 GraphicUsed by:79
Symbol 75 GraphicUsed by:79
Symbol 76 GraphicUsed by:79
Symbol 77 GraphicUsed by:79
Symbol 78 GraphicUsed by:79
Symbol 79 MovieClipUses:66 67 68 69 70 71 72 73 74 75 76 77 78Used by:Timeline

Instance Names

"signal"Frame 3Symbol 40 MovieClip
"messages"Frame 3Symbol 47 MovieClip
"myscroll"Frame 3Symbol 57 MovieClip
"progressBar"Frame 3Symbol 6 MovieClip [energyBar]
"piece_0_0"Frame 3Symbol 79 MovieClip
"piece_1_0"Frame 3Symbol 79 MovieClip
"piece_2_0"Frame 3Symbol 79 MovieClip
"piece_3_0"Frame 3Symbol 79 MovieClip
"piece_4_0"Frame 3Symbol 79 MovieClip
"piece_5_0"Frame 3Symbol 79 MovieClip
"piece_6_0"Frame 3Symbol 79 MovieClip
"piece_7_0"Frame 3Symbol 79 MovieClip
"piece_0_1"Frame 3Symbol 79 MovieClip
"piece_1_1"Frame 3Symbol 79 MovieClip
"piece_2_1"Frame 3Symbol 79 MovieClip
"piece_3_1"Frame 3Symbol 79 MovieClip
"piece_4_1"Frame 3Symbol 79 MovieClip
"piece_5_1"Frame 3Symbol 79 MovieClip
"piece_6_1"Frame 3Symbol 79 MovieClip
"piece_7_1"Frame 3Symbol 79 MovieClip
"piece_0_2"Frame 3Symbol 79 MovieClip
"piece_1_2"Frame 3Symbol 79 MovieClip
"piece_2_2"Frame 3Symbol 79 MovieClip
"piece_3_2"Frame 3Symbol 79 MovieClip
"piece_4_2"Frame 3Symbol 79 MovieClip
"piece_5_2"Frame 3Symbol 79 MovieClip
"piece_6_2"Frame 3Symbol 79 MovieClip
"piece_7_2"Frame 3Symbol 79 MovieClip
"piece_0_3"Frame 3Symbol 79 MovieClip
"piece_1_3"Frame 3Symbol 79 MovieClip
"piece_2_3"Frame 3Symbol 79 MovieClip
"piece_3_3"Frame 3Symbol 79 MovieClip
"piece_4_3"Frame 3Symbol 79 MovieClip
"piece_5_3"Frame 3Symbol 79 MovieClip
"piece_6_3"Frame 3Symbol 79 MovieClip
"piece_7_3"Frame 3Symbol 79 MovieClip
"piece_0_4"Frame 3Symbol 79 MovieClip
"piece_1_4"Frame 3Symbol 79 MovieClip
"piece_2_4"Frame 3Symbol 79 MovieClip
"piece_3_4"Frame 3Symbol 79 MovieClip
"piece_4_4"Frame 3Symbol 79 MovieClip
"piece_5_4"Frame 3Symbol 79 MovieClip
"piece_6_4"Frame 3Symbol 79 MovieClip
"piece_7_4"Frame 3Symbol 79 MovieClip
"piece_0_5"Frame 3Symbol 79 MovieClip
"piece_1_5"Frame 3Symbol 79 MovieClip
"piece_2_5"Frame 3Symbol 79 MovieClip
"piece_3_5"Frame 3Symbol 79 MovieClip
"piece_4_5"Frame 3Symbol 79 MovieClip
"piece_5_5"Frame 3Symbol 79 MovieClip
"piece_6_5"Frame 3Symbol 79 MovieClip
"piece_7_5"Frame 3Symbol 79 MovieClip
"piece_0_6"Frame 3Symbol 79 MovieClip
"piece_1_6"Frame 3Symbol 79 MovieClip
"piece_2_6"Frame 3Symbol 79 MovieClip
"piece_3_6"Frame 3Symbol 79 MovieClip
"piece_4_6"Frame 3Symbol 79 MovieClip
"piece_5_6"Frame 3Symbol 79 MovieClip
"piece_6_6"Frame 3Symbol 79 MovieClip
"piece_7_6"Frame 3Symbol 79 MovieClip
"piece_0_7"Frame 3Symbol 79 MovieClip
"piece_1_7"Frame 3Symbol 79 MovieClip
"piece_2_7"Frame 3Symbol 79 MovieClip
"piece_3_7"Frame 3Symbol 79 MovieClip
"piece_4_7"Frame 3Symbol 79 MovieClip
"piece_5_7"Frame 3Symbol 79 MovieClip
"piece_6_7"Frame 3Symbol 79 MovieClip
"piece_7_7"Frame 3Symbol 79 MovieClip
"loadbar"Symbol 9 MovieClip Frame 1Symbol 8 MovieClip
"marker"Symbol 79 MovieClip Frame 1Symbol 66 MovieClip

Special Tags

Protect (24)Timeline Frame 10 bytes ""
ExportAssets (56)Timeline Frame 1Symbol 6 as "energyBar"
ExportAssets (56)Timeline Frame 3Symbol 6 as "energyBar"
ExportAssets (56)Timeline Frame 4Symbol 6 as "energyBar"
ExportAssets (56)Timeline Frame 5Symbol 6 as "energyBar"
ExportAssets (56)Timeline Frame 6Symbol 6 as "energyBar"
ExportAssets (56)Timeline Frame 7Symbol 6 as "energyBar"
ExportAssets (56)Timeline Frame 8Symbol 6 as "energyBar"
ExportAssets (56)Timeline Frame 9Symbol 6 as "energyBar"
ExportAssets (56)Timeline Frame 10Symbol 6 as "energyBar"
ExportAssets (56)Timeline Frame 11Symbol 6 as "energyBar"

Labels

"moveComputer"Frame 7
"moveLoop"Frame 9
"searchDone"Frame 11
"player"Symbol 40 MovieClip Frame 1
"comp"Symbol 40 MovieClip Frame 2
"Pat"Symbol 47 MovieClip Frame 4
"playerChess"Symbol 47 MovieClip Frame 5
"computerChess"Symbol 47 MovieClip Frame 6
"normal"Symbol 66 MovieClip Frame 1
"selectedTo"Symbol 66 MovieClip Frame 2
"selected"Symbol 66 MovieClip Frame 3
"disabled"Symbol 66 MovieClip Frame 4
"void"Symbol 79 MovieClip Frame 1
"pawn_w"Symbol 79 MovieClip Frame 2
"knight_w"Symbol 79 MovieClip Frame 3
"rook_w"Symbol 79 MovieClip Frame 4
"bisshop_w"Symbol 79 MovieClip Frame 5
"queen_w"Symbol 79 MovieClip Frame 6
"king_w"Symbol 79 MovieClip Frame 7
"pawn_b"Symbol 79 MovieClip Frame 9
"knight_b"Symbol 79 MovieClip Frame 10
"rook_b"Symbol 79 MovieClip Frame 11
"bisshop_b"Symbol 79 MovieClip Frame 12
"queen_b"Symbol 79 MovieClip Frame 13
"king_b"Symbol 79 MovieClip Frame 14

Dynamic Text Variables

textSymbol 59 EditableText""




http://swfchan.com/5/22628/info.shtml
Created: 26/5 -2019 20:36:50 Last modified: 26/5 -2019 20:36:50 Server time: 15/11 -2024 02:31:15