Jump to content

Find Chess960 starting position identifier: Difference between revisions

Line 599:
}
List<Integer> rookAndKing = List.of(aPosition.indexOf('R'), aPosition.indexOf('K'), aPosition.lastIndexOf('R'));
List.of(aPosition.indexOf('R'), aPosition.indexOf('K'), aPosition.lastIndexOf('R'));
if ( ! ( rookAndKing.get(0) < rookAndKing.get(1) && rookAndKing.get(1) < rookAndKing.get(2) ) ) {
throw new AssertionError("The king must be between the two rooks.");
Line 621 ⟶ 622:
private static String retainIf(String aText, Predicate<Character> aPredicate) {
return aText.chars().mapToObj( i -> (char) i ).filter(aPredicate).map(String::valueOf).reduce("", String::concat);
.map(String::valueOf).reduce("", String::concat);
}
894

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.