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

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

Smiley Chess.swf

This is the info page for
Flash #48304

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


Text
START

© MarioFlashMovies 2008

© MarioFlashMovies 2008

NEW GAME

Your turn


Computer's turn


THINKING...

Checkmate!
You won!

The
computer
won

TIE

WARNING
Computer's check!

The computer got
a check from you!

דוקינ חלוש

ActionScript [AS1/AS2]

Frame 1
stop();
Frame 2
stop(); MAXDEPTH = 0; play();
Frame 4
function MovementRules() { var _local1 = this; _local1.up = 0; _local1.down = 0; _local1.left = 0; _local1.right = 0; _local1.up_left = 0; _local1.up_right = 0; _local1.down_left = 0; _local1.down_right = 0; _local1.isKnight = false; _local1.isPawn = false; } function Move(firstPosX, firstPosY, lastPosX, lastPosY) { var _local1 = this; _local1.fPX = firstPosX; _local1.fPY = firstPosY; _local1.lPX = lastPosX; _local1.lPY = lastPosY; } function rulesFor(piece) { var _local1 = piece; if ((_local1 == PAWN_W) || (_local1 == PAWN_B)) { return(pawnRules); } if ((_local1 == KNIGHT_W) || (_local1 == KNIGHT_B)) { return(knightRules); } if ((_local1 == ROOK_W) || (_local1 == ROOK_B)) { return(rookRules); } if ((_local1 == BISSHOP_W) || (_local1 == BISSHOP_B)) { return(bisshopRules); } if ((_local1 == QUEEN_W) || (_local1 == QUEEN_B)) { return(queenRules); } if ((_local1 == KING_W) || (_local1 == KING_B)) { return(kingRules); } return(undefined); } function initChessBoard() { var _local3 = _root; 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 _local2 = 0; while (_local2 < 8) { var _local1 = 0; while (_local1 < 8) { _local3[(("piece_" + _local2) + "_") + _local1].showPiece(chessBoard[_local2][_local1]); _local3[(("piece_" + _local2) + "_") + _local1].row = _local2; _local3[(("piece_" + _local2) + "_") + _local1].col = _local1; _local1++; } _local2++; } } function calculateMoves(row, col, side) { var _local1 = col; var _local2 = row; if (chessBoard[_local2][_local1] == VOID) { return(null); } var _local3 = new Array(); rules = rulesFor(chessBoard[_local2][_local1]); var poTa; if (rules.isKnight) { var x = (_local2 - 1); var y = (_local1 + 2); if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } } x = _local2 - 1; y = _local1 - 2; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } } x = _local2 + 1; y = _local1 + 2; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } } x = _local2 + 1; y = _local1 - 2; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } } x = _local2 - 2; y = _local1 + 1; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } } x = _local2 - 2; y = _local1 - 1; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } } x = _local2 + 2; y = _local1 - 1; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } } x = _local2 + 2; y = _local1 + 1; if ((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) { if ((chessBoard[x][y] == VOID) || (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } } } else if (rules.isPawn) { if (side == SIDE_PLAYER) { var possibleEmpassant = false; var i = (_local2 - 1); if (chessBoard[i][_local1] == VOID) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (i << 3)) | _local1; possibleEmpassant = true; } if ((_local2 == 6) && (possibleEmpassant)) { i--; if (chessBoard[i][_local1] == VOID) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (i << 3)) | _local1; } } var x = (_local2 - 1); var y = (_local1 - 1); if ((((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) && (chessBoard[x][y] != VOID)) && (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } var x = (_local2 - 1); var y = (_local1 + 1); if ((((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) && (chessBoard[x][y] != VOID)) && (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } // unexpected jump } var possibleEmpassant = false; var i = (_local2 + 1); if (chessBoard[i][_local1] == VOID) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (i << 3)) | _local1; possibleEmpassant = true; } if ((_local2 == 1) && (possibleEmpassant)) { i++; if (chessBoard[i][_local1] == VOID) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (i << 3)) | _local1; } } x = _local2 + 1; y = _local1 - 1; if ((((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) && (chessBoard[x][y] != VOID)) && (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } x = _local2 + 1; y = _local1 + 1; if ((((((x >= 0) && (x < 8)) && (y >= 0)) && (y < 8)) && (chessBoard[x][y] != VOID)) && (side != (chessBoard[x][y] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (x << 3)) | y; } } else { var delta = rules.up; var i = (_local2 - 1); while ((delta > 0) && (i >= 0)) { if ((chessBoard[i][_local1] == VOID) || (side != (chessBoard[i][_local1] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (i << 3)) | _local1; } else { break; } if (chessBoard[i][_local1] != VOID) { break; } i--; delta--; } var delta = rules.down; var i = (_local2 + 1); while ((delta > 0) && (i < 8)) { if ((chessBoard[i][_local1] == VOID) || (side != (chessBoard[i][_local1] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (i << 3)) | _local1; } else { break; } if (chessBoard[i][_local1] != VOID) { break; } i++; delta--; } var delta = rules.left; var j = (_local1 - 1); while ((delta > 0) && (j >= 0)) { if ((chessBoard[_local2][j] == VOID) || (side != (chessBoard[_local2][j] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (_local2 << 3)) | j; } else { break; } if (chessBoard[_local2][j] != VOID) { break; } j--; delta--; } var delta = rules.right; var j = (_local1 + 1); while ((delta > 0) && (j < 8)) { if ((chessBoard[_local2][j] == VOID) || (side != (chessBoard[_local2][j] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (_local2 << 3)) | j; } else { break; } if (chessBoard[_local2][j] != VOID) { break; } j++; delta--; } var delta = rules.up_left; var i = (_local2 - 1); var j = (_local1 - 1); while (((delta > 0) && (j >= 0)) && (i >= 0)) { if ((chessBoard[i][j] == VOID) || (side != (chessBoard[i][j] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (i << 3)) | j; } else { break; } if (chessBoard[i][j] != VOID) { break; } i--; j--; delta--; } var delta = rules.up_right; var i = (_local2 - 1); var j = (_local1 + 1); while (((delta > 0) && (j < 8)) && (i >= 0)) { if ((chessBoard[i][j] == VOID) || (side != (chessBoard[i][j] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (i << 3)) | j; } else { break; } if (chessBoard[i][j] != VOID) { break; } i--; j++; delta--; } var delta = rules.down_left; var i = (_local2 + 1); var j = (_local1 - 1); while (((delta > 0) && (j >= 0)) && (i < 8)) { if ((chessBoard[i][j] == VOID) || (side != (chessBoard[i][j] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (i << 3)) | j; } else { break; } if (chessBoard[i][j] != VOID) { break; } i++; j--; delta--; } var delta = rules.down_right; var i = (_local2 + 1); var j = (_local1 + 1); while (((delta > 0) && (j < 8)) && (i < 8)) { if ((chessBoard[i][j] == VOID) || (side != (chessBoard[i][j] & 1))) { _local3[_local3.length] = (((_local2 << 9) | (_local1 << 6)) | (i << 3)) | j; } else { break; } if (chessBoard[i][j] != VOID) { break; } i++; j++; delta--; } } return(_local3); } function checkChessState(side) { var _local2 = side; var _local3; var col; var i = 0; while (i < 8) { var j = 0; while (j < 8) { if (((chessBoard[i][j] & 1) == getOpponent(_local2)) && (chessBoard[i][j] != VOID)) { compMoves = calculateMoves(i, j, getOpponent(_local2)); var _local1 = 0; while (_local1 < compMoves.length) { _local3 = (compMoves[_local1] >> 3) & 7; col = compMoves[_local1] & 7; if (((chessBoard[_local3][col] == KING_W) && (_local2 == SIDE_PLAYER)) || ((chessBoard[_local3][col] == KING_B) && (_local2 == SIDE_COMPUTER))) { if (_local2 == SIDE_PLAYER) { kingInChess(_local3, col, _local2); } return(false); } _local1++; } } j++; } i++; } if (_local2 == 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() { invalidateAll(); messages.gotoAndStop(2); stop(); } function deselect(piece) { resetAllSelection(); pieceSelected = null; possiblePositions = null; } function displayMove(move, side) { var _local2 = move; var _local3 = (_local2 >> 9) & 7; var _loc3 = ((_local2 >> 6) & 7); var lPX = ((_local2 >> 3) & 7); var lPY = (_local2 & 7); var _local1 = " "; if (side == SIDE_COMPUTER) { _local1 = _local1 + "Comp: "; } else { _local1 = _local1 + "You: "; } _local1 = _local1 + letters[_loc3]; _local1 = _local1 + (9 - (_local3 + 1)); _local1 = _local1 + " - "; _local1 = _local1 + letters[lPY]; _local1 = _local1 + (9 - (lPX + 1)); _root.myscroll.appendText(_local1); } function do_move(move, side) { var _local3 = VOID; var fPX = ((move >> 9) & 7); var _loc3 = ((move >> 6) & 7); var _local1 = (move >> 3) & 7; var _local2 = move & 7; if (side == SIDE_COMPUTER) { if (chessBoard[_local1][_local2] != VOID) { _local3 = chessBoard[_local1][_local2]; playerScore = playerScore - (chessBoard[_local1][_local2] >> 1); computerScore = computerScore + (chessBoard[_local1][_local2] >> 1); } chessBoard[_local1][_local2] = chessBoard[fPX][_loc3]; chessBoard[fPX][_loc3] = VOID; return(_local3); } if (chessBoard[_local1][_local2] != VOID) { _local3 = chessBoard[_local1][_local2]; playerScore = playerScore + (chessBoard[_local1][_local2] >> 1); computerScore = computerScore - (chessBoard[_local1][_local2] >> 1); } chessBoard[_local1][_local2] = chessBoard[fPX][_loc3]; chessBoard[fPX][_loc3] = VOID; return(_local3); } function invalidateAll() { var _local3 = _root; var _local2 = 0; while (_local2 < 8) { var _local1 = 0; while (_local1 < 8) { _local3[(("piece_" + _local2) + "_") + _local1].marker.gotoAndStop("disabled"); _local1++; } _local2++; } } function movePlayer() { messages.gotoAndStop(0); resetAllSelection(); checkChessState(SIDE_PLAYER); signal.gotoAndStop("player"); } function moveRealPlayer(move, side) { var _local2 = (move >> 9) & 7; var _local1 = (move >> 6) & 7; var _local3 = (move >> 3) & 7; var _loc3 = (move & 7); if (pieceSelected == null) { } else { if ((chessBoard[_local2][_local1] == KING_W) && (chessBoard[_local3][_loc3] == ROOK_W)) { possibleRocade = false; chessBoard[_local2][_local1] = VOID; chessBoard[_local3][_loc3] = VOID; if (_local1 < _loc3) { chessBoard[_local2][_local1 + 2] = KING_W; chessBoard[_local2][_local1 + 1] = ROOK_W; _root[(("piece_" + _local2) + "_") + (_local1 + 1)].showPiece(chessBoard[_local2][_local1 + 1]); _root[(("piece_" + _local2) + "_") + (_local1 + 2)].showPiece(chessBoard[_local2][_local1 + 2]); } else { chessBoard[_local2][_local1 - 2] = KING_W; chessBoard[_local2][_local1 - 1] = ROOK_W; _root[(("piece_" + _local2) + "_") + (_local1 - 1)].showPiece(chessBoard[_local2][_local1 - 1]); _root[(("piece_" + _local2) + "_") + (_local1 - 2)].showPiece(chessBoard[_local2][_local1 - 2]); } _root[(("piece_" + _local3) + "_") + _loc3].showPiece(chessBoard[_local3][_loc3]); _root[(("piece_" + _local2) + "_") + _local1].showPiece(chessBoard[_local2][_local1]); } else { if ((chessBoard[_local2][_local1] == KING_W) || (chessBoard[_local2][_local1] == ROOK_W)) { possibleRocade = false; } var target = chessBoard[_local3][_loc3]; if (((target & 1) == SIDE_COMPUTER) && (target != VOID)) { } chessBoard[_local3][_loc3] = chessBoard[_local2][_local1]; chessBoard[_local2][_local1] = VOID; _root[(("piece_" + _local3) + "_") + _loc3].showPiece(chessBoard[_local3][_loc3]); _root[(("piece_" + _local2) + "_") + _local1].showPiece(VOID); } invalidateAll(); if ((_local3 == 0) && (chessBoard[_local3][_loc3] == PAWN_W)) { chessBoard[_local3][_loc3] = QUEEN_W; _root[(("piece_" + _local3) + "_") + _loc3].showPiece(QUEEN_W); } displayMove(move, SIDE_PLAYER); gotoAndPlay (7); } } function moveRealComputer(move) { var _local3 = (move >> 9) & 7; var _loc3 = ((move >> 6) & 7); var _local1 = (move >> 3) & 7; var _local2 = move & 7; var target = chessBoard[_local1][_local2]; if (((target & 1) == SIDE_PLAYER) && (target != VOID)) { } chessBoard[_local1][_local2] = chessBoard[_local3][_loc3]; chessBoard[_local3][_loc3] = VOID; _root[(("piece_" + _local1) + "_") + _local2].showPiece(chessBoard[_local1][_local2]); _root[(("piece_" + _local3) + "_") + _loc3].showPiece(VOID); if ((_local1 == 7) && (chessBoard[_local1][_local2] == PAWN_B)) { chessBoard[_local1][_local2] = QUEEN_B; _root[(("piece_" + _local1) + "_") + _local2].showPiece(QUEEN_B); } displayMove(move, SIDE_COMPUTER); movePlayer(); } function resetAllSelection() { var _local3 = _root; var _local2 = 0; while (_local2 < 8) { var _local1 = 0; while (_local1 < 8) { if ((chessBoard[_local2][_local1] == VOID) || ((chessBoard[_local2][_local1] & 1) == SIDE_COMPUTER)) { _local3[(("piece_" + _local2) + "_") + _local1].marker.gotoAndStop("disabled"); } else { _local3[(("piece_" + _local2) + "_") + _local1].marker.gotoAndStop("normal"); } _local1++; } _local2++; } } function select(row, col, real) { var _local1 = row; resetAllSelection(); var _local3 = calculateMoves(_local1, col, SIDE_PLAYER); if (possibleRocade && (real != true)) { if (chessBoard[_local1][col] == KING_W) { var _local2 = col; var adv = true; while (adv) { _local2++; if (chessBoard[_local1][_local2] != VOID) { if (chessBoard[_local1][_local2] == ROOK_W) { if (verifyKingState((((_local1 << 9) | (col << 6)) | (_local1 << 3)) | (col + 2), SIDE_PLAYER)) { _local3[_local3.length] = (((_local1 << 9) | (col << 6)) | (_local1 << 3)) | _local2; } } adv = false; } } _local2 = col; adv = true; while (adv) { _local2--; if (chessBoard[_local1][_local2] != VOID) { if (chessBoard[_local1][_local2] == ROOK_W) { if (verifyKingState((((_local1 << 9) | (col << 6)) | (_local1 << 3)) | (col - 2), SIDE_PLAYER)) { _local3[_local3.length] = (((_local1 << 9) | (col << 6)) | (_local1 << 3)) | _local2; } } } adv = false; } } } var validMoves = new Array(); var i = 0; while (i < _local3.length) { if (verifyKingState(_local3[i], SIDE_PLAYER)) { validMoves[validMoves.length] = _local3[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_" + _local1) + "_") + col]; } else { return(validMoves.length); } return(undefined); } function kingInChess(rowKing, colKing, side) { possibleRocade = false; if (side == SIDE_PLAYER) { messages.gotoAndStop("playerChess"); } else { messages.gotoAndStop("computerChess"); } var possibleMoves; var isChessMat = true; var _local3 = 0; while (_local3 < 8) { var _local2 = 0; while (_local2 < 8) { if (((chessBoard[_local3][_local2] & 1) == side) && (chessBoard[_local3][_local2] != VOID)) { possibleMoves = calculateMoves(_local3, _local2, side); disabled = true; var _local1 = 0; while (_local1 < possibleMoves.length) { if (verifyKingState(possibleMoves[_local1], side)) { isChessMat = false; } _local1++; } } _local2++; } _local3++; } if (isChessMat) { loose(side); } } function loose(side) { if (side == SIDE_COMPUTER) { computerLoose(); } else { playerLoose(); } } function playerLoose() { invalidateAll(); messages.gotoAndStop(3); stop(); } function search(side, depth, alpha, beta) { var _local2 = side; var bestScore = (-INFINITY); var _local3 = new Array(); var capturedPiece = null; var moveScore; var compMoves; var i = 0; while (i < 8) { var _local1 = 0; while (_local1 < 8) { if (((chessBoard[i][_local1] & 1) == _local2) && (chessBoard[i][_local1] != VOID)) { _local3 = _local3.concat(calculateMoves(i, _local1, _local2)); } _local1++; } i++; } var i = 0; while (i < _local3.length) { capturedPiece = do_move(_local3[i], _local2); if (depth == 0) { moveScore = ((_local2 == SIDE_COMPUTER) ? (computerScore) : (playerScore)); } else { moveScore = -search(getOpponent(_local2), depth - 1, -1 * beta, -1 * alpha); } undo_move(_local3[i], _local2, capturedPiece); if (bestScore < moveScore) { bestScore = moveScore; } if (alpha < bestScore) { alpha = bestScore; } if (alpha >= beta) { return(alpha); } i++; } return(bestScore); } function shuffle(collection) { var _local1 = collection; var nCollection = new Array(); var _local3; var _local2; while (_local1.length != 0) { _local2 = Math.round(Math.random() * (_local1.length - 1)); _local3 = _local1[_local2]; _local1.splice(_local2, 1); nCollection.push(_local3); } return(nCollection); } function getOpponent(side) { if (side == SIDE_PLAYER) { return(SIDE_COMPUTER); } return(SIDE_PLAYER); } function undo_move(move, side, pieceCaptured) { var _local3 = pieceCaptured; var fPX = ((move >> 9) & 7); var _loc3 = ((move >> 6) & 7); var _local1 = (move >> 3) & 7; var _local2 = move & 7; if (side == SIDE_COMPUTER) { chessBoard[fPX][_loc3] = chessBoard[_local1][_local2]; if (_local3 != VOID) { chessBoard[_local1][_local2] = _local3; playerScore = playerScore + (chessBoard[_local1][_local2] >> 1); computerScore = computerScore - (chessBoard[_local1][_local2] >> 1); } else { chessBoard[_local1][_local2] = VOID; } } else { chessBoard[fPX][_loc3] = chessBoard[_local1][_local2]; if (_local3 != VOID) { chessBoard[_local1][_local2] = _local3; playerScore = playerScore - (chessBoard[_local1][_local2] >> 1); computerScore = computerScore + (chessBoard[_local1][_local2] >> 1); } else { chessBoard[_local1][_local2] = VOID; } } } function verifyKingState(move, side) { var _local3 = side; var capturedPiece; var compMoves; var row; var col; capturedPiece = do_move(move, _local3); var i = 0; while (i < 8) { var _local2 = 0; while (_local2 < 8) { if (((chessBoard[i][_local2] & 1) == getOpponent(_local3)) && (chessBoard[i][_local2] != VOID)) { compMoves = calculateMoves(i, _local2, getOpponent(_local3)); var _local1 = 0; while (_local1 < compMoves.length) { row = (compMoves[_local1] >> 3) & 7; col = compMoves[_local1] & 7; if (((chessBoard[row][col] == KING_W) && (_local3 == SIDE_PLAYER)) || ((chessBoard[row][col] == KING_B) && (_local3 == SIDE_COMPUTER))) { undo_move(move, _local3, capturedPiece); return(false); } _local1++; } } _local2++; } i++; } undo_move(move, _local3, 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(); } trace("XX"); stop();
Frame 12
trace(_root.TipoGameScore); loadVariablesNum ("tgscore.asp", 0, "POST"); play();
Frame 105
stop();
Symbol 8 Button
on (press) { nextFrame(); }
Symbol 76 Button
on (release) { stopAllSounds(); gotoAndPlay (1); }
Symbol 85 MovieClip Frame 1
_root.progressBar._visible = false; stop();
Symbol 85 MovieClip Frame 2
_root.progressBar._visible = true; _root.progressBar.gotoAndStop(1); stop();
Symbol 92 MovieClip [energyBar] Frame 1
function show(value, maxValue) { _visible = true; var _local1 = Math.round((value * 20) / maxValue); if (_local1 == 0) { _local1 = 1; } gotoAndStop(_local1); } function hide() { _visible = false; } stop();
Symbol 94 Button
on (release) { _root.select(this._parent.row, this._parent.col); gotoAndStop (3); }
Symbol 97 Button
on (release) { _root.moveRealPlayer((((_root.pieceSelected.row << 9) | (_root.pieceSelected.col << 6)) | (this._parent.row << 3)) | this._parent.col, _root.SIDE_PLAYER); }
Symbol 99 Button
on (release) { _root.deselect(this._parent); _root.gotoAndStop("normal"); }
Symbol 100 MovieClip Frame 1
stop();
Symbol 100 MovieClip Frame 2
stop();
Symbol 100 MovieClip Frame 3
stop();
Symbol 100 MovieClip Frame 4
stop();
Symbol 138 MovieClip Frame 1
function showPiece(piece) { var _local2 = piece; var _local1 = _root; if (_local2 == _local1.VOID) { gotoAndStop (1); } else if (_local2 == _local1.PAWN_W) { gotoAndStop (2); } else if (_local2 == _local1.KNIGHT_W) { gotoAndStop (3); } else if (_local2 == _local1.ROOK_W) { gotoAndStop (4); } else if (_local2 == _local1.BISSHOP_W) { gotoAndStop (5); } else if (_local2 == _local1.QUEEN_W) { gotoAndStop (6); } else if (_local2 == _local1.KING_W) { gotoAndStop (7); } else if (_local2 == _local1.PAWN_B) { gotoAndStop (9); } else if (_local2 == _local1.KNIGHT_B) { gotoAndStop (10); } else if (_local2 == _local1.ROOK_B) { gotoAndStop (11); } else if (_local2 == _local1.BISSHOP_B) { gotoAndStop (12); } else if (_local2 == _local1.QUEEN_B) { gotoAndStop (13); } else if (_local2 == _local1.KING_B) { gotoAndStop (14); } } piece = "void"; stop();
Symbol 138 MovieClip Frame 2
piece = "pawn_w"; stop();
Symbol 138 MovieClip Frame 3
piece = "knight_w"; stop();
Symbol 138 MovieClip Frame 4
piece = "rook_w"; stop();
Symbol 138 MovieClip Frame 5
piece = "bisshop_w"; stop();
Symbol 138 MovieClip Frame 6
piece = "queen_w"; stop();
Symbol 138 MovieClip Frame 7
piece = "king_w"; stop();
Symbol 138 MovieClip Frame 9
piece = "pawn_b"; stop();
Symbol 138 MovieClip Frame 10
piece = "knight_b"; stop();
Symbol 138 MovieClip Frame 11
piece = "rook_b"; stop();
Symbol 138 MovieClip Frame 12
piece = "bisshop_b"; stop();
Symbol 138 MovieClip Frame 13
piece = "queen_b"; stop();
Symbol 138 MovieClip Frame 14
piece = "king_b"; stop();
Symbol 145 MovieClip Frame 1
stop();
Symbol 145 MovieClip Frame 2
stop(); _root.TipoGameID = _root.TipoGameID; sco_btn._visible = false; reg_btn._visible = false; if (_root.TipoUserLog == 0) { sco_btn._visible = false; reg_btn._visible = true; } if (_root.TipoUserLog == 1) { sco_btn._visible = true; reg_btn._visible = false; }
Symbol 145 MovieClip Frame 3
stop();
Symbol 145 MovieClip Frame 4
stop(); _root.TipoGameID = _root.TipoGameID; sco_btn._visible = false; reg_btn._visible = false; if (_root.TipoUserLog == 0) { sco_btn._visible = false; reg_btn._visible = true; } if (_root.TipoUserLog == 1) { sco_btn._visible = true; reg_btn._visible = false; }
Symbol 145 MovieClip Frame 5
stop();
Symbol 145 MovieClip Frame 6
stop();

Library Items

Symbol 1 GraphicUsed by:Timeline
Symbol 2 GraphicUsed by:Timeline
Symbol 3 GraphicUsed by:Timeline
Symbol 4 GraphicUsed by:8
Symbol 5 FontUsed by:6 10 11 78 140 141 142 143 144
Symbol 6 TextUses:5Used by:8
Symbol 7 GraphicUsed by:8
Symbol 8 ButtonUses:4 6 7Used by:Timeline
Symbol 9 GraphicUsed by:Timeline
Symbol 10 TextUses:5Used by:Timeline
Symbol 11 TextUses:5Used by:Timeline
Symbol 12 GraphicUsed by:138  Timeline
Symbol 13 GraphicUsed by:138  Timeline
Symbol 14 GraphicUsed by:Timeline
Symbol 15 GraphicUsed by:138  Timeline
Symbol 16 GraphicUsed by:138  Timeline
Symbol 17 GraphicUsed by:Timeline
Symbol 18 GraphicUsed by:138  Timeline
Symbol 19 GraphicUsed by:138  Timeline
Symbol 20 GraphicUsed by:138  Timeline
Symbol 21 GraphicUsed by:Timeline
Symbol 22 GraphicUsed by:43
Symbol 23 GraphicUsed by:43
Symbol 24 GraphicUsed by:43
Symbol 25 GraphicUsed by:43
Symbol 26 GraphicUsed by:43
Symbol 27 GraphicUsed by:43
Symbol 28 GraphicUsed by:43
Symbol 29 GraphicUsed by:43
Symbol 30 GraphicUsed by:43
Symbol 31 GraphicUsed by:43
Symbol 32 GraphicUsed by:43
Symbol 33 GraphicUsed by:43
Symbol 34 GraphicUsed by:43
Symbol 35 GraphicUsed by:43
Symbol 36 GraphicUsed by:43
Symbol 37 GraphicUsed by:43
Symbol 38 GraphicUsed by:43
Symbol 39 GraphicUsed by:43
Symbol 40 GraphicUsed by:43
Symbol 41 GraphicUsed by:43
Symbol 42 GraphicUsed by:43
Symbol 43 MovieClipUses:22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42Used by:Timeline
Symbol 44 GraphicUsed by:Timeline
Symbol 45 GraphicUsed by:138  Timeline
Symbol 46 GraphicUsed by:138  Timeline
Symbol 47 GraphicUsed by:138  Timeline
Symbol 48 SoundUsed by:Timeline
Symbol 49 GraphicUsed by:Timeline
Symbol 50 GraphicUsed by:Timeline
Symbol 51 GraphicUsed by:Timeline
Symbol 52 GraphicUsed by:Timeline
Symbol 53 GraphicUsed by:Timeline
Symbol 54 GraphicUsed by:Timeline
Symbol 55 GraphicUsed by:Timeline
Symbol 56 GraphicUsed by:Timeline
Symbol 57 GraphicUsed by:Timeline
Symbol 58 GraphicUsed by:Timeline
Symbol 59 ShapeTweeningUsed by:67
Symbol 60 GraphicUsed by:67
Symbol 61 GraphicUsed by:67
Symbol 62 ShapeTweeningUsed by:67
Symbol 63 GraphicUsed by:67
Symbol 64 ShapeTweeningUsed by:67
Symbol 65 GraphicUsed by:67
Symbol 66 GraphicUsed by:67
Symbol 67 MovieClipUses:59 60 61 62 63 64 65 66Used by:Timeline
Symbol 68 GraphicUsed by:Timeline
Symbol 69 GraphicUsed by:Timeline
Symbol 70 GraphicUsed by:Timeline
Symbol 71 GraphicUsed by:Timeline
Symbol 72 GraphicUsed by:76
Symbol 73 FontUsed by:74 88
Symbol 74 TextUses:73Used by:76
Symbol 75 GraphicUsed by:76
Symbol 76 ButtonUses:72 74 75Used by:Timeline
Symbol 77 GraphicUsed by:85
Symbol 78 TextUses:5Used by:85
Symbol 79 FontUsed by:80 81 86
Symbol 80 EditableTextUses:79Used by:85
Symbol 81 TextUses:79Used by:85
Symbol 82 GraphicUsed by:85
Symbol 83 GraphicUsed by:85
Symbol 84 GraphicUsed by:85
Symbol 85 MovieClipUses:77 78 80 81 82 83 84Used by:Timeline
Symbol 86 EditableTextUses:79Used by:Timeline
Symbol 87 GraphicUsed by:92
Symbol 88 TextUses:73Used by:89
Symbol 89 MovieClipUses:88Used by:92
Symbol 90 GraphicUsed by:92
Symbol 91 GraphicUsed by:92
Symbol 92 MovieClip [energyBar]Uses:87 89 90 91Used by:Timeline
Symbol 93 GraphicUsed by:94 97 99
Symbol 94 ButtonUses:93Used by:100
Symbol 95 GraphicUsed by:100
Symbol 96 GraphicUsed by:100
Symbol 97 ButtonUses:93Used by:100
Symbol 98 GraphicUsed by:100
Symbol 99 ButtonUses:93Used by:100
Symbol 100 MovieClipUses:94 95 96 97 98 99Used by:138
Symbol 101 GraphicUsed by:138
Symbol 102 GraphicUsed by:138
Symbol 103 GraphicUsed by:138
Symbol 104 GraphicUsed by:138
Symbol 105 GraphicUsed by:138
Symbol 106 GraphicUsed by:138
Symbol 107 GraphicUsed by:138
Symbol 108 GraphicUsed by:138
Symbol 109 GraphicUsed by:138
Symbol 110 GraphicUsed by:138
Symbol 111 GraphicUsed by:138
Symbol 112 GraphicUsed by:138
Symbol 113 GraphicUsed by:138
Symbol 114 GraphicUsed by:138
Symbol 115 GraphicUsed by:138
Symbol 116 GraphicUsed by:138
Symbol 117 GraphicUsed by:138
Symbol 118 GraphicUsed by:138
Symbol 119 GraphicUsed by:138
Symbol 120 GraphicUsed by:138
Symbol 121 GraphicUsed by:138
Symbol 122 GraphicUsed by:138
Symbol 123 GraphicUsed by:138
Symbol 124 GraphicUsed by:138
Symbol 125 GraphicUsed by:138
Symbol 126 GraphicUsed by:138
Symbol 127 GraphicUsed by:138
Symbol 128 GraphicUsed by:138
Symbol 129 GraphicUsed by:138
Symbol 130 GraphicUsed by:138
Symbol 131 GraphicUsed by:138
Symbol 132 GraphicUsed by:138
Symbol 133 GraphicUsed by:138
Symbol 134 GraphicUsed by:138
Symbol 135 GraphicUsed by:138
Symbol 136 GraphicUsed by:138
Symbol 137 GraphicUsed by:138
Symbol 138 MovieClipUses:100 12 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 16 45 46 18 19 20 47 13 124 125 126 127 128 129 130 131 132 133 134 135 15 136 137Used by:Timeline
Symbol 139 GraphicUsed by:145
Symbol 140 TextUses:5Used by:145
Symbol 141 TextUses:5Used by:145
Symbol 142 TextUses:5Used by:145
Symbol 143 TextUses:5Used by:145
Symbol 144 TextUses:5Used by:145
Symbol 145 MovieClipUses:139 140 141 142 143 144Used by:Timeline
Symbol 146 FontUsed by:147
Symbol 147 TextUses:146Used by:Timeline

Instance Names

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

Special Tags

ExportAssets (56)Timeline Frame 3Symbol 92 as "energyBar"
ExportAssets (56)Timeline Frame 4Symbol 92 as "energyBar"
ExportAssets (56)Timeline Frame 5Symbol 92 as "energyBar"
ExportAssets (56)Timeline Frame 6Symbol 92 as "energyBar"
ExportAssets (56)Timeline Frame 7Symbol 92 as "energyBar"
ExportAssets (56)Timeline Frame 8Symbol 92 as "energyBar"
ExportAssets (56)Timeline Frame 9Symbol 92 as "energyBar"
ExportAssets (56)Timeline Frame 10Symbol 92 as "energyBar"
ExportAssets (56)Timeline Frame 11Symbol 92 as "energyBar"

Labels

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

Dynamic Text Variables

textSymbol 86 EditableText" "




http://swfchan.com/10/48304/info.shtml
Created: 30/4 -2019 05:53:40 Last modified: 30/4 -2019 05:53:40 Server time: 22/12 -2024 14:01:47