|
9 | 9 | * This technique is used to optimize the memory space of the lookup table of rook and bishop moves. |
10 | 10 | * |
11 | 11 | * The lookup table is indexed by piece square and the blockers bitboard (pieces that block the path of the piece). |
12 | | - * We cut off unnecesary information like the board borders and the squares outside its attack pattern. |
| 12 | + * We cut off unnecessary information like the board borders and the squares outside its attack pattern. |
13 | 13 | * Optimally we could use 11 bits for bishop moves (2048 > 1428) and 13 bits for rooks (8196 > 4900). |
14 | 14 | * |
15 | 15 | * A magic number is a multiplier to the index with the following property: |
16 | 16 | * - keeps intact the important info about the blockers (the nearest blockers to the piece are intact). |
17 | 17 | * For example: [Rook] -> -> -> [pawn1][pawn2]. |
18 | | - * In this case pawn2 is an unnecesary piece inside the blockers bitboard, because the piece that actually |
| 18 | + * In this case pawn2 is an unnecessary piece inside the blockers bitboard, because the piece that actually |
19 | 19 | * block the path of the rook is pawn1. |
20 | 20 | * |
21 | 21 | * - Reduces the index number close to the optimal size (ideally to fit inside 11 or 13 bits) |
@@ -236,7 +236,7 @@ static inline constexpr uint64_t bishop_magic(Square square) |
236 | 236 | */ |
237 | 237 | inline uint64_t magic_index_rook(uint64_t blockers, Square rook_square, uint64_t rook_attacks) |
238 | 238 | { |
239 | | - // we cut unnecesary information to optimize memory space: board edges and squares outside the attack mask. |
| 239 | + // we cut unnecessary information to optimize memory space: board edges and squares outside the attack mask. |
240 | 240 | const uint64_t edges = ((ROW_1_MASK | ROW_8_MASK) & ~get_row_mask(rook_square.row())) | |
241 | 241 | ((COL_A_MASK | COL_H_MASK) & ~get_col_mask(rook_square.col())); |
242 | 242 | blockers &= rook_attacks & ~edges; |
@@ -265,7 +265,7 @@ inline uint64_t magic_index_rook(uint64_t blockers, Square rook_square, uint64_t |
265 | 265 | */ |
266 | 266 | inline uint64_t magic_index_bishop(uint64_t blockers, Square bishop_square, uint64_t bishop_attacks) |
267 | 267 | { |
268 | | - // we cut unnecesary information to optimize memory space: board edges and squares outside the attack mask. |
| 268 | + // we cut unnecessary information to optimize memory space: board edges and squares outside the attack mask. |
269 | 269 | const uint64_t edges = ((ROW_1_MASK | ROW_8_MASK) & ~get_row_mask(bishop_square.row())) | |
270 | 270 | ((COL_A_MASK | COL_H_MASK) & ~get_col_mask(bishop_square.col())); |
271 | 271 |
|
|
0 commit comments