const int N = 15;//15*15的棋盘
int ChessBoardInformation[N][N];
class ChessBoard
{
public:
ChessBoard()
{
InitWindow();
DrawChessBoard(N/2,N/2);
}
void InitWindow();//初始化窗口
void DrawChessBoard(int x,int y);//绘制棋盘
};
class Game
{
public:
Game()
{
Init();
}
void Init();
void play();
int Put();
int Judge(int x,int y);
int g_x,g_y;
int g_currentGamer;
};
//初始化对局
void Game::Init()
{
memset(ChessBoardInformation,0,sizeof(ChessBoardInformation));//棋盘数据
g_x=N/2;//光标居中
g_y=N/2;
g_currentGamer=1;//当前玩家:黑子;
}
//落子
int Game::Put()
{
if (ChessBoardInformation[g_x][g_y]==0)//判断是否可以落子
{
ChessBoardInformation[g_x][g_y]=g_currentGamer;//记录当前玩家所下的棋子
return 1;