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

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

?? chessengineimpl.java

?? chess 一個(gè)beguanyu國際象棋的一個(gè)Java源碼
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
    /**     * Get the current opening book.     *     * @return The current opening book.     */    private final OpeningBook getOpeningBook() {	return _openingBook;    }    /**     * Set a new opening book.     *     * @param book The new opening book.     */    private final void setOpeningBook( OpeningBook book) {	_openingBook = book;    }    /**     * Get the flag to indicate, if we are still in the opening book.     *     * @return true, if we are still in the opening book. False otherwise.     */    private final boolean inOpeningBook() {	return _inOpeningBook;    }    /**     * Set the flag to indicate, if we are still in the opening book.     *     * @param inBook true, if we are still in the opening book. False otherwise.     */    private final void setInOpeningBook( boolean inBook) {	_inOpeningBook = inBook;    }    /**     * Start a new thread to search for a ply.     */    public void start() {	if( _searchThread == null) {	    setSearchStop( false);	    _searchThread = new Thread( this);	    _searchThread.start();	}    }    /**     * Compute the best ply for the current position.     *     * @return The best known ply for the current position.     */    public Ply computeBestPly() {	_bestPly = null;  // Remove ply from last computation.	long startTime = System.currentTimeMillis();	if( inOpeningBook()) {	    _bestPly = getOpeningBook().getOpeningBookPly();	    if( _bestPly == null) {  // If there's no ply in the opening book.		setInOpeningBook( false);	    }	}	if( _bestPly == null) {  // If we don't have a ply yet	    start();	    try {		Thread.sleep( getMaximumSearchTime());		setSearchStop( true);		// if( this.bFixedTime == false) {		    _searchThread.join();      // Wait for the search thread to end the search at this search depth.		// }		_searchThread = null;      // Remove the thread, so it can be recreated for the next move.	    } catch( InterruptedException ignored) {	    }	}	long usedTime = System.currentTimeMillis() - startTime;	if( _bestPly != null) {	    if ( this._enginePanel != null ) {		StringBuffer sOut = new StringBuffer();		sOut.append( "Best ply: ");		sOut.append( _bestPly.getPly().toString());		sOut.append( " with score ");		sOut.append( _bestPly.getScore());		sOut.append( " and search depth ");		sOut.append( getSearchDepth());		this._enginePanel.modifyText( sOut.toString());		sOut = new StringBuffer();		sOut.append( "Analyzed boards: ");		sOut.append( getAnalyzedBoards());		sOut.append( " in ");		sOut.append( usedTime);		sOut.append( " ms");		this._enginePanel.modifyText( sOut.toString());	    }	    if ( this._statusPanel != null )		this._statusPanel.setStatusText( "Your turn..." );	    return _bestPly.getPly();	}	return null;    }    /**     * The main method of the search thread.     */    public void run() {	// setAnalyzedBoards( 0L);  // Is done in the permanent brain now.	setSearchDepth( 0);	// Try to get a move from the permanent brain.	PreComputedPly permanentBrainPly = usePermanentBrain() ? getPermanentBrain().getPlyForUserPly( _lastUserPly) : null;	// If we actually have a precomputed ply, adjust the search parameters.	if( permanentBrainPly != null) {	    _bestPly = permanentBrainPly.getPly();	    setSearchDepth( permanentBrainPly.getSearchDepth());  // depth is increased before next search!	    if ( this._enginePanel != null ) {		StringBuffer sOutput = new StringBuffer();		sOutput.append( "Best ply for search depth ");		sOutput.append( getSearchDepth());		sOutput.append( " is ");		sOutput.append( _bestPly.getPly().toString());		sOutput.append( " with score ");		sOutput.append( _bestPly.getScore());		this._enginePanel.modifyText( sOutput.toString() );	    }	}	// The following search is rather inefficent at the moment, since we should try to get a principal variant	// from a search, so we can presort the plies for the next search.	do {	    increaseSearchDepth();	    AnalyzedPly searchDepthResult = null;	    try {		searchDepthResult = startMinimaxAlphaBeta( isWhite());	    } catch( InterruptedException ignored) {  // The search was just interrupted here, so we don't have to throw this exception...		decreaseSearchDepth();  // But the search depth is 1 too high.	    }	    if( searchDepthResult != null) {  // The exception might not be the only case, where a null is returned, so keep		                              // this additional test.		if ( this._statusPanel != null )		    this._statusPanel.setStatusText( "Thinking..." );		_bestPly = searchDepthResult;		if ( this._enginePanel != null ) {		    StringBuffer sOutput = new StringBuffer();		    sOutput.append( "Best ply for search depth ");		    sOutput.append( getSearchDepth());		    sOutput.append( " is ");		    sOutput.append( _bestPly.getPly().toString());		    sOutput.append( " with score ");		    sOutput.append( _bestPly.getScore());		    this._enginePanel.modifyText( sOutput.toString());		}	    }	    // If search depth 1 was completed and no valid ply was found,	    // it seems that the computer is checkmate and the search can be aborted.	} while( ! isSearchStop() && ( _bestPly != null));    }    /**     * Start a complete Minimax-Alpha-Beta search. This is the search level 1, where we have to store the     * analyzed ply, so it gets a special method.     *     * @param white Flag to indicate, if white is about to move.     *     * @throws InterruptedException if the search was interrupted because of a timeout.     */    public final AnalyzedPly startMinimaxAlphaBeta( boolean white) throws InterruptedException {	short curAlpha = AnalyzedPly.MIN_SCORE;	short curBeta = AnalyzedPly.MAX_SCORE;	int bestPlyIndex = -1;	Ply [] plies = _plyGenerator.getPliesForColor( (BitBoard)getBoard(), white);	if( white) {	    for( int i = 0; i < plies.length; i++) {		if( isSearchStop() && ( getSearchDepth() > 1)) {  // If the search time is over and at least depth 1 was completed		    throw new InterruptedException( "Search interrupted at depth " + getSearchDepth());  // abort the search.		}		getGame().doPly( plies[i]);		short val;		try {		    val = minimaxAlphaBeta( plies[i], getBoard().getBoardAfterPly( plies[i]), false, 1, curAlpha, curBeta);		} catch( InterruptedException ie) {		    getGame().undoLastPly();  // Undo the last move		    throw ie;                 // and pass the exception.		}		if( val > curAlpha) {		    curAlpha = val;		    bestPlyIndex = i;		}		if( curAlpha >= curBeta) {		    getGame().undoLastPly();  // Take the last ply back, before the loop is aborted.		    break;		}		getGame().undoLastPly();	    }	    if( bestPlyIndex != -1) {		// Since this is the best ply so far, we store it in the hashtable. This makes sense,		// since the minimax algorithm is started several times, before a move is selected.		// So this move is not necessarily applied immediately!		getHashtable().pushEntry( new PlyHashtableEntryImpl( getBoard(), plies[bestPlyIndex], getSearchDepth()));		return new AnalyzedPlyImpl( plies[bestPlyIndex], curAlpha);	    } else {		return null;	    }	} else {	    for( int i = 0; i < plies.length; i++) {		if( isSearchStop() && ( getSearchDepth() > 1)) {  // If the search time is over and at least depth 1 was completed		    throw new InterruptedException( "Search interrupted at depth " + getSearchDepth());  // abort the search.		}		getGame().doPly( plies[i]);		short val;		try {		    val = minimaxAlphaBeta( plies[i], getBoard().getBoardAfterPly( plies[i]), true, 1, curAlpha, curBeta);		} catch( InterruptedException ie) {		    getGame().undoLastPly();  // Undo the last move		    throw ie;                 // and pass the exception.		}		if( val < curBeta) {		    curBeta = val;		    bestPlyIndex = i;		}		if( curBeta <= curAlpha) {		    getGame().undoLastPly();  // Take the last ply back, before the loop is aborted.		    break;		}		getGame().undoLastPly();	    }	    if( bestPlyIndex != -1) {		// Since this is the best ply so far, we store it in the hashtable. This makes sense,		// since the minimax algorithm is started several times, before a move is selected.		// So this move is not necessarily applied immediately!		getHashtable().pushEntry( new PlyHashtableEntryImpl( getBoard(), plies[bestPlyIndex], getSearchDepth()));		return new AnalyzedPlyImpl( plies[bestPlyIndex], curBeta);	    } else {		return null;	    }	}    }    /**     * Perform a alpha-beta minimax search on the board.     *     * @param lastPly The ply, that created this board.     * @param board The board to analyze.     * @param white true, if white has the next move.     * @param byte searchLevel The level to search for.     * @param alpha The current maximum.     * @param beta The current minimum.     *     * @throws InterruptedException if the search was interrupted because of a timeout.     */    private final short minimaxAlphaBeta( Ply lastPly, Board board, boolean white, int searchLevel, short alpha, short beta) throws InterruptedException {	if( ( searchLevel >= getSearchDepth()) 	    && ( ! lastPly.isCapture() 		 || ! ( lastPly instanceof TransformationPly) 		 || ! _analyzer.isInCheck( (BitBoard)board, ! white))) {	    increaseAnalyzedBoards();	    return analyzeBoard( board);	} else {	    short curAlpha = alpha;	    short curBeta = beta;	    int bestPlyIndex = -1;	    Ply [] plies = _plyGenerator.getPliesForColor( (BitBoard)board, white);	    if( white) {		for( int i = 0; i < plies.length; i++) {		    if( isSearchStop() && ( getSearchDepth() > 1)) {  // If the search time is over and at least depth 1 was completed			throw new InterruptedException( "Search interrupted at depth " + getSearchDepth());  // abort the search.		    }		    getGame().doPly( plies[i]);		    short val;		    try {			val = minimaxAlphaBeta( plies[i], board.getBoardAfterPly( plies[i]), false, searchLevel + 1, curAlpha, curBeta);		    } catch( InterruptedException ie) {			getGame().undoLastPly();  // Undo the last move			throw ie;                 // and pass the exception.		    }		    if( val > curAlpha) {			curAlpha = val;			bestPlyIndex = i;  // Store the index of this ply, so we can access it later.		    }		    if( curAlpha >= curBeta) {			getGame().undoLastPly();  // Take the last ply back, before the loop is aborted.			break;		    }		    getGame().undoLastPly();		}		if( bestPlyIndex != -1) {		    // Since this is the best ply for this search level, we store it in the hashtable		    getHashtable().pushEntry( new PlyHashtableEntryImpl( board, plies[ bestPlyIndex], getSearchDepth() - searchLevel));		} else {                    if( plies.length == 0) {  // There are no legal moves available?		        if( _analyzer.isInCheck( (BitBoard)board, white)) {  // Is this a checkmate?			    return BitBoardAnalyzer.BLACK_HAS_WON;		        } else {  // Looks like a draw?			    return BitBoardAnalyzer.DRAW;                        }                    }		}		return curAlpha;	    } else {		for( int i = 0; i < plies.length; i++) {		    if( isSearchStop() && ( getSearchDepth() > 1)) {  // If the search time is over and at least depth 1 was completed			throw new InterruptedException( "Search interrupted at depth " + getSearchDepth());  // abort the search.		    }		    getGame().doPly( plies[i]);		    short val;		    try {			val = minimaxAlphaBeta( plies[i], board.getBoardAfterPly( plies[i]), true, searchLevel + 1, curAlpha, curBeta);		    } catch( InterruptedException ie) {			getGame().undoLastPly();  // Undo the last move			throw ie;                 // and pass the exception.		    }		    if( val < curBeta) {			curBeta = val;			bestPlyIndex = i;  // Store the index of this ply, so we can access it later.		    }		    if( curBeta <= curAlpha) {			getGame().undoLastPly();  // Take the last ply back, before the loop is aborted.			break;		    }		    getGame().undoLastPly();		}		if( bestPlyIndex != -1) {		    // Since this is the best ply for this search level, we store it in the hashtable		    getHashtable().pushEntry( new PlyHashtableEntryImpl( board, plies[ bestPlyIndex], getSearchDepth() - searchLevel));		} else {                    if( plies.length == 0) {  // There are no legal moves available?		        if( _analyzer.isInCheck( (BitBoard)board, white)) {  // Is this a checkmate?			    return BitBoardAnalyzer.WHITE_HAS_WON;		        } else {  // Looks like a draw?			    return BitBoardAnalyzer.DRAW;                        }                    }		}		return curBeta;	    }	}    }    /**     * Compute a score for a game position.     *     * @return A score for the current game position.     */    public final short analyzeBoard( Board board) {	return _analyzer.analyze( (BitBoard)board, isWhite());    }    /**     * Get all the potential plies for the human player.     *     * @return All the potential plies for the human player.     */    public final Ply [] getUserPlies() {	return _plyGenerator.getPliesForColor( (BitBoard)getBoard(), ! isWhite());    }    /**     * Check if a ply made by the user is valid.     *     * @param ply The user ply.     *     * @return true, if the ply is valid. false otherwise.     */    public final boolean validateUserPly( Ply ply) {	// Get the user plies from the permanent brain, where they	// were hopefully already computed (if the PB is actually active).	Ply [] plies = getPermanentBrain().getUserPlies();	// If the permanent brain is not activated at the moment, remove the	// computed plies immediately, so they are recomputed for the next move!	if( ! usePermanentBrain()) {	    getPermanentBrain().resetUserPlies();	}	for( int p = 0; p < plies.length; p++) {  // For each ply	    if( plies[p].equals( ply)) {          // if the user ply equals this computed		// Perform this ply in the opening book		getOpeningBook().doUserPly( ply);		// Store the last user ply in a instance variable.		_lastUserPly = ply;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美草草影院在线视频| 欧美一级国产精品| 免费成人在线影院| 国产精品久久久久7777按摩| 欧美精品v国产精品v日韩精品| 国产福利91精品一区二区三区| 亚洲少妇屁股交4| wwww国产精品欧美| 欧美日韩黄色影视| 91浏览器打开| 国产成人8x视频一区二区| 日本美女一区二区三区视频| 亚洲欧美一区二区三区国产精品 | 久久久精品免费观看| 欧美一区日韩一区| 在线观看欧美黄色| 91蜜桃免费观看视频| 欧美午夜影院一区| 成人福利视频在线| 国产精品一区2区| 久久精品国产亚洲高清剧情介绍| 亚洲韩国精品一区| 亚洲黄色在线视频| 亚洲美女视频一区| 国产精品久久久久影院老司| 久久人人爽爽爽人久久久| 欧美一区二区三区视频在线观看 | 国产成人99久久亚洲综合精品| 蜜芽一区二区三区| 午夜精品久久久久久久| 亚洲永久免费av| 亚洲裸体在线观看| 亚洲欧美一区二区久久| 国产欧美精品区一区二区三区| 久久日一线二线三线suv| 精品嫩草影院久久| 欧美岛国在线观看| 精品99999| 久久蜜桃av一区精品变态类天堂 | 国产精品一色哟哟哟| 久久福利资源站| 久久精品国产成人一区二区三区| 亚洲h动漫在线| 肉色丝袜一区二区| 秋霞av亚洲一区二区三| 老司机精品视频线观看86 | 国产午夜精品一区二区三区视频| 精品国产伦理网| 久久影院电视剧免费观看| 日韩三级视频中文字幕| 亚洲精品一区二区三区在线观看| 精品日韩一区二区三区免费视频| 久久久另类综合| 中文一区二区在线观看| 日韩一区在线播放| 亚洲午夜精品在线| 青青草国产精品97视觉盛宴| 久久精品国产亚洲一区二区三区| 国产一区二区91| av不卡在线观看| 欧美在线视频你懂得| 91精品免费在线观看| 精品久久99ma| 国产精品热久久久久夜色精品三区 | 国产99久久久国产精品免费看| 国产成人av一区二区| 91最新地址在线播放| 欧美日本视频在线| 久久午夜国产精品| 亚洲欧美偷拍三级| 日本不卡的三区四区五区| 国产一区不卡视频| 色综合久久天天综合网| 91精品国产一区二区三区蜜臀| www激情久久| 一区二区欧美视频| 精品在线一区二区三区| 色综合久久综合| 日韩美女视频在线| 亚洲人成网站色在线观看| 视频一区二区欧美| 国产aⅴ综合色| 56国语精品自产拍在线观看| 久久精品一区蜜桃臀影院| 亚洲综合一区二区| 极品少妇一区二区| 欧美制服丝袜第一页| 国产亚洲欧美日韩在线一区| 亚洲综合一区二区精品导航| 国产剧情一区在线| 欧美日韩精品欧美日韩精品一| 国产午夜亚洲精品羞羞网站| 视频一区中文字幕| 91免费看片在线观看| 精品久久久久久无| 亚洲一区二区三区四区在线 | 欧美精品黑人性xxxx| 国产精品美女久久久久久2018| 日韩国产成人精品| 日本精品一区二区三区高清| 久久精品无码一区二区三区| 香蕉成人伊视频在线观看| 99riav久久精品riav| 久久一区二区三区国产精品| 亚洲观看高清完整版在线观看| 成人v精品蜜桃久久一区| 精品久久久久久无| 丝袜美腿一区二区三区| 91久久一区二区| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 欧美三级视频在线观看| 国产精品萝li| 国产一区二区精品久久91| 欧美一级片在线| 精品久久久久久无| 欧美视频在线观看一区二区| 日本成人中文字幕| 欧美人牲a欧美精品| 久久日一线二线三线suv| 韩国在线一区二区| 综合久久久久久| 欧美日韩国产一级| 亚洲成人高清在线| 国产亚洲精品超碰| 91视频免费看| 免费成人美女在线观看.| 久久久www免费人成精品| 国产乱码精品一品二品| 国产精品久久午夜夜伦鲁鲁| 欧美四级电影网| 国产原创一区二区三区| 国产欧美日韩视频在线观看| 欧美主播一区二区三区美女| 精品在线免费观看| 亚洲图片另类小说| 精品久久人人做人人爽| 丰满放荡岳乱妇91ww| 亚洲国产精品影院| 国产精品久久久一区麻豆最新章节| 99热国产精品| 麻豆精品国产91久久久久久| 日韩欧美中文一区二区| 国产成人鲁色资源国产91色综| 日本一区二区动态图| 91免费版在线看| 九九国产精品视频| 亚洲欧洲综合另类| 日韩欧美综合一区| 欧美性猛交xxxx黑人交| 国产成人综合网| 亚洲日韩欧美一区二区在线| 欧美精品国产精品| 日本久久精品电影| 在线观看亚洲a| 色域天天综合网| 狠狠色丁香婷婷综合| 中文字幕中文字幕一区二区| 欧美激情一区二区三区在线| 精品国产一区二区三区av性色| 粉嫩一区二区三区性色av| 青青草国产成人99久久| 一区二区三区精品在线观看| 欧美怡红院视频| 26uuu精品一区二区| 亚洲欧美日韩在线播放| 亚洲综合丝袜美腿| 久久精品免费观看| a在线欧美一区| 亚洲一区二区三区四区在线免费观看 | 日本va欧美va瓶| 久久品道一品道久久精品| 成人av高清在线| 午夜一区二区三区在线观看| 精品电影一区二区三区| 91丨九色porny丨蝌蚪| 日韩高清不卡一区| 日本一区二区三区国色天香 | 久久综合狠狠综合| 91久久精品一区二区三区| 麻豆精品视频在线| 国产精品久久毛片a| 欧美一区二区三区在线视频| 成人高清伦理免费影院在线观看| 午夜精品福利一区二区三区av | 色婷婷精品久久二区二区蜜臀av | 欧美性视频一区二区三区| 韩国成人在线视频| 一区二区三区四区乱视频| 欧美videos大乳护士334| 91浏览器在线视频| 国产精品自产自拍| 视频在线在亚洲| 亚洲人妖av一区二区| 精品欧美一区二区在线观看| 91九色最新地址| 国产·精品毛片| 久草中文综合在线| 亚洲gay无套男同| 国产精品久久久久天堂| 精品少妇一区二区|