This commit is contained in:
syuilo 2017-10-08 04:13:38 +09:00
parent c14f946bd4
commit e05144b93e
2 changed files with 10 additions and 1 deletions

View file

@ -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() {

View file

@ -275,4 +275,6 @@ export function ai(color: string, othello: Othello) {
}
}
}
think();
}