更新Bot测试代码
This commit is contained in:
parent
b1a18409aa
commit
18df512a70
|
@ -41,9 +41,11 @@ public class Bot implements com.kob.botrunningsystem.utils.BotInterface {
|
||||||
@Override
|
@Override
|
||||||
public Integer nextMove(String input) {
|
public Integer nextMove(String input) {
|
||||||
String[] strs = input.split("#");
|
String[] strs = input.split("#");
|
||||||
int[][] g = new int[13][14];
|
int rows = 18;
|
||||||
for (int i = 0, k = 0; i < 13; i ++ ) {
|
int cols = 19;
|
||||||
for (int j = 0; j < 14; j ++, k ++ ) {
|
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') {
|
if (strs[0].charAt(k) == '1') {
|
||||||
g[i][j] = 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 ++ ) {
|
for (int i = 0; i < 4; i ++ ) {
|
||||||
int x = aCells.get(aCells.size() - 1).x + dx[i];
|
int x = aCells.get(aCells.size() - 1).x + dx[i];
|
||||||
int y = aCells.get(aCells.size() - 1).y + dy[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;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue