diff --git a/fh.fd.ci.client/src/main/java/de/fd/fh/Figure.java b/fh.fd.ci.client/src/main/java/de/fd/fh/Figure.java index 8e3c87f..2ae7a40 100644 --- a/fh.fd.ci.client/src/main/java/de/fd/fh/Figure.java +++ b/fh.fd.ci.client/src/main/java/de/fd/fh/Figure.java @@ -2,7 +2,7 @@ package de.fd.fh; public class Figure { - public static final int fieldSize = 64; + public static final int fieldLength = 8; public boolean moveAllowed(int src, int dst, int[] field) { @@ -11,12 +11,12 @@ public class Figure return false; } - if (field.length != fieldSize) + if (field.length != Figure.fieldLength * Figure.fieldLength) { return false; } - if (dst >= 56) + if (dst >= Figure.fieldLength * 7 + 0) { return false; } diff --git a/fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java b/fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java index c630e63..30b993b 100644 --- a/fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java +++ b/fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java @@ -10,41 +10,41 @@ class FigureTest void checkMoveWithInvalidFieldSmall() // Feldgröße sollte 8*8 betragen { Figure f = new Figure(); - assertFalse(f.moveAllowed(0,0, new int[0])); + assertFalse(f.moveAllowed(Figure.fieldLength * 6 + 0, Figure.fieldLength * 5 + 0, new int[0])); } @Test void checkMoveWithInvalidFieldBigger() // Feldgröße sollte 8*8 betragen { Figure f = new Figure(); - assertFalse(f.moveAllowed(48,40, new int[8*9])); + assertFalse(f.moveAllowed(Figure.fieldLength * 6 + 0, Figure.fieldLength * 5 + 0, new int[8*9])); } @Test void checkMoveWithInvalidFieldCorrect() // Feldgröße sollte 8*8 betragen { Figure f = new Figure(); - assertTrue(f.moveAllowed(48,40, new int[Figure.fieldSize])); + assertTrue(f.moveAllowed(Figure.fieldLength * 6 + 0, Figure.fieldLength * 5 + 0, new int[Figure.fieldLength * Figure.fieldLength])); } @Test void checkMoveWithoutNewDestination() { Figure f = new Figure(); - assertFalse(f.moveAllowed(48,48, new int[Figure.fieldSize])); + assertFalse(f.moveAllowed(Figure.fieldLength * 6 + 0, Figure.fieldLength * 6 + 0, new int[Figure.fieldLength * Figure.fieldLength])); } @Test void checkMoveWithValidDestination() { Figure f = new Figure(); - assertTrue(f.moveAllowed(48,40, new int[Figure.fieldSize])); + assertTrue(f.moveAllowed(Figure.fieldLength * 6 + 0, Figure.fieldLength * 5 + 0, new int[Figure.fieldLength * Figure.fieldLength])); } @Test void whiteFarmerInvalidDestinationDown() // statt nach "oben" wird nach "unten" gegangen { Figure f = new Figure(); - assertFalse(f.moveAllowed(48,56, new int[Figure.fieldSize])); + assertFalse(f.moveAllowed(Figure.fieldLength * 6 + 0, Figure.fieldLength * 7 + 0, new int[Figure.fieldLength * Figure.fieldLength])); } } \ No newline at end of file