资源简介
中国象棋及五子棋人机对弈算法详细讲解和vc源代码实现

代码片段和文件信息
// COPYRIGHT NOTES
// ---------------
// This source code is a part of chess which is an example of .
// You may use compile or redistribute it as part of your application
// for free.
// You cannot redistribute sources without the official agreement of the author.
// If distribution of you application which contents code below was occured place
// e-mail on it is to be appreciated.
// This code can be used WITHOUT ANY WARRANTIES on your own risk.
//
// Spring Wang
// ---------------
// 版权声明
// ---------------
// 本文件所含之代码是《人机博弈程序设计指南》的范例程序中国象棋的一部分
// 您可以免费的使用 编译 或者作为您应用程序的一部分。
// 但,您不能在未经作者书面许可的情况下分发此源代码。
// 如果您的应用程序使用了这些代码,在您的应用程序界面上
// 放入 e-mail 是令人欣赏的做法。
// 此代码并不含有任何保证,使用者当自承风险。
//
// 王小春
// AlphaBetaAndTT.cpp: implementation of the CAlphaBetaAndTT class.
//
//////////////////////////////////////////////////////////////////////
#include “stdafx.h“
#include “chess.h“
#include “AlphaBetaAndTT.h“
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CAlphaBetaAndTT::CAlphaBetaAndTT()
{
}
CAlphaBetaAndTT::~CAlphaBetaAndTT()
{
}
CAlphaBetaAndTT::SearchAGoodMove(BYTE position[10][9])
{
memcpy(CurPosition position 90);
CalculateInitHashKey(CurPosition);
m_nMaxDepth = m_nSearchDepth;
alphabeta(m_nMaxDepth -20000 20000);
MakeMove(&m_cmBestMove);
memcpy(position CurPosition 90);
}
int CAlphaBetaAndTT::alphabeta(int depth int alpha int beta)
{
int score;
int Counti;
BYTE type;
int side;
i = IsGameOver(CurPosition depth);
if (i != 0)
return i;
side = (m_nMaxDepth-depth)%2;
score = LookUpHashTable(alpha beta depth side);
if (score != 66666)
return score;
if (depth <= 0) //叶子节点取估值
{
score = m_pEval->Eveluate(CurPosition side );
EnterHashTable(exact score depth side );
return score;
}
Count = m_pMG->CreatePossibleMove(CurPosition depth side);
int eval_is_exact = 0;
for (i=0;i {
Hash_MakeMove(&m_pMG->m_MoveList[depth][i] CurPosition);
type = MakeMove(&m_pMG->m_MoveList[depth][i]);
score = -alphabeta(depth - 1 -beta -alpha);
Hash_UnMakeMove(&m_pMG->m_MoveList[depth][i]type CurPosition);
UnMakeMove(&m_pMG->m_MoveList[depth][i]type);
if (score >= beta)
{
EnterHashTable(lower_bound score depthside);
return score;
}
if (score > alpha)
{
alpha = score;
eval_is_exact = 1;
if(depth == m_nMaxDepth)
m_cmBestMove = m_pMG->m_MoveList[depth][i];
}
}
if (eval_is_exact)
EnterHashTable(exact alpha depthside);
else
EnterHashTable(upper_bound alpha
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3195 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\AlphaBetaAndTT.cpp
文件 1778 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\AlphaBetaAndTT.h
文件 3951 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\AlphaBetaEngine.cpp
文件 1731 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\AlphaBetaEngine.h
文件 2913 2002-06-13 06:58 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\Alphabeta_HH.cpp
文件 1762 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\Alphabeta_HH.h
文件 2045 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\AspirationSearch.cpp
文件 1681 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\AspirationSearch.h
文件 1550 2002-06-21 06:52 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\chess.clw
文件 3049 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\chess.cpp
文件 6634 2002-04-27 06:51 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\chess.dsp
文件 717 2001-10-28 20:22 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\chess.dsw
文件 2332 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\chess.h
文件 1439 2002-06-21 06:52 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\chess.plg
文件 6314 2002-06-21 06:34 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\chess.rc
文件 10224 2002-06-21 06:52 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\chessDlg.cpp
文件 3126 2002-06-21 06:38 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\chessDlg.h
文件 155689 2002-06-21 06:34 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\Debug\chess.exe
文件 2085 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\define.h
文件 18635 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\Eveluation.cpp
文件 2444 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\Eveluation.h
文件 3680 2001-11-30 02:58 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\FAlphaBetaAndTT.cpp
文件 787 2001-11-02 21:43 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\FAlphaBetaAndTT.h
文件 2681 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\FAlphaBetaEngine.cpp
文件 1739 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\FAlphaBetaEngine.h
文件 3920 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\HistoryHeuristic.cpp
文件 2082 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\HistoryHeuristic.h
文件 3293 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\IDAlphabeta.cpp
文件 1714 2002-06-13 06:59 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\IDAlphabeta.h
文件 579 2001-10-31 18:52 PC 游戏编程(人机博弈)中国象棋和五子棋的算法讲解和vc源代码\boyi\chess\MinimaxEngine.cpp
............此处省略89个文件信息
- 上一篇:USB3.0 协议 规范 中文
- 下一篇:粒子群优化算法代码及资料
相关资源
- Windows异步套接字网络编程
- VC 获得文件属性 获取文件的创建时
- 基于MVC模式的会员管理系统
- silicon lab公司的收音IC SI47XX全套开发工
- 读者写者问题(读者优先,写者优先
- MFC程序-碰撞的小球
- vc 柱形图 CBarChart
- 用vc 写的导线测量,针对刚学测绘的
- 用VC 编写的仿QQ聊天室程序源代码
- 栅栏填充算法源码(VC)
- 简单的房屋租赁系统
- .net网站服装销售系统(MVC)
- 五子棋C 源代码
-
ob
jectARX给Auto CAD加工具条 - blowfish的vc2008工程.rar
- 画图程序MFC/VC/VC CRectTracker 串行化
- capon波束形成算法-VC实现
- 读取串口数据并画实时曲线的VC 程序
- VC 游戏编程—附源代码
- IpHlpApi.h&IpHlpApi.lib
- vc 6.0开发的流程图编辑器
- VC 天空盒(skyBox)实现(附源代码)
- c MFC 画多边形
- keil vcom windows 7 64bit 驱动
- vc URL编解码类
- vc编写中国象棋详细源码注释并附有视
- VC 围棋源代码
- 用VC 编写的基于SNMP的路由器拓扑程序
- 五子棋游戏实现悔棋功能
- vc利用MFC底层开发的二维GIS管理软件,
评论
共有 条评论