|
@ -8,6 +8,8 @@ import de.tims.fleetstorm.matchfield.Matchfield; |
|
|
|
|
|
|
|
|
public class Logic { |
|
|
public class Logic { |
|
|
|
|
|
|
|
|
|
|
|
private Coordinate lastShot; |
|
|
|
|
|
|
|
|
public Coordinate chooseField(Matchfield matchfield) { |
|
|
public Coordinate chooseField(Matchfield matchfield) { |
|
|
ArrayList<Coordinate> possibleFields = new ArrayList<Coordinate>(); |
|
|
ArrayList<Coordinate> possibleFields = new ArrayList<Coordinate>(); |
|
|
for (int x = 0; x < Math.sqrt(matchfield.getSize()); x++) { |
|
|
for (int x = 0; x < Math.sqrt(matchfield.getSize()); x++) { |
|
@ -35,4 +37,13 @@ public class Logic { |
|
|
return out; |
|
|
return out; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setLastShot(Coordinate coordinate, Matchfield matchfield) { |
|
|
|
|
|
lastShot = matchfield.getField(coordinate); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Coordinate getLastShot() { |
|
|
|
|
|
return lastShot; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |