📄 gomoku.h
字号:
// Gomoku.h: interface for the Gomoku class.
//
//////////////////////////////////////////////////////////////////////
#ifndef _Gomoku_H_
#define _Gomoku_H_
#include <windows.h>
#include "PList.h"
enum {computer,persion};
enum {left2right,right2left,up2down,down2up,ldown2rup,rup2ldown,rdown2lup,lup2rdown};
/*
本类实现五子棋的初始化和所有操作
*/
class Gomoku
{
public:
//Continue菜单的区域范围
RECT rc_continue;
//NewGame菜单的区域范围
RECT rc_newgame;
//Invite(computer or persion)菜单的区域范围
RECT rc_invite;
int Xstart;
int Ystart;
int space;
//need to save
int row; // board dimensions row
int col; // board dimensions column
int invite;
bool cur_player;//当前的执子方
CPList list;
// Square **board; // for dynamic memory allocation
// Square **arr; // for dynamic memory allocation
public:
//从保存文件中读取进度
void ReadFromFile();
//将进度写入文件
void SaveToFile();
//计算机下子
void ComputerPlay(POINT point);
//以base为基点,按照dir的方向,得到相邻点
POINT GetNextPoint(POINT base, int dir);
//以base为基点,按照dir的方向,得到最大相邻且相同的棋子个数
int MaxChessmanNum(POINT point, Square baseq, int dir);
//是否获胜
Square IsSuccess(POINT point);
//是人机对战还是从对战
void Invite();
//开始新游戏
void NewGame();
//继续上次保存的游戏
void Continue();
//point点是否在该rect中
BOOL IsInRect(int baseX, int baseY, int width, int high, POINT point);
//落子
bool Input(POINT point); //input player position
//刷新当前棋局窗口
void Display(HDC &hdc); //display board on screen
Gomoku(int r, int c); //Parametrized Constructor
Gomoku();
virtual ~Gomoku();
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -