If you're deriving from one of the board-size specific games then there are shortcuts to enable these easily. But the options vary depending on the board size, so for unusual sizes it is a little more work.
You can look at the include file for Duke of Rutlands Chess for an example but here are the relevant bits. For castling, conventional chess would be:
The arguments to CastlingMove are: player (0 or 1); the square the king starts on; the square the king ends on; the square the other piece starts on; the square the other piece ends on; and a single character specifying what letter should be placed in the FEN to represent the availability of this move.
For the two-space pawn move, in chess it would be:
The last bit, { location: location.Rank == 1 } is a lambda function taking a location and returning true or false specifying where on the board this new move should be available. Ranks are counted starting at zero, so Rank == 1 means whenever on the second rank. The arguments sent to the constructor of MoveCapability are: the direction of the move, <1, 0> means rank offset of 1 and file offset of zero; minimum number of steps; maximum number of steps; is capture allowed; and is capture required. We did not set the minimum number of steps to 1 because the pawn already has a single-space move and we don't want to generate it twice.
Finally, if you want en passant, just set EnPassant = true in your SetGameVariables function.
If you're deriving from one of the board-size specific games then there are shortcuts to enable these easily. But the options vary depending on the board size, so for unusual sizes it is a little more work.
You can look at the include file for Duke of Rutlands Chess for an example but here are the relevant bits. For castling, conventional chess would be:
AddCastlingRule();
CastlingMove( 0, "e1", "g1", "h1", "f1", `K` );
CastlingMove( 0, "e1", "c1", "a1", "d1", `Q` );
CastlingMove( 1, "e8", "g8", "h8", "f8", `k` );
CastlingMove( 1, "e8", "c8", "a8", "d8", `q` );
The arguments to CastlingMove are: player (0 or 1); the square the king starts on; the square the king ends on; the square the other piece starts on; the square the other piece ends on; and a single character specifying what letter should be placed in the FEN to represent the availability of this move.
For the two-space pawn move, in chess it would be:
Pawn.AddMoveCapability( MoveCapability( <1, 0>, 2, 2, false, false ) ).Condition = { location: location.Rank == 1 };
The last bit,
{ location: location.Rank == 1 }
is a lambda function taking a location and returning true or false specifying where on the board this new move should be available. Ranks are counted starting at zero, so Rank == 1 means whenever on the second rank. The arguments sent to the constructor of MoveCapability are: the direction of the move, <1, 0> means rank offset of 1 and file offset of zero; minimum number of steps; maximum number of steps; is capture allowed; and is capture required. We did not set the minimum number of steps to 1 because the pawn already has a single-space move and we don't want to generate it twice.Finally, if you want en passant, just set EnPassant = true in your SetGameVariables function.