Skip to content

Instantly share code, notes, and snippets.

@ilamanov
Last active March 15, 2022 10:57
Show Gist options
  • Select an option

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

Select an option

Save ilamanov/c6a882b6c52aac3eff141d8cfa790761 to your computer and use it in GitHub Desktop.
Piece representation
contract Chess {
/// ======================================Piece Representation======================================
/// Each chess piece is defined with 4 bits as follows:
/// * The first bit denotes the color (0 means black; 1 means white).
/// * The last 3 bits denote the type:
/// | Bits | # | Type |
/// | ---- | - | ------ |
/// | 000 | 0 | Empty |
/// | 001 | 1 | Pawn |
/// | 010 | 2 | Bishop |
/// | 011 | 3 | Rook |
/// | 100 | 4 | Knight |
/// | 101 | 5 | Queen |
/// | 110 | 6 | King |
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment