From dd2ddc5811868e8943ca05b92e5fbdebd72b24d3 Mon Sep 17 00:00:00 2001 From: Lorenz Hohmann Date: Mon, 17 Jan 2022 13:59:56 +0100 Subject: [PATCH] Fixed chooseField returns null --- src/main/java/de/tims/fleetstorm/ai/Logic.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/tims/fleetstorm/ai/Logic.java b/src/main/java/de/tims/fleetstorm/ai/Logic.java index 3b82500..a20c9e0 100644 --- a/src/main/java/de/tims/fleetstorm/ai/Logic.java +++ b/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 || target == null) { + if (target == null || target.getState() == Coordinate.EMPTY) { clearedAbove = true; target = lastShot; } @@ -45,7 +45,7 @@ public class Logic { if (!clearedBelow) { target = matchfield.getBelow(target); out = target; - if (target.getState() == Coordinate.EMPTY || target == null) { + if (target == null || target.getState() == Coordinate.EMPTY) { clearedBelow = true; target = lastShot; } @@ -57,7 +57,7 @@ public class Logic { if (!clearedRight) { target = matchfield.getRight(target); out = target; - if (target.getState() == Coordinate.EMPTY || target == null) { + if (target == null || target.getState() == Coordinate.EMPTY) { clearedRight = true; target = lastShot; } @@ -67,7 +67,7 @@ public class Logic { if (!clearedLeft) { target = matchfield.getLeft(target); out = target; - if (target.getState() == Coordinate.EMPTY || target == null) { + if (target == null || target.getState() == Coordinate.EMPTY) { clearedLeft = true; target = lastShot; }