diff --git a/src/utils/api.js b/src/utils/api.js index e54081eef260567e38a4a044074d8d1a49ed9167..a00472983074c62667ce766d7a58b31c398ed708 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -20,7 +20,7 @@ export async function robotPlay(board, player, win_size) { } ], apikey: apiKey - } + }; return await fetch(apiUrl, { method: 'POST', diff --git a/src/utils/index.js b/src/utils/index.js index 32a3e82e8ea78d2411740100c2abd859796539b4..4c440f736c473a10264a2beb46ac14d47f888e04 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -245,7 +245,9 @@ function getDirectionScore(pan_info, row, col, [y, x], win_size, player) { const SIZE = r_piece_num + l_piece_num // 没有棋子 if (SIZE == 0) return 0 - // 两边有障碍物且小于 win_size + // 空间不够连成直线的 + if ((r_obstacle_num + l_obstacle_num + 1) < win_size) return 0 + if (r_empty_num == 0 && l_empty_num == 0 && (SIZE + 1) < win_size) return 0 // 两边都没障碍物