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

📄 value.cpp

📁 有全屏显示的一个很优秀的中国象棋软件.用VC6.0开发
💻 CPP
字号:
// Value.cpp: implementation of the Value class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "chess.h"
#include "Value.h"
#include "chessDlg.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CChessDlg*theWnd;
Value::Value(CDialog * p)
{
     pWnd=p;
	 theWnd=(CChessDlg*)p;
}

Value::~Value()
{

}
int v[15]={0,20,10,5,5,100,10,2,-20,-10,-5,-5,-100,-10,-2};
int Value::GetValue(BYTE p[][9],int depthend)
{
   int x,y,value=0;
   for (x=0;x<=9;x++)
	   for (y=0;y<=8;y++)
	   {
		   if ((p[x][y]-1)%7+1==7) if (p[x][y]/8!=x/5) {
			   if (x/5==1) value+=2;
			   else if (x/5==0) value-=2;
		   }
            value+=v[p[x][y]];
	   }
	   if ((MaxDepth-depthend)%2==0) return -(value+1000);
	   return value+1000;
}
           

⌨️ 快捷键说明

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