|
@ -13,6 +13,7 @@ public class Logic { |
|
|
public Coordinate target; |
|
|
public Coordinate target; |
|
|
private boolean foundShip = false; |
|
|
private boolean foundShip = false; |
|
|
public boolean clearedAbove = false; |
|
|
public boolean clearedAbove = false; |
|
|
|
|
|
public boolean clearedBelow = false; |
|
|
|
|
|
|
|
|
public Coordinate chooseField() { |
|
|
public Coordinate chooseField() { |
|
|
ArrayList<Coordinate> possibleFields = new ArrayList<Coordinate>(); |
|
|
ArrayList<Coordinate> possibleFields = new ArrayList<Coordinate>(); |
|
@ -95,4 +96,12 @@ public class Logic { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void clearBelow(Coordinate shot) { |
|
|
|
|
|
target = matchfield.getBelow(shot); |
|
|
|
|
|
|
|
|
|
|
|
if (target.getState() == Coordinate.EMPTY) { |
|
|
|
|
|
clearedBelow = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |