亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? plygenerator.java

?? chess 一個beguanyu國際象棋的一個Java源碼
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
/*  PlyGenerator - A class to generate chess moves from a game position.  Copyright (C) 2003 The Java-Chess team <info@java-chess.de>  This program is free software; you can redistribute it and/or  modify it under the terms of the GNU General Public License  as published by the Free Software Foundation; either version 2  of the License, or (at your option) any later version.  This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License for more details.  You should have received a copy of the GNU General Public License  along with this program; if not, write to the Free Software  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.*/ package de.java_chess.javaChess.engine;import de.java_chess.javaChess.*;import de.java_chess.javaChess.bitboard.*;import de.java_chess.javaChess.engine.hashtable.*;import de.java_chess.javaChess.game.*;import de.java_chess.javaChess.piece.*;import de.java_chess.javaChess.ply.*;import de.java_chess.javaChess.position.*;/** * This class generates all possible plies for a  * given game position. */public class PlyGenerator {    // Static variables    // The scores for presorted plies.    private short HASHTABLE_PLY         = 101;    private short QUEEN_TRANSFORMATION  = 100;    private short ROOK_TRANSFORMATION   = 98;    private short BISHOP_TRANSFORMATION = 96;    private short KNIGHT_TRANSFORMATION = 94;    private short MATERIAL_WIN          = 50;    private short REGULAR_PLY           = 20;    // The moves of a knight, of there are no limitations due to position on the board's edge, opponent's pieces  etc.    private static int [] [] _knightPlyOffset = { { -2, -1}, { -2, 1}, { -1, -2}, { -1, 2}, { 1, -2}, { 1, 2}, { 2, -1}, { 2, 1}};    // The moves of a king. Also with no limitations due to board size etc.    private static int [] [] _kingPlyOffset = { { -1, 0}, { -1, 1}, { 0, 1}, { 1, 1}, { 1, 0}, { 1, -1}, { 0, -1}, { -1, -1}};        // Instance variables    /**     * The current game.     */    Game _game;    /**     * A hashtable with already computed plies.     */    PlyHashtable _hashtable;    /**     * The current board.     */    BitBoard _board;    /**     * A analyzer to check for chess (needed for castling)     */    BitBoardAnalyzer _analyzer;    /**     * An array for the current plies to avoid the overhead of dynamic data structures.     */    AnalyzedPly [] _currentPlies = new AnalyzedPlyImpl[150];    /**     * A counter for the currently computed plies.     */    private int _plyCounter = 0;    /**     * Caches for some important bitmasks.     */    long _emptySquares;  // The empty squares.    long _attackablePieces;  // All the pieces of the opponent minus the king.    /**     * The possible knight plies for each square.     */    private long [] _knightMask = new long[64];    /**     * The possible king plies for each square.     */    private long [] _kingMask = new long[64];    /**     * A flag to indicate, if we compute the moves for the player with the white pieces.     */    private boolean _white;    // Constructors    /**     * Create a new instance of a ply generator.     *     * @param game The current game.     * @param hashtable A hashtable to store the best plies so far.     */    public PlyGenerator( Game game, PlyHashtable hashtable) {	setGame( game);	setHashtable( hashtable);	precomputeKnightPlies();	precomputeKingPlies();    }    /**     * Create a new instance of a ply generator      * from a given board.     *     * @param game The current game.     * @param board The board to operate on.     * @param hashtable A hashtable to store the best plies so far.     */    public PlyGenerator( Game game, BitBoard board, PlyHashtable hashtable) {	this( game, hashtable);	setBoard( board);    }    // Methods    /**     * Get the current game.     *     * @return The current game.     */    public final Game getGame() {	return _game;    }    /**     * Set the current game.     *     * @param The current game.     */    public final void setGame( Game game) {	_game = game;    }    /**     * Get the current hashtable for this ply generator.     *     * @return The current hashtable for this ply generator.     */    public final PlyHashtable getHashtable() {	return _hashtable;    }    /**     * Set a new hashtable for this ply generator.     *     * @param hashtable The new hashtable for this ply generator.     */    public final void setHashtable( PlyHashtable hashtable) {	_hashtable = hashtable;    }    /**     * Get the plies for a given board and color.     * Passing the last ply is suboptimal, since it's slower than     * accessing the game history.     *     * @param lastPly The ply, that lead to the given board.     * @param board The board with the game position.     * @param white true, if white has the next move.     */    public final Ply [] getPliesForColor( BitBoard board, boolean white) {	setBoard( board);	return getPliesForColor( white);    }    /**     * Get the plies for a given game position and color.     *     * @param white true, if white has the next move.     */    public final Ply [] getPliesForColor( boolean white) {	resetPlies();	_white = white;  // Store the color of the current player.	// Compute some bitmasks, so we don't have to compute them again for each piece type.	_emptySquares = getBoard().getEmptySquares(); // Get the positions of the empty squares.	_attackablePieces = getBoard().getAllPiecesForColor( ! _white) & ~getBoard().getPositionOfPieces( Piece.KING << 1 | ( _white ? 0 : 1));	// Add the possible plies for all piece types.	// I tried to sort this list according to the probality for a check, so	// the analyzer has a better chance to find it early.	addPliesForKnights();	addPliesForBishops();	addPliesForRooks();	addPliesForQueens();	addPliesForPawns();	addPliesForKing();	// Check, if there's a good ply for this board in the hash table.	Ply hashtablePly = getHashtable().getPly( getBoard(), _white);	if( hashtablePly != null) {  // If so, increase the score of this ply.	    for( int index = 0; index < _plyCounter; index++) {		if( _currentPlies[index].getPly().equals( hashtablePly)) {		    _currentPlies[index].setScore( HASHTABLE_PLY);		    break;		}	    }	}	// Presort the plies	presortPlies();	// Convert the plies to a array of the correct size	Ply [] plies = new Ply[ _plyCounter];	int destIndex = 0;	for( int sourceIndex = (_plyCounter - 1); sourceIndex >= 0; ) {	    plies[ destIndex++] = _currentPlies[ sourceIndex--].getPly();	}	return plies;    }    /**     * Add all the plies for pawns of the current color.     */    private final void addPliesForPawns() {	if( _white) {	    // Get the positions of all pawns	    long pawnPos = getBoard().getPositionOfPieces( Piece.PAWN << 1 | 1);	    // Add all the diagonal attacks	    addRelativePliesUpward( ( ( pawnPos & BitBoard._NOT_LINE_H) << 9) & _attackablePieces, 17, 63, -9);	    addRelativePliesUpward( ( ( pawnPos & BitBoard._NOT_LINE_A) << 7) & _attackablePieces, 16, 62, -7);	    // Check for a en-passent attack	    if( getLastPly() != null) {		Position destination = getLastPly().getDestination();		Piece piece = getBoard().getPiece( destination);		// The check for the color is sorta redundant, but during analysis the		// order of moves might be incorrect.		if( piece != null && piece.getType() == Piece.PAWN && piece.getColor() == Piece.BLACK) {		    int sourceIndex = getLastPly().getSource().getSquareIndex();		    int destinationIndex = getLastPly().getDestination().getSquareIndex();		    // If the pawn moved 2 squares		    if( ( sourceIndex - destinationIndex) == 16) {			int attackableIndex = sourceIndex - 8;			// Compute the bitmask for the pawn.			long attackablePawnBitmask = ( 1L << attackableIndex);			// Add the en passant attacks.			if( ( ( ( pawnPos & BitBoard._NOT_LINE_H) << 9) & attackablePawnBitmask) != 0L) {			    addPly( new EnPassantPlyImpl( new PositionImpl( attackableIndex - 9)			                 	          , new PositionImpl( attackableIndex)				                          , new PositionImpl( destinationIndex))				    , MATERIAL_WIN);			}			// Add the en passant attacks.			if( ( ( ( pawnPos & BitBoard._NOT_LINE_H) << 7) & attackablePawnBitmask) != 0L) {			    addPly( new EnPassantPlyImpl( new PositionImpl( attackableIndex - 7)			                 	          , new PositionImpl( attackableIndex)				                          , new PositionImpl( destinationIndex))				    , MATERIAL_WIN);			}		    }		}	    }	    // Add all the 2 square plies. Since the square in front of the pawn has to be free, I have to	    // add the bit and with the shifted empty squares.	    addRelativePliesUpward( ( (pawnPos & BitBoard._ROW_2 & ( _emptySquares >>> 8) ) << 16) & _emptySquares, 24, 31, -16);	    // Add all the 1 square plies.	    long movedPawns = (pawnPos << 8) & _emptySquares;	    addRelativePliesUpward( movedPawns & BitBoard._NOT_ROW_8, 16, 55, -8);	    	    // Now take care of the last row.	    movedPawns &= BitBoard._ROW_8;	    while( movedPawns != 0L) {		int destinationSquare = BitUtils.getHighestBit( movedPawns);		int sourceSquare = destinationSquare - 8;		// Add all transformation types as plies.		boolean capture = ( ( ( 1L << destinationSquare) & _attackablePieces) != 0L);		addTransformationPly( sourceSquare, destinationSquare, Piece.QUEEN, capture, QUEEN_TRANSFORMATION);		addTransformationPly( sourceSquare, destinationSquare, Piece.KNIGHT, capture, KNIGHT_TRANSFORMATION);		addTransformationPly( sourceSquare, destinationSquare, Piece.ROOK, capture, ROOK_TRANSFORMATION);		addTransformationPly( sourceSquare, destinationSquare, Piece.BISHOP, capture, BISHOP_TRANSFORMATION);		movedPawns &= ~( 1L << destinationSquare);	    }	} else {	    // Get the positions of all pawns	    long pawnPos = getBoard().getPositionOfPieces( Piece.PAWN << 1);	    // Add all the diagonal attacks	    addRelativePliesDownward( ( ( pawnPos & BitBoard._NOT_LINE_A) >>> 9) & _attackablePieces, 46, 0, 9);	    addRelativePliesDownward( ( ( pawnPos & BitBoard._NOT_LINE_H) >>> 7) & _attackablePieces, 47, 0, 7);	    // Check for a en-passent attack	    if( getLastPly() != null) {		Position destination = getLastPly().getDestination();		Piece piece = getBoard().getPiece( destination);		// The check for the color is sorta redundant, but during analysis the		// order of moves might be incorrect.		if( piece != null && piece.getType() == Piece.PAWN && piece.getColor() == Piece.BLACK) {		    int sourceIndex = getLastPly().getSource().getSquareIndex();		    int destinationIndex = getLastPly().getDestination().getSquareIndex();		    // If the pawn moved 2 squares		    if( ( destinationIndex - sourceIndex) == 16) {			int attackableIndex = sourceIndex + 8;			// Compute the bitmask for the pawn.			long attackablePawnBitmask = ( 1L << attackableIndex);			// Add the en passant attacks.			if( ( ( ( pawnPos & BitBoard._NOT_LINE_H) >>> 9) & attackablePawnBitmask) != 0L) {			    addPly( new EnPassantPlyImpl( new PositionImpl( attackableIndex + 9)			                 	          , new PositionImpl( attackableIndex)				                          , new PositionImpl( destinationIndex))				    , MATERIAL_WIN);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲人成网站精品片在线观看 | 岛国精品在线观看| 日韩avvvv在线播放| 亚洲国产日韩在线一区模特| 一区二区三区在线观看视频| 亚洲视频资源在线| 一区二区在线观看不卡| 亚洲欧美国产高清| 亚洲综合一区二区| 五月天中文字幕一区二区| 丝袜美腿高跟呻吟高潮一区| 人禽交欧美网站| 久久99精品久久久| 国产激情91久久精品导航| 国产黑丝在线一区二区三区| 成人福利视频网站| 色哟哟欧美精品| 欧美日韩国产高清一区| 欧美一级一区二区| 久久久综合九色合综国产精品| 久久精品综合网| 亚洲免费观看高清完整| 午夜精品免费在线| 韩国av一区二区| 成人美女视频在线观看| 在线影院国内精品| 欧美一区二区视频在线观看2020| 欧美变态口味重另类| 久久免费精品国产久精品久久久久| 国产三级欧美三级日产三级99| 亚洲欧美怡红院| 亚洲国产人成综合网站| 看电视剧不卡顿的网站| 福利电影一区二区| 在线观看日韩精品| 欧美成人精精品一区二区频| 中文字幕第一区| 亚洲福利视频一区| 国内精品久久久久影院色| av亚洲精华国产精华精| 欧美日韩国产综合久久| 久久久久成人黄色影片| 亚洲三级在线免费观看| 日本一道高清亚洲日美韩| 国产精一品亚洲二区在线视频| 99九九99九九九视频精品| 欧美一个色资源| 国产精品网曝门| 日韩精品一区第一页| 成人在线视频一区| 欧美挠脚心视频网站| 国产日韩欧美精品综合| 亚洲成av人片一区二区| 国产99精品国产| 欧美日韩国产精品自在自线| 亚洲国产激情av| 日本系列欧美系列| 色婷婷综合久色| 26uuu色噜噜精品一区| 一级中文字幕一区二区| 国产一区福利在线| 欧美日韩高清在线播放| 国产精品每日更新| 韩日精品视频一区| 制服丝袜成人动漫| 亚洲另类春色校园小说| 国产麻豆视频一区| 欧美一区二区三区视频在线| 亚洲欧美日韩小说| 风流少妇一区二区| 精品动漫一区二区三区在线观看| 亚洲午夜一区二区三区| 不卡一区在线观看| 久久精子c满五个校花| 日韩成人免费电影| 在线免费观看成人短视频| 中文字幕不卡在线观看| 国内成人精品2018免费看| 欧美男人的天堂一二区| 伊人一区二区三区| 99视频精品在线| 国产欧美日韩视频在线观看| 久久精品国产99国产精品| 欧美喷潮久久久xxxxx| 亚洲一区在线观看视频| 99久久99久久综合| 国产精品久久久久久亚洲伦| 国产精品一品视频| 久久网这里都是精品| 久久99精品国产麻豆婷婷洗澡| 欧美一区二区不卡视频| 午夜国产精品一区| 欧美日韩一区二区在线视频| 亚洲精选视频在线| 91麻豆自制传媒国产之光| 国产精品传媒入口麻豆| 成人app在线观看| 中文字幕欧美国产| 成人中文字幕合集| 中文字幕亚洲在| 99久久久免费精品国产一区二区| 中文字幕国产一区| 成人国产精品免费观看视频| 中文字幕av一区二区三区| 不卡视频一二三| 自拍偷自拍亚洲精品播放| 9人人澡人人爽人人精品| 国产精品卡一卡二| av成人动漫在线观看| 亚洲男人的天堂av| 欧美日韩中文另类| 天使萌一区二区三区免费观看| 欧美精品亚洲一区二区在线播放| 肉丝袜脚交视频一区二区| 欧美一区二区三区视频| 极品美女销魂一区二区三区免费| 精品国产污网站| 国产精品123| 亚洲三级免费电影| 欧洲在线/亚洲| 日韩不卡手机在线v区| 欧美成va人片在线观看| 国产成人精品免费看| 国产精品久久久久久久久晋中| 91亚洲精品久久久蜜桃网站| 亚洲国产美女搞黄色| 欧美一区二区在线观看| 国内精品视频666| 国产精品你懂的在线| 色狠狠桃花综合| 日韩av一二三| 精品国产一区二区精华| 高清不卡一二三区| 亚洲一区二区三区四区五区中文 | 一区二区三区在线观看网站| 欧美伦理影视网| 国产经典欧美精品| 亚洲一卡二卡三卡四卡无卡久久| 91精品国产91久久久久久最新毛片| 狠狠狠色丁香婷婷综合久久五月| 亚洲欧洲日产国产综合网| 欧美日韩和欧美的一区二区| 国产一区91精品张津瑜| 亚洲老妇xxxxxx| 2022国产精品视频| 91美女片黄在线观看91美女| 免费在线一区观看| 国产精品女人毛片| 91精品国产一区二区三区| 成人精品视频网站| 日韩精品一级中文字幕精品视频免费观看| 久久人人爽人人爽| 欧美午夜一区二区| 国产一区在线观看麻豆| 亚洲综合色自拍一区| 久久精品视频在线看| 欧美色图一区二区三区| 国产精品一区久久久久| 亚洲成年人影院| 国产精品你懂的在线欣赏| 91精品国产91久久综合桃花| 91丨国产丨九色丨pron| 九色porny丨国产精品| 一区二区三区在线高清| 国产亚洲一区二区三区四区| 欧美日韩免费视频| kk眼镜猥琐国模调教系列一区二区| 青青青伊人色综合久久| 亚洲黄色片在线观看| 国产三级欧美三级| 日韩视频一区二区| 欧美亚洲综合一区| 本田岬高潮一区二区三区| 精品一区二区三区不卡| 亚洲国产精品麻豆| 国产精品久久久久久久久果冻传媒| 欧美大白屁股肥臀xxxxxx| 欧美日韩精品欧美日韩精品| 97精品久久久午夜一区二区三区| 国产一区二区三区久久悠悠色av| 日韩高清国产一区在线| 亚洲人成网站色在线观看| 中文av一区二区| 久久精品视频一区二区| 日韩三级伦理片妻子的秘密按摩| 欧美日韩一区二区三区四区五区| 97国产一区二区| 成人高清av在线| 国产成人a级片| 国内精品免费**视频| 九色|91porny| 精品综合久久久久久8888| 日韩精品视频网| 婷婷夜色潮精品综合在线| 一区二区三区波多野结衣在线观看 | 色综合久久久久综合体| 成人国产精品免费网站| 成人免费毛片嘿嘿连载视频| 国产乱人伦偷精品视频不卡| 蜜臀va亚洲va欧美va天堂 |