From f7e81db73223dc603a5a8724ac9b230fe192e212 Mon Sep 17 00:00:00 2001
From: Yangfan Wu <39647285+wyf027@users.noreply.github.com>
Date: Sun, 5 Jul 2026 05:47:02 +0800
Subject: [PATCH 1/2] =?UTF-8?q?feat(classic-games):=20=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=20Mini=20Domineering=20=E5=B0=8F=E6=B8=B8=E6=88=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../20260705-0545-domineering.html | 206 ++++++++++++++++++
1 file changed, 206 insertions(+)
create mode 100644 project/classic-games/20260705-0545-domineering.html
diff --git a/project/classic-games/20260705-0545-domineering.html b/project/classic-games/20260705-0545-domineering.html
new file mode 100644
index 00000000..e7370641
--- /dev/null
+++ b/project/classic-games/20260705-0545-domineering.html
@@ -0,0 +1,206 @@
+
+
+
+
+
+ Mini Domineering
+
+
+
+
+
+
+
+
+
+
+
4 x 4 棋盘
+ 选择横向相邻的两个空格。
+
+
+
+
+
+
+
+
From 6bb5f62b2b6829ded66bd768e3400d5641dec086 Mon Sep 17 00:00:00 2001
From: Yangfan Wu <39647285+wyf027@users.noreply.github.com>
Date: Mon, 6 Jul 2026 03:03:47 +0800
Subject: [PATCH 2/2] fix(classic-games): cancel pending Domineering bot turn
on reset
---
.../20260705-0545-domineering.html | 22 ++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/project/classic-games/20260705-0545-domineering.html b/project/classic-games/20260705-0545-domineering.html
index e7370641..e01a529d 100644
--- a/project/classic-games/20260705-0545-domineering.html
+++ b/project/classic-games/20260705-0545-domineering.html
@@ -55,8 +55,25 @@ 4 x 4 棋盘
let botScore = 0;
let gameOver = false;
let botThinking = false;
+ let botTurnTimer = null;
+
+ function clearPendingBotTurn() {
+ if (botTurnTimer !== null) {
+ window.clearTimeout(botTurnTimer);
+ botTurnTimer = null;
+ }
+ }
+
+ function scheduleBotTurn() {
+ clearPendingBotTurn();
+ botTurnTimer = window.setTimeout(() => {
+ botTurnTimer = null;
+ botTurn();
+ }, 450);
+ }
function resetGame() {
+ clearPendingBotTurn();
board = Array.from({ length: size }, () => Array(size).fill(""));
selected = null;
playerScore = 0;
@@ -118,7 +135,7 @@ 4 x 4 棋盘
botThinking = true;
setMessage("电脑行动。");
render();
- window.setTimeout(botTurn, 450);
+ scheduleBotTurn();
}
return;
}
@@ -134,6 +151,8 @@ 4 x 4 棋盘
}
function botTurn() {
+ botTurnTimer = null;
+ if (gameOver || !botThinking) return;
const moves = getMoves("V");
if (!moves.length) {
finish("你赢了,电脑无法竖放。");
@@ -156,6 +175,7 @@ 4 x 4 棋盘
}
function finish(text) {
+ clearPendingBotTurn();
gameOver = true;
botThinking = false;
selected = null;