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 6f0f751..642ae9a 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 @@ -31,6 +31,11 @@ public class Figure return false; } + if (src / 8 - dst / 8 < 0 && src % 8 - dst % 8 < 0) // diagonal nach rechts unten + { + return false; + } + return true; } } 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 2406f7e..be95a20 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 @@ -69,4 +69,11 @@ class FigureTest Figure f = new Figure(); assertFalse(f.moveAllowed(Figure.fieldLength * 4 + 4, Figure.fieldLength * 5 + 3, new int[Figure.fieldLength * Figure.fieldLength])); } + + @Test + void whiteRookInvalidMoveRightDown() // diagonal nach rechts unten + { + Figure f = new Figure(); + assertFalse(f.moveAllowed(36, 45, new int[8 * 8])); + } } \ No newline at end of file