更新Bot测试代码

This commit is contained in:
flykhan 2023-03-10 17:04:11 +08:00
parent b1a18409aa
commit 18df512a70
1 changed files with 6 additions and 4 deletions

View File

@ -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;
}
}