1 parent 73bea4d commit 262d756Copy full SHA for 262d756
1 file changed
src/composables/useGameState.ts
@@ -1181,6 +1181,19 @@ export function useGameState(
1181
return
1182
}
1183
1184
+ // ---- AI 主动宣告和棋:3 次重复局面 或 50 步规则 ----
1185
+ const currentKey = getPositionKey(board.value, currentTurn.value, lastMove.value)
1186
+ const positionRepeatCount = positionHistory.value.filter((key) => key === currentKey).length
1187
+
1188
+ if (positionRepeatCount >= 3 || halfmoveClock.value >= 100) {
1189
+ isAIThinking.value = false
1190
+ // AI 宣告和棋
1191
+ stopClock()
1192
+ isAgreedDraw.value = true
1193
+ playSound('draw')
1194
+ return
1195
+ }
1196
1197
const bestMove = getBestAIMove(
1198
board.value,
1199
aiColor,
0 commit comments