提交 5ab171ed 编写于 作者: U u014301111

Sun Jul 30 12:40:00 CST 2023 inscode

上级 eea4f3d7
......@@ -48,16 +48,15 @@ function inRange(n, start = 0, end) {
* @returns {boolean}
*/
function aroundIsEmpty({ ROW, COL, OBJ }, y, x) {
let res_arr = 0
for (let i = 0; i < directions.length; i++) {
const [_y, _x] = directions[i]
for (let j = -1; j < 3; j += 2) {
if (inRange(y + _y * j, ROW) && inRange(x + _x * j, COL) && OBJ[`${_y * j + y}_${_x * j + x}`] !== is_empty) {
res_arr += 1
return false
}
}
}
return res_arr === 0
return true
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册