Skip to content

Commit 262d756

Browse files
committed
update
1 parent 73bea4d commit 262d756

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/composables/useGameState.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,19 @@ export function useGameState(
11811181
return
11821182
}
11831183

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+
11841197
const bestMove = getBestAIMove(
11851198
board.value,
11861199
aiColor,

0 commit comments

Comments
 (0)