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.
33 lines
485 B
33 lines
485 B
#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);
|
|
}
|
|
|
|
//对局(开始五子棋游戏)
|
|
void ChessGame::play()
|
|
{
|
|
ChessPos pos;
|
|
chess->init();
|
|
while (1) {
|
|
//先由棋手走
|
|
man->go();
|
|
if (chess->checkOver()) {
|
|
chess->init();
|
|
continue;
|
|
}
|
|
//由AI走
|
|
ai->go();
|
|
if (chess->checkOver()) {
|
|
chess->init();
|
|
continue;
|
|
}
|
|
}
|
|
}
|