Generate random chess position: Difference between revisions

m
Line 224:
# We try to find suitable king positions on non-adjacent squares.
# If we could not find any, we return recursively
kings := UtilsWalker.Helpers.cprod2cproduct(n,n).filter1(fcn([(a,b)]){ // crossCartesian product
a!=b and (a/8 - b/8).abs() or (a%8 - b%8).abs()>1
}); # (a,b) on success, False on fail
Anonymous user