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

📄 mantischessdef.h

📁 一个博弈论的经典游戏,规则是两边轮流走棋,走到最后一步者胜.先手只有一种走法能胜电脑,试试看
💻 H
字号:
/***************************************************************
  MantisChessDef.h : MantisChess 基本定义头文件

  版权所有(C)  陈成涛

  这一程序是自由软件,你可以遵照自由软件基金会出版的GNU通用公共
  许可证条款来修改和重新发布这一程序。或者用许可证的第二版,或者
  (根据你的选择)用任何更新的版本。

  发布这一程序的目的是希望它有用,但没有任何担保。甚至没有适合特
  定目的的隐含的担保。更详细的情况请参阅GNU通用公共许可证。
  
  你应该已经和程序一起收到一份GNU通用公共许可证的副本。
  如果还没有,写信给:

  The Free Software Foundation,Inc,,675 Mass Ave, Cambridge,
  MAO2139,USA

  如果你在使用本软件时有什么问题或建议,用以下地址可以与我取得联
  系:

              http://thecct.51.net

  或发Email到:

              stove@eyou.com
              thecct@163.com

------------------------------------------------------------------
  MantisChessDef.h : MantisChess standard defines headfile

  Copyright (C)  Chen Chengtao, China
  
  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.
  
  If you have any question about this software please visit my hompage:

              http://thecct.51.net

  or E_mail to:

              stove@eyou.com
              thecct@163.com

******************************************************************/

const int MW=32,SW=1;				//MW-棋子宽度;SW-棋子间隔的一半
const int BWA=MW+SW*2;				//BWA-棋格宽度

const int XBW=BWA*5,YBW=BWA*11;		//棋盘的长宽

const int MAN=0;			//人
const int COM=1;			//计算机

const int RED=0;			//红方
const int BLACK=1;			//黑方

const int RED_1=0;			//红帅
const int RED_2=1;			//仕
const int RED_3=2;			//相


const int BLACK_1=3;		//黑将
const int BLACK_2=4;	//士
const int BLACK_3=5;		//象



//以下是全局函数定义:

//把棋子序号转换为对应图标的序号
const int  ManToIcon[6]=	{0,1,2,3,4,5};							

//棋子类型与图标的序号相同
//#define ManToType  ManToIcon

//const int ManToType7[33]=	{0,1,1,2,2,3,3,4,4,5,5,6,6,6,6,6
//	,0,1,1,2,2,3,3,4,4,5,5,6,6,6,6,6,-1};


//随即函数,返回小于n的随机整数
int  rnd(const int& n);

//给出棋子序号!!,判断是红是黑
const int SideOfMan[7]=	{0,0,0,1,1,1,-1};

const int _defaultmap[6][13]=	
{
//	[0][1][2][3][4][5][6][7][8][9][10][11][12]
	{6,6,6,6,6,6,6,6,6,6,6,6,6},//[0]
	{6,6,6,6,6,6,6,6,6,6,6,6,6},//[1]
	{6,6,6,6,6,6,6,6,6,6,6,6,6},//[2]
	{6,6,6,6,6,6,6,6,6,6,6,6,6},//[3]
	{6,6,6,6,6,6,6,6,6,6,6,6,6},
	{6,6,6,6,6,6,6,6,6,6,6,6,6}//[4]
	
};

const int FistOfSide[2]={0,16};
const int LastOfSide[2]={15,31};
const int MAXMOVE = 1000;

const int ai[100][3]=
{
	{2,9,9},
	{2,5,7},
	{2,4,6},
	{1,8,9},
	{1,6,7},
	{1,4,5},
	{1,2,3},
	{0,1,1},
	{0,2,2},
	{0,3,3},
	{0,4,4},
	{0,5,5},
	{0,6,6},
	{0,7,7},
	{0,8,8},
	{0,0,0}
};

⌨️ 快捷键说明

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