You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include "ChessGame.h"
|
|
|
|
|
|
|
|
|
|
ChessGame::ChessGame(Player* player, AI* ai, Chess* chess)
|
|
|
|
|
{
|
|
|
|
|
this->player = player;
|
|
|
|
|
this->ai = ai;
|
|
|
|
|
this->chess = chess;
|
|
|
|
|
|
|
|
|
|
player->init(chess);
|
|
|
|
|
ai->init(chess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>Ծֿ<D4BE>ʼ
|
|
|
|
|
void ChessGame::play()
|
|
|
|
|
{
|
|
|
|
|
chess->init();
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ء
|
|
|
|
|
player->go();
|
|
|
|
|
if (chess->checkOver())
|
|
|
|
|
break;
|
|
|
|
|
//<2F>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ai->go();
|
|
|
|
|
if (chess->checkOver())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|