From 18df512a70af94e20f78bcd6635d2f430566200c Mon Sep 17 00:00:00 2001 From: flykhan Date: Fri, 10 Mar 2023 17:04:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0Bot=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/kob/botrunningsystem/utils/Bot.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backendcloud/botrunningsystem/src/main/java/com/kob/botrunningsystem/utils/Bot.java b/backendcloud/botrunningsystem/src/main/java/com/kob/botrunningsystem/utils/Bot.java index 2819a6b..435ccd4 100644 --- a/backendcloud/botrunningsystem/src/main/java/com/kob/botrunningsystem/utils/Bot.java +++ b/backendcloud/botrunningsystem/src/main/java/com/kob/botrunningsystem/utils/Bot.java @@ -41,9 +41,11 @@ public class Bot implements com.kob.botrunningsystem.utils.BotInterface { @Override public Integer nextMove(String input) { String[] strs = input.split("#"); - int[][] g = new int[13][14]; - for (int i = 0, k = 0; i < 13; i ++ ) { - for (int j = 0; j < 14; j ++, k ++ ) { + int rows = 18; + int cols = 19; + int[][] g = new int[rows][cols]; + for (int i = 0, k = 0; i < rows; i ++ ) { + for (int j = 0; j < cols; j ++, k ++ ) { if (strs[0].charAt(k) == '1') { g[i][j] = 1; } @@ -63,7 +65,7 @@ public class Bot implements com.kob.botrunningsystem.utils.BotInterface { for (int i = 0; i < 4; i ++ ) { int x = aCells.get(aCells.size() - 1).x + dx[i]; int y = aCells.get(aCells.size() - 1).y + dy[i]; - if (x >= 0 && x < 13 && y >= 0 && y < 14 && g[x][y] == 0) { + if (x >= 0 && x < rows && y >= 0 && y < cols && g[x][y] == 0) { return i; } }