package pw.scho.battleship.model;

public class Position {

    private static String[] digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
    private final int x;
    private final int y;

    public Position(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public String toString() {
        return digits[x] + String.valueOf(y + 1);
    }

    public double distanceTo(Position otherPosition) {
        return Math.sqrt(Math.pow(Math.abs(x - otherPosition.x), 2) + Math.pow(Math.abs(y - otherPosition.y), 2));
    }
}

@@ -539,25 +539,16 @@
 ath.pow(
-Math.abs(
 x - othe
@@ -558,17 +558,16 @@
 sition.x
-)
 , 2) + M
@@ -578,17 +578,8 @@
 pow(
-Math.abs(
 y - 
@@ -593,17 +593,16 @@
 sition.y
-)
 , 2));%0A 

Remove unnecessary Math.abs from distance calculation