From 5ab171ed9116d7654e2e4fec9dd2400b71088669 Mon Sep 17 00:00:00 2001 From: u014301111 Date: Sun, 30 Jul 2023 12:40:00 +0800 Subject: [PATCH] Sun Jul 30 12:40:00 CST 2023 inscode --- src/utils/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index a8de1b0..b3ffe7a 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -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 } /** -- GitLab