Wed Jul 5 10:30:00 UTC 2023 inscode

上级 dcdb0a43
...@@ -172,17 +172,21 @@ function getBoundary(size, num) { ...@@ -172,17 +172,21 @@ function getBoundary(size, num) {
function getScore(board, row, col, win_size) { function getScore(board, row, col, win_size) {
const ROW = board.length const ROW = board.length
const COL = board[0].length const COL = board[0].length
// 连续棋子数
let res = 0 let res = 0
// 一侧到边缘的距离
let side = 0
let _row = row + y let _row = row + y
let _col = col + x let _col = col + x
while (true) { while (inRange(_row, ROW) && inRange(_col, COL)) {
if (inRange(_row, ROW) && inRange(_col, COL) && board[_row][_col] === is_white) { if (board[_row][_col] === is_white) {
res += 1 res += 1
_row += y
_col += x
} }
side += 1
_row += y
_col += x
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册