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

📄 wzq.hpp

📁 OSE操作系统支持c166的手机游戏
💻 HPP
字号:

#if !defined(Wzq_hpp)
#define Wzq_hpp

struct winRecord//获胜
{
int winner;//0 没有获胜 1 白 2 黑
int nx1;//五连的坐标
int nx2;
int ny1;
int ny2;
};
struct saveRecord//下棋记录
{
bool used;//是否使用
bool color;//颜色
int ix;//坐标
int iy;
};
struct CPoint {
		INT x;
		INT y;
	};

class wzq  
{
public:
	wzq(PaintDc* pdc);
	wzq();
	virtual ~wzq();

	void NewGame();//新游戏

	void DrawQZ(int nx,int ny,bool style);//画棋子
	void Init(PaintDc* pdc);//设置DC
	void ReDraw();//当需要重画时调用
	//bool downzi(int nx,int ny);//外部调用此函数下子
	bool downzi();
	bool bewinner2(bool style,int nx,int ny);//判断胜败
	
	void setback(int nx,int ny,bool style);//记录
	bool getbackble(){return nowd2<=0?false:true;}//是否可以悔棋
	CPoint AiGo(bool color);//人工智能外部控制
	bool firstgo;//false:人true:机
	bool secondgo;//false:人true:机
	
	winRecord m_winRec;//获胜纪录
	int AItype;//0低预测6步 1中预测10步 2高预测16步
	int Model;//0人->机 1机->人 2对翌
	bool backable ;//是否悔棋 0=N 1=Y
	//位置控制函数
	void MovetoLeft();
	void MovetoRight();
	void MovetoDown();
	void MovetoUp();
	//获得状态
	bool GetWinState();
//绘图
private:
	bool userAd(int nx,int ny);//黑色下子
	bool userBd(int nx,int ny);//白色下子
	bool SetWinner(int st,int x1,int x2,int y1,int y2);
	void DrawPos();
	PaintDc* dc;//窗口dc
	unsigned char user[15][15][4];//储存棋局
	unsigned char pc[15][15][4];//储存棋局
	char map[15][15];//储存棋盘地图
	unsigned char nicest2[15][15];
	char trygo[15][15];
	bool dcseted;
	int nowd2;
	int aitype2;
	saveRecord wzs[225];//保存各位之的棋子状态
	int m_x;//当前选择位置
	int m_y;//当前选择位置
	int CONSX[15];
	int CONSY[15];
//------------------------------AI人工智能内部函数------------------------------////
/**/private:																	/**/																
/**/	void fillin(bool color,bool player,bool type);							/**/
/**/	void setqx(int nx ,int ny,bool style,bool player,int st,bool type);		/**/
/**/	void setall();															/**/
/**/	void clear(bool style);													/**/
/**/	void checkgo(int x,int y,bool color,int nu,int inx,int iny);//预测函数	/**/
/**/	bool bejs(int nx, int ny);	/*++此处添加禁手控制++*/					/**/
/**/	//因为我不熟悉五子棋的规则,所以没有设置禁手							/**/
/**/	bool bj2(int x1,int y1,int x2,int y2,bool style);						/**/
/**/	char ntoc(char num,bool type,bool style);								/**/
/**/	CPoint getmax(bool color);												/**/
/**/	CPoint getbg(bool style);												/**/
/**/	int getaitype();														/**/
//AI								//请参见"五子棋算法"						/**/
///-----------------------------------------------------------------------------////


};

#endif

⌨️ 快捷键说明

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