-
Notifications
You must be signed in to change notification settings - Fork 20
Algorithm for RacingKings1440 positions
Similar to Chess960, there is RacingKings1440. I have created this algorithm to get a Racing Kings position for a given number, based on the Direct derivation algorithm from the Chess960 numbering scheme.
White's starting array can be derived from a number N (0 ... 1439) as follows:
-
Divide N by 4, yielding quotient N2 and remainder K. Use the value K to decide the position of the king like this:
Only these 4 squares are used. On the F-file, the king could be checked by knights and on the E-file by any piece.
-
Divide N2 by 3, yielding quotient N3 and remainder B1. If K is even, iterate over the dark squares (see screenshot below for the order; blue circles) and put a bishop on the (B1 + 1)'th empty square. If K is odd, do the same but for the light squares (orange circles).
-
Divide N3 by 4, yielding quotient N4 and remainder B2. If K is odd, iterate over the dark squares (orange on screenshot above) and put a bishop on the (B2 + 1)'th empty square. If K is even, do the same but for the dark squares (blue circles).
-
Divide N4 by 5, yielding quotient N5 and remainder Q. Iterate over all squares that belong to white (in the order as described by the red circles on below screenshot) and put the queen on the (Q + 1)'th empty square.
-
N5 is now a number from 0 to 5 (inclusive). Iterate over white's squares just like above, and use this configuration to fill the empty squares, based on N5:
N5 | Configuration ------------------ 0 | N N R R 1 | N R N R 2 | N R R N 3 | R N N R 4 | R N R N 5 | R R N N
Now you have the piece configuration for white. If you want a symmetrical 1440 game, just mirror the acquired position and put it on the other half of the board. If you want an asymmetrical game, calculate the configration for white for another number and mirror that configuration.