diff --git a/fh.fd.ci.client/src/main/java/de/fd/fh/FigureBishop.java b/fh.fd.ci.client/src/main/java/de/fd/fh/FigureBishop.java index b9e6e6f..55f4abd 100644 --- a/fh.fd.ci.client/src/main/java/de/fd/fh/FigureBishop.java +++ b/fh.fd.ci.client/src/main/java/de/fd/fh/FigureBishop.java @@ -10,6 +10,11 @@ public class FigureBishop extends Figure return false; } + if (dst - src == 1) // 1 Feld nach rechts + { + return false; + } + return super.moveAllowed(src, dst, field); } } diff --git a/fh.fd.ci.client/src/test/java/de/fd/fh/FigureBishopTest.java b/fh.fd.ci.client/src/test/java/de/fd/fh/FigureBishopTest.java index acbf798..260f239 100644 --- a/fh.fd.ci.client/src/test/java/de/fd/fh/FigureBishopTest.java +++ b/fh.fd.ci.client/src/test/java/de/fd/fh/FigureBishopTest.java @@ -17,4 +17,13 @@ class FigureBishopTest assertFalse(f.moveAllowed(src, dst, new Figure[Figure.fieldLength * Figure.fieldLength])); } + + @Test + void checkInvalidMovesBishopRight() + { + Figure f = new FigureBishop(); + + assertFalse(f.moveAllowed(45, 46, + new Figure[64])); + } } \ No newline at end of file