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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 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);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区在线播放视频| 精品一区二区三区香蕉蜜桃| 在线观看av一区| 国产一区欧美日韩| 婷婷亚洲久悠悠色悠在线播放| 欧美极品少妇xxxxⅹ高跟鞋 | 午夜av电影一区| 国内精品不卡在线| 成人一区二区三区视频在线观看| 久久99精品国产麻豆不卡| 91影视在线播放| 99久久综合99久久综合网站| a美女胸又www黄视频久久| 日韩女优毛片在线| 精品国内二区三区| 精品成人a区在线观看| 亚洲一区二区黄色| 男人的天堂亚洲一区| 日韩电影一二三区| 国内精品久久久久影院色| 欧美老人xxxx18| 欧美一区二区三区在线观看| 精品国产91洋老外米糕| 亚洲成人综合在线| 国产美女精品在线| 精品日本一线二线三线不卡| 国产精品久久免费看| 亚洲高清久久久| 国内精品写真在线观看 | 国产精品亚洲一区二区三区妖精| 成人av在线网站| 欧美性猛交xxxx乱大交退制版 | 在线观看日韩av先锋影音电影院| 国产欧美日韩不卡免费| 一区二区三区在线视频观看| 日欧美一区二区| 成人三级在线视频| 久久精品日韩一区二区三区| 一区在线观看免费| 97精品视频在线观看自产线路二| 欧美人伦禁忌dvd放荡欲情| 精品日韩99亚洲| 激情成人综合网| 久久综合资源网| 亚洲超碰97人人做人人爱| 欧美性生活久久| 亚洲高清在线视频| 欧美一区二区三区免费视频| 日本aⅴ免费视频一区二区三区 | 亚洲国产视频一区二区| 欧美综合色免费| 三级影片在线观看欧美日韩一区二区| 欧美日韩视频一区二区| 国产日产欧美一区二区三区| 99在线精品观看| 夜夜亚洲天天久久| 欧美一区二区性放荡片| 国产精品白丝jk黑袜喷水| 自拍偷拍亚洲欧美日韩| 国产成人精品免费| 日韩欧美国产一区在线观看| 国产综合成人久久大片91| 亚洲国产成人午夜在线一区| 在线视频亚洲一区| 奇米精品一区二区三区在线观看| 久久精品视频免费观看| 色婷婷综合久久久中文字幕| 国产欧美一区二区精品性| 成人av第一页| 首页国产丝袜综合| 国产日韩av一区| 欧美日韩一区二区三区在线| 精品一区二区免费看| 中文字幕在线不卡一区| 4438x成人网最大色成网站| 亚洲自拍偷拍网站| 亚洲精品在线电影| 91网站最新网址| 久久精品国产免费| 亚洲精品一区二区三区四区高清| 91网站黄www| 国产一区二区三区免费观看| 艳妇臀荡乳欲伦亚洲一区| 久久只精品国产| 欧美影院精品一区| 国产成人a级片| 人禽交欧美网站| 樱桃视频在线观看一区| 欧美日韩精品一区视频| av在线不卡观看免费观看| 免费一级片91| 一区二区三区精品| 国产精品色在线观看| 97精品超碰一区二区三区| 精品无人区卡一卡二卡三乱码免费卡 | 成人性生交大合| 九一久久久久久| 图片区小说区区亚洲影院| 亚洲色图色小说| 国产欧美精品在线观看| 日韩欧美精品在线视频| 欧美日本一区二区三区四区| 91成人免费在线| 亚洲成人综合在线| 尤物视频一区二区| 亚洲视频在线观看三级| 中文字幕一区二区三区不卡| 久久看人人爽人人| 在线看日本不卡| 99久久er热在这里只有精品66| 国产成人夜色高潮福利影视| 黑人精品欧美一区二区蜜桃| 青青草国产精品亚洲专区无| 香蕉av福利精品导航| 午夜视频在线观看一区二区 | 91在线一区二区| 99久久综合色| 成人sese在线| 99这里只有精品| 99精品久久只有精品| 波多野结衣视频一区| 成人av资源站| 91亚洲男人天堂| 91福利在线导航| 欧美日韩国产首页在线观看| 欧美视频一区二区三区| 在线观看91精品国产麻豆| 在线播放视频一区| 欧美va日韩va| 欧美国产一区视频在线观看| 中文字幕 久热精品 视频在线| 中文字幕免费在线观看视频一区| 国产精品国产精品国产专区不片| 亚洲欧洲日韩av| 亚洲精选免费视频| 午夜伊人狠狠久久| 国产一区二区三区香蕉| k8久久久一区二区三区| 91官网在线免费观看| 欧美日韩国产片| 精品国产91洋老外米糕| 国产精品乱码妇女bbbb| 亚洲欧洲精品成人久久奇米网| 夜夜嗨av一区二区三区四季av| 免费人成网站在线观看欧美高清| 韩国三级在线一区| caoporn国产一区二区| 欧美视频在线播放| 久久蜜臀精品av| 亚洲一区自拍偷拍| 久久激情五月激情| 99综合电影在线视频| 91麻豆精品国产91久久久久久久久| 日韩一区二区三区四区| 欧美三级电影精品| 久久蜜臀中文字幕| 亚洲大片一区二区三区| 国产美女精品人人做人人爽| 在线看国产日韩| 久久先锋影音av| 一区二区三区在线视频播放| 美国毛片一区二区| 免费不卡在线视频| 93久久精品日日躁夜夜躁欧美| 欧美一区午夜精品| 国产精品国产三级国产aⅴ中文| 日韩电影在线一区二区三区| 国产精品一区二区视频| 欧美精品亚洲二区| 亚洲日本中文字幕区| 精品午夜一区二区三区在线观看| 一本色道久久加勒比精品| 久久亚洲私人国产精品va媚药| 亚洲一区二区三区不卡国产欧美| 国产成人av一区二区三区在线观看| 欧美怡红院视频| 中文字幕视频一区二区三区久| 日本视频免费一区| 欧美色图在线观看| 亚洲色欲色欲www在线观看| 精品一区二区在线视频| 欧美色图激情小说| 亚洲精品亚洲人成人网在线播放| 国产一区二区福利| 欧美哺乳videos| 日日摸夜夜添夜夜添精品视频| 91久久香蕉国产日韩欧美9色| 国产欧美一区二区精品忘忧草| 免费观看在线色综合| 欧美区视频在线观看| 亚洲女人小视频在线观看| 亚州成人在线电影| 色婷婷综合久久久中文一区二区| 国产精品午夜电影| 成人在线视频首页| 国产亚洲成aⅴ人片在线观看| 精品中文字幕一区二区| 日韩精品一区国产麻豆| 日本中文字幕一区| 欧美一区二区性放荡片|