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(Man* man, AI* ai, Chess* chess)
|
|
|
|
|
{
|
|
|
|
|
this->man = man;
|
|
|
|
|
this->ai = ai;
|
|
|
|
|
this->chess = chess;
|
|
|
|
|
|
|
|
|
|
man->init(chess);
|
|
|
|
|
ai->init(chess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>Ծ֣<D4BE><D6A3><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7>
|
|
|
|
|
void ChessGame::play()
|
|
|
|
|
{
|
|
|
|
|
ChessPos pos;
|
|
|
|
|
chess->init();
|
|
|
|
|
while (1) {
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
man->go();
|
|
|
|
|
if (chess->checkOver()) {
|
|
|
|
|
chess->init();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>AI<41><49>
|
|
|
|
|
ai->go();
|
|
|
|
|
if (chess->checkOver()) {
|
|
|
|
|
chess->init();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|