Skip to content

Instantly share code, notes, and snippets.

@ilamanov
Created March 15, 2022 10:59
Show Gist options
  • Select an option

  • Save ilamanov/c134e16e2ec767fa6d24ba4093906e6f to your computer and use it in GitHub Desktop.

Select an option

Save ilamanov/c134e16e2ec767fa6d24ba4093906e6f to your computer and use it in GitHub Desktop.
Sentinels and whose turn
contract Chess {
/// The top/bottom rows and left/right columns are treated as sentinel rows/columns for efficient
/// boundary validation (see {Chess-generateMoves} and {Chess-isValid}). i.e., (63, ..., 56),
/// (07, ..., 00), (63, ..., 07), and (56, ..., 00) never contain pieces. Every bit in those rows
/// and columns should be ignored, except for the last bit. The last bit denotes whose turn it is to
/// play (0 means black's turn; 1 means white's turn). e.g. a potential starting position:
/// Black
/// 00 00 00 00 00 00 00 00 Black
/// 00 03 02 05 06 02 03 00 ♜ ♝ ♛ ♚ ♝ ♜
/// 00 01 01 01 01 01 01 00 ♟ ♟ ♟ ♟ ♟ ♟
/// 00 00 00 00 00 00 00 00 denotes
/// 00 00 00 00 00 00 00 00 the board
/// 00 09 09 09 09 09 09 00 ♙ ♙ ♙ ♙ ♙ ♙
/// 00 11 12 13 14 12 11 00 ♖ ♘ ♕ ♔ ♘ ♖
/// 00 00 00 00 00 00 00 01 White
/// White
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment