From 29e5eed76b9c403c6a13fee9afca9a2cc7beab4a Mon Sep 17 00:00:00 2001 From: u014301111 Date: Sat, 29 Jul 2023 02:44:00 +0800 Subject: [PATCH] Sat Jul 29 02:44:00 CST 2023 inscode --- src/utils/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index ee12b56..4b78a48 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -89,6 +89,11 @@ export function checkWin({ row, col, board, player, win_size }) { y += dy; } + // 出现五连珠,返回胜利 + if (res.length >= win_size) { + return res; + } + x = col - dx; y = row - dy; while (inRange(x, COL) && inRange(y, ROW) && board[y][x] === player) { @@ -282,7 +287,7 @@ function getDirectionScore(pan_info, row, col, [y, x], win_size, player) { } } - // TODO:还有其他的判断,以后再做了 + // TODO:其他判断 return 10 ** SIZE } -- GitLab