diff --git a/src/utils/index.js b/src/utils/index.js index ee12b5646f3577917e8d38300a30aa11546c6119..4b78a48c5560f535f62303646a3c3fd38428571c 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 }