diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-03-07 19:00:15 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-07 19:00:15 +0900 |
| commit | a227ef30e8bc8282605361b013d323bb3bbc4e7d (patch) | |
| tree | 8bd28f1d27a77e061e7b7f56f8794e483fe82f8f /src/api/bot/core.ts | |
| parent | v3999 (diff) | |
| parent | oops (diff) | |
| download | sharkey-a227ef30e8bc8282605361b013d323bb3bbc4e7d.tar.gz sharkey-a227ef30e8bc8282605361b013d323bb3bbc4e7d.tar.bz2 sharkey-a227ef30e8bc8282605361b013d323bb3bbc4e7d.zip | |
Merge pull request #1197 from syuilo/othello
Othello
Diffstat (limited to 'src/api/bot/core.ts')
| -rw-r--r-- | src/api/bot/core.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/api/bot/core.ts b/src/api/bot/core.ts index 0a073a3127..75564b81e8 100644 --- a/src/api/bot/core.ts +++ b/src/api/bot/core.ts @@ -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 { |