Last active
March 15, 2022 10:57
-
-
Save ilamanov/c6a882b6c52aac3eff141d8cfa790761 to your computer and use it in GitHub Desktop.
Piece representation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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