⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aspirationsearch.cpp

📁 一个简单的象棋游戏源代码
💻 CPP
字号:
// AspirationSearch.cpp: implementation of the CAspirationSearch class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "AspirationSearch.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CAspirationSearch::CAspirationSearch()
{

}

CAspirationSearch::~CAspirationSearch()
{

}

CAspirationSearch::SearchAGoodMove(BYTE position[][9])
{
	int x,y;

	memcpy(CurPosition,position,90);
	
	//先进行浅层搜索,猜测目标值范围
	m_nMaxDepth=m_nSearchDepth-1;
	x=FAlphaBeta(m_nMaxDepth,-20000,20000);
	
	m_pThinkProgress->SetPos(0);
	//对目标值附近的小窗口进行搜索
	m_nMaxDepth=m_nSearchDepth;
	y=FAlphaBeta(m_nMaxDepth,x-50,x+50);

	if(y<x-50)//fail-low research
	{
		m_pThinkProgress->SetPos(0);
		FAlphaBeta(m_nMaxDepth,-20000,y);
	}
	if(y>x+50)//fail-high research
	{
		m_pThinkProgress->SetPos(0);
		FAlphaBeta(m_nMaxDepth,y,20000);
	}
	
	m_umUndoMove.cmChessMove=m_cmBestMove;
	m_umUndoMove.nChessID=MakeMove(&m_cmBestMove);	
	
	memcpy(position,CurPosition,90);//将走过的棋盘传出
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -