Anonymous user
Generate random chess position: Difference between revisions
→{{header|zkl}}: doh
m (→{{header|REXX}}: changed REXX program to allow generation of an unbalanced total number of pieces (by color).) |
(→{{header|zkl}}: doh) |
||
Line 224:
# We try to find suitable king positions on non-adjacent squares.
# If we could not find any, we return recursively
kings := Utils.Helpers.cprod2(n,n).
a!=b and (a/8 - b/8).abs() or (a%8 - b%8).abs()>1
})
if(not kings) return(pickFEN()); // tail recursion
# We make a list of pieces we can pick (apart from the kings)
|