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() {
diff --git a/src/common/othello.ts b/src/common/othello.ts
index ef11514dff..0b377ff5d3 100644
--- a/src/common/othello.ts
+++ b/src/common/othello.ts
@@ -275,4 +275,6 @@ export function ai(color: string, othello: Othello) {
 			}
 		}
 	}
+
+	think();
 }