summaryrefslogtreecommitdiff
path: root/src/api/bot/core.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-10-08 04:13:38 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-10-08 04:13:38 +0900
commite05144b93ee671e03739640868d32a4d31b91b35 (patch)
treead633b87dab28d27383d6dd14e36e8aafaf2aea8 /src/api/bot/core.ts
parent:v: (diff)
downloadsharkey-e05144b93ee671e03739640868d32a4d31b91b35.tar.gz
sharkey-e05144b93ee671e03739640868d32a4d31b91b35.tar.bz2
sharkey-e05144b93ee671e03739640868d32a4d31b91b35.zip
:v:
Diffstat (limited to 'src/api/bot/core.ts')
-rw-r--r--src/api/bot/core.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/api/bot/core.ts b/src/api/bot/core.ts
index ca5f5b89eb..207de71619 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<string> {
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() {