From 3e80b8330c136db4c03400135dff9c71f6b6b55a Mon Sep 17 00:00:00 2001 From: Yangfan Wu <39647285+wyf027@users.noreply.github.com> Date: Sun, 5 Jul 2026 03:19:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(classic-games):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=20Mini=20Tablanette=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-0315-tablanette.html | 213 ++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 project/classic-games/20260705-0315-tablanette.html diff --git a/project/classic-games/20260705-0315-tablanette.html b/project/classic-games/20260705-0315-tablanette.html new file mode 100644 index 00000000..c9c68ec2 --- /dev/null +++ b/project/classic-games/20260705-0315-tablanette.html @@ -0,0 +1,213 @@ + + + + + + Mini Tablanette + + + +
+
+
+

Mini Tablanette

+

点选手牌。若点数匹配桌面牌,就收走全部同点数牌;否则留在桌面。

+
+ +
+ +
+
+
牌堆
+
0
+
+
+
你的得分
+
0
+
+
+
电脑得分
+
0
+
+
+
回合
+
+
+
+ +
+
+

桌面牌

+ 选择一张手牌开始。 +
+
+
+ +
+
+

你的手牌

+
+
+
+

电脑手牌

+
+
+
+
+ + + + From 43cc52dffd8d04146cf71e696bfcca99868249b7 Mon Sep 17 00:00:00 2001 From: Yangfan Wu <39647285+wyf027@users.noreply.github.com> Date: Mon, 6 Jul 2026 02:59:22 +0800 Subject: [PATCH 2/2] fix(classic-games): cancel pending Tablanette bot turn on reset --- .../20260705-0315-tablanette.html | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/project/classic-games/20260705-0315-tablanette.html b/project/classic-games/20260705-0315-tablanette.html index c9c68ec2..c978d969 100644 --- a/project/classic-games/20260705-0315-tablanette.html +++ b/project/classic-games/20260705-0315-tablanette.html @@ -74,6 +74,7 @@

电脑手牌

let botPile = []; let isPlayerTurn = true; let gameOver = false; + let botTurnTimer = null; function buildDeck() { const suits = ["♠", "♥", "♦", "♣"]; @@ -86,7 +87,23 @@

电脑手牌

return cards.sort(() => Math.random() - 0.5); } + function clearPendingBotTurn() { + if (botTurnTimer !== null) { + window.clearTimeout(botTurnTimer); + botTurnTimer = null; + } + } + + function scheduleBotTurn() { + clearPendingBotTurn(); + botTurnTimer = window.setTimeout(() => { + botTurnTimer = null; + botTurn(); + }, 500); + } + function resetGame() { + clearPendingBotTurn(); deck = buildDeck(); tableCards = []; playerHand = []; @@ -126,11 +143,12 @@

电脑手牌

isPlayerTurn = false; render(); if (!checkGameOver()) { - window.setTimeout(botTurn, 500); + scheduleBotTurn(); } } function botTurn() { + botTurnTimer = null; if (gameOver) return; let index = botHand.findIndex((card) => tableCards.some((tableCard) => tableCard.rank === card.rank)); if (index < 0) index = 0;