flutter: 改写判断胜方的方式

This commit is contained in:
Calcitem 2020-11-17 01:11:39 +08:00
parent fc70ebcfa2
commit 3974f36868
1 changed files with 8 additions and 8 deletions

View File

@ -248,7 +248,7 @@ class _BattlePageState extends State<BattlePage> {
engineToGo() async { engineToGo() async {
while (Battle.shared.position.sideToMove() == Color.black) { while (Battle.shared.position.sideToMove() == Color.black) {
changeStatus('对方思考中...'); changeStatus('电脑思考中...');
final response = await widget.engine.search(Battle.shared.position); final response = await widget.engine.search(Battle.shared.position);
@ -260,19 +260,19 @@ class _BattlePageState extends State<BattlePage> {
//Battle.shared.move = move; //Battle.shared.move = move;
Battle.shared.command(move.move); Battle.shared.command(move.move);
final result = Battle.shared.scanBattleResult(); final winner = Battle.shared.position.winner;
switch (result) { switch (winner) {
case GameResult.pending: case Color.nobody:
changeStatus('请走棋...'); changeStatus('请走棋');
break; break;
case GameResult.win: case Color.white: // TODO
gotWin(); gotWin();
break; break;
case GameResult.lose: case Color.black:
gotLose(); gotLose();
break; break;
case GameResult.draw: case Color.draw:
gotDraw(); gotDraw();
break; break;
} }