📄 cwindow.h
字号:
#ifndef _CWINDOW_H
#define _CWINDOW_H
#include "Resource.h" // main symbols
#include <windows.h>
///////////////////////////////////////////////////////////////////////////////
class CWindow {
private:
HWND _hWnd;
bool m_bwfirst;//谁先走,1为电脑先走,0为玩家先走
bool m_binit;//判断游戏是否是处于刚开始阶段
bool pwin; //玩家是否获胜
bool cwin; //计算机是否获胜
bool ctable[15][15][572];//计算机获胜组合
bool ptable[15][15][572];//玩家获胜组合
int win[2][572];
POINT m_pplastpos;//玩家走的前一步棋
POINT m_pclastpos;//计算机走的前一步棋
bool start;//游戏是否开始
bool player;//是否轮到玩家下棋
int board[15][15];//与棋盘相对应的数组
bool computer;//是否轮到计算机下棋
enum Ball { NoBall, PlayerBall, ComputerBall };
HBITMAP m_hlastwhitechess;
HBITMAP m_hlastblackchess;
HBITMAP m_hblack;
HBITMAP m_hwhitechess;
HBITMAP m_hblackchess;
HBITMAP m_hboard;
public:
CWindow() : _hWnd( NULL ) {}
void Create( HWND hWnd, HINSTANCE hInstance );
void DrawNowWhite(int x,int y);//画当前白棋
void DrawNowBlack(int x,int y);//画当前黑棋
void InitializeBoard(); //初始化棋盘
void IsWin();//判断是否已有一方
void ComTurn();
int GiveScore(int type,int x,int y);
bool SearchBlank(int &i,int &j,int nowboard[][15]);
void GetBoard(int tempboard[][15],int nowboard[][15]);
void BestPosition(int& bestx,int& besty);//寻找计算机下的最佳位置
void DrawWhiteChess(int x,int y);
void DrawBlackChess(int x,int y);
void OnLButtonDown(POINT point);
void OnTimer(UINT nIDEvent);
void OnPaint();
void Destroy();
};
#endif // _MOVINGBALL_H //
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -