correct const mask names, correct doc comments about endianness
This commit is contained in:
parent
d702342ebb
commit
de02670685
1 changed files with 12 additions and 13 deletions
|
|
@ -89,25 +89,24 @@ pub fn explode_board(mut b: Board) -> impl Iterator<Item = Board> {
|
||||||
// Positive => SHL
|
// Positive => SHL
|
||||||
// Negative => SHR
|
// Negative => SHR
|
||||||
// simply negating the A file
|
// simply negating the A file
|
||||||
const NOT_A_FILE: Board = 0x7F7F7F7F7F7F7F7F;
|
const NOT_A_FILE: Board = 0xFEFEFEFEFEFEFEFE;
|
||||||
// simply negating the H file
|
// simply negating the H file
|
||||||
const NOT_H_FILE: Board = 0xFEFEFEFEFEFEFEFE;
|
const NOT_H_FILE: Board = 0x7F7F7F7F7F7F7F7F;
|
||||||
const SHIFT_MASK_COMBOS: [(i8, Board); 8] = [
|
const SHIFT_MASK_COMBOS: [(i8, Board); 8] = [
|
||||||
(9, NOT_A_FILE), // 9 (up right)
|
(9, NOT_H_FILE), // 9 (up right)
|
||||||
(8, Board::MAX), // 8 (up)
|
(8, Board::MAX), // 8 (up)
|
||||||
(7, NOT_H_FILE), // 7 (up left)
|
(7, NOT_A_FILE), // 7 (up left)
|
||||||
(1, NOT_A_FILE), // 1 (right)
|
(1, NOT_H_FILE), // 1 (right)
|
||||||
(-1, NOT_H_FILE), // -1 (left)
|
(-1, NOT_A_FILE), // -1 (left)
|
||||||
(-7, NOT_A_FILE), // -7 (down right)
|
(-7, NOT_H_FILE), // -7 (down right)
|
||||||
(-8, Board::MAX), // -8 (down)
|
(-8, Board::MAX), // -8 (down)
|
||||||
(-9, NOT_H_FILE), // -9 (down left)
|
(-9, NOT_A_FILE), // -9 (down left)
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Represents the board state using two integers. This allows us to reduce the
|
/// Represents the board state using two integers. This allows us to reduce the
|
||||||
/// memory footprint by 75% when compared against using a byte[8][8] (64
|
/// memory footprint by 75% when compared against using a byte[8][8] (64
|
||||||
/// bytes). While digits in these boards do not have _place value_ per se, it
|
/// bytes). This structure is identical to what the Chess world identifies as
|
||||||
/// still may be helpful to think of the structure as being Big Endian and
|
/// Little-Endian Rank-File _LERF_.
|
||||||
/// by that I mean to say that h8 is the leftmost bit and a1 is the rightmost.
|
|
||||||
///
|
///
|
||||||
/// The values are to be mapped as follows where each number indicates the bit
|
/// The values are to be mapped as follows where each number indicates the bit
|
||||||
/// in the integer that corresponds to the position in the board:
|
/// in the integer that corresponds to the position in the board:
|
||||||
|
|
@ -126,8 +125,8 @@ const SHIFT_MASK_COMBOS: [(i8, Board); 8] = [
|
||||||
///
|
///
|
||||||
/// =
|
/// =
|
||||||
///
|
///
|
||||||
/// bits: 00 01 ... 07 08 09 ... 15 ... 56 57 ... 63
|
/// bit: 00 01 ... 07 08 09 ... 15 ... 56 57 ... 63
|
||||||
/// board: a1 b1 ... h1 a2 b2 ... h2 ... a8 b8 ... h8
|
/// square: a1 b1 ... h1 a2 b2 ... h2 ... a8 b8 ... h8
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note that I use the traditional nomenclature of ranks and files which
|
/// Note that I use the traditional nomenclature of ranks and files which
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue