This commit is contained in:
syuilo 2018-03-07 18:45:16 +09:00
parent 161fd4afab
commit 0bca0e8a02
7 changed files with 124 additions and 56 deletions

View file

@ -475,8 +475,8 @@ class OthelloContext extends Context {
othelloAi('white', this.othello);
if (this.othello.getPattern('black').length === 0) {
this.bot.clearContext();
const blackCount = this.othello.board.map(row => row.filter(s => s == 'black').length).reduce((a, b) => a + b);
const whiteCount = this.othello.board.map(row => row.filter(s => s == 'white').length).reduce((a, b) => a + b);
const blackCount = this.othello.board.filter(s => s == 'black').length;
const whiteCount = this.othello.board.filter(s => s == 'white').length;
const winner = blackCount == whiteCount ? '引き分け' : blackCount > whiteCount ? '黒の勝ち' : '白の勝ち';
return this.othello.toString() + `\n\n終了\n\n黒${blackCount}、白${whiteCount}${winner}です。`;
} else {