diff --git a/README.md b/README.md index ebae8fa..6895e31 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ interface. It is highly recommended that you run it from a chess GUI like * Ronja versions 0.7.0 and earlier require Java 8. * Ronja versions 0.8.x require Java 11. -* Ronja versions 0.9.0 and later require Java 17. +* Ronja versions 0.9.0 and later require Java 17+. ## Installation diff --git a/src/main/java/se/dykstrom/ronja/engine/time/TimeUtils.java b/src/main/java/se/dykstrom/ronja/engine/time/TimeUtils.java index 7e450a8..c1d2f60 100644 --- a/src/main/java/se/dykstrom/ronja/engine/time/TimeUtils.java +++ b/src/main/java/se/dykstrom/ronja/engine/time/TimeUtils.java @@ -107,7 +107,7 @@ public static TimeControl parseLevelText(final String text) throws ParseExceptio } catch (NumberFormatException nfe) { throw new ParseException("invalid time increment", 0); } - return new TimeControl(numberOfMoves, baseTime, increment, (increment == 0) ? CLASSIC : INCREMENTAL); + return new TimeControl(numberOfMoves, baseTime, increment, (numberOfMoves != 0) ? CLASSIC : INCREMENTAL); } private static long getIncrementAsMillis(final String[] parts) { diff --git a/src/test/java/se/dykstrom/ronja/engine/time/TimeUtilsTest.java b/src/test/java/se/dykstrom/ronja/engine/time/TimeUtilsTest.java index 9e0821e..444a18f 100644 --- a/src/test/java/se/dykstrom/ronja/engine/time/TimeUtilsTest.java +++ b/src/test/java/se/dykstrom/ronja/engine/time/TimeUtilsTest.java @@ -41,6 +41,8 @@ public class TimeUtilsTest { private static final TimeControl TC_10_01_00 = new TimeControl(10, 60 * 1000, 0, CLASSIC); private static final TimeControl TC_40_05_00 = new TimeControl(40, 5 * 60 * 1000, 0, CLASSIC); + // Incremental time with an increment of 0 + private static final TimeControl TC_0_03_00 = new TimeControl(0, 3 * 60 * 1000, 0, INCREMENTAL); private static final TimeControl TC_0_30_05 = new TimeControl(0, 30 * 60 * 1000, 5 * 1000, INCREMENTAL); private static final TimeControl TC_0_00_10 = new TimeControl(0, 0, 10 * 1000, INCREMENTAL); private static final TimeControl TC_10_1_30_00 = new TimeControl(10, 90 * 1000, 0, CLASSIC); @@ -62,6 +64,7 @@ public void testFormatTime() { public void testParseLevelText() throws Exception { assertEquals(TC_40_05_00, parseLevelText("40 5 0")); assertEquals(TC_10_01_00, parseLevelText("10 0:60 0")); + assertEquals(TC_0_03_00, parseLevelText("0 3 0")); assertEquals(TC_0_30_05, parseLevelText("0 30 5")); assertEquals(TC_0_00_10, parseLevelText("0 0 10")); assertEquals(TC_10_1_30_00, parseLevelText("10 1:30 0"));