Browse Source

chooseField still works after returning null

fleetstorm
Max Wenzel 3 years ago
committed by Lorenz Hohmann
parent
commit
53bc0d9064
  1. 8
      src/main/java/de/tims/fleetstorm/ai/Logic.java

8
src/main/java/de/tims/fleetstorm/ai/Logic.java

@ -35,7 +35,7 @@ public class Logic {
if (!clearedAbove) {
target = matchfield.getAbove(target);
out = target;
if (target.getState() == Coordinate.EMPTY) {
if (target.getState() == Coordinate.EMPTY || target == null) {
clearedAbove = true;
target = lastShot;
}
@ -45,7 +45,7 @@ public class Logic {
if (!clearedBelow) {
target = matchfield.getBelow(target);
out = target;
if (target.getState() == Coordinate.EMPTY) {
if (target.getState() == Coordinate.EMPTY || target == null) {
clearedBelow = true;
target = lastShot;
}
@ -57,7 +57,7 @@ public class Logic {
if (!clearedRight) {
target = matchfield.getRight(target);
out = target;
if (target.getState() == Coordinate.EMPTY) {
if (target.getState() == Coordinate.EMPTY || target == null) {
clearedRight = true;
target = lastShot;
}
@ -67,7 +67,7 @@ public class Logic {
if (!clearedLeft) {
target = matchfield.getLeft(target);
out = target;
if (target.getState() == Coordinate.EMPTY) {
if (target.getState() == Coordinate.EMPTY || target == null) {
clearedLeft = true;
target = lastShot;
}

Loading…
Cancel
Save