From e05144b93ee671e03739640868d32a4d31b91b35 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 8 Oct 2017 04:13:38 +0900 Subject: [PATCH] :v: --- src/api/bot/core.ts | 9 ++++++++- src/common/othello.ts | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/api/bot/core.ts b/src/api/bot/core.ts index ca5f5b89e..207de7161 100644 --- a/src/api/bot/core.ts +++ b/src/api/bot/core.ts @@ -287,8 +287,15 @@ class OthelloContext extends Context { public async q(query: string): Promise { this.othello.setByNumber('black', parseInt(query, 10)); + const s = this.othello.toString() + '\n\n...(AI)...\n\n'; othelloAi('white', this.othello); - return this.othello.toPatternString('black'); + if (this.othello.getPattern('black').length === 0) { + this.bot.clearContext(); + return '~終了~'; + } else { + this.emit('updated'); + return s + this.othello.toPatternString('black'); + } } public export() { diff --git a/src/common/othello.ts b/src/common/othello.ts index ef11514df..0b377ff5d 100644 --- a/src/common/othello.ts +++ b/src/common/othello.ts @@ -275,4 +275,6 @@ export function ai(color: string, othello: Othello) { } } } + + think(); }