資源簡介
這是用vc編寫的井子棋 功能有 1.人機(jī)對戰(zhàn) 2.雙人對戰(zhàn) 3.悔棋 4.誰先走選擇
代碼片段和文件信息
#include
#include
#include
using?namespace?std;
int?tmpQP[3][3];?
const?int?MAX_NUM=1000;?//擴(kuò)展生成狀態(tài)節(jié)點(diǎn)的最大數(shù)目
const?int?NO_BLANK=-1001;?//表示沒有空格
const?int?NIL=1001;????//表示空
static?int?s_count;?????//用來表示當(dāng)前分析的節(jié)點(diǎn)的下標(biāo)
struct?State//該結(jié)構(gòu)表示棋盤的某個狀態(tài),也可看做搜索樹中的一個節(jié)點(diǎn)
{
int?QP[3][3];?//棋盤格局
int?e_fun;?//當(dāng)前狀態(tài)的評估函數(shù)值
int?child[9];?//兒女節(jié)點(diǎn)的下標(biāo)
int?parent;?//雙親節(jié)點(diǎn)的下標(biāo)
int?bestChild;?//最優(yōu)節(jié)點(diǎn)(評估函數(shù)值最大)的兒女節(jié)點(diǎn)下標(biāo)
}States[1000];?//用來保存搜索樹中狀態(tài)節(jié)點(diǎn)的數(shù)組
struct?State?S[1000];
int?front;??
//設(shè)置文字顏色
void?SetColor(unsigned?short?ForeColor=14unsigned?short?BackGroundColor=0)?????????????????????????????????????????????????????????????????????????????????????????????????????????//可以接受0/1/2個參數(shù)??
{??
HANDLE?hCon?=?GetStdHandle(STD_OUTPUT_HANDLE);?????
SetConsoleTextAttribute(hConForeColor|BackGroundColor);??
};
//界面函數(shù)
void?jiemian()
{
?SetColor(100);
?printf(“\n\n\n\n“);
??printf(“?-----------------------------------------------------------------------------
- 上一篇:VisualBoyAdvance-1.6a
- 下一篇:gatbx工具箱
評論
共有 條評論