aboutsummaryrefslogtreecommitdiff
path: root/src/attacks.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-23 03:41:07 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-23 03:41:07 +0300
commit973a8bf7a63cd185980fb7997da2ea8488c0070e (patch)
tree00b4c4234514082a7e6fd61cbe28d3560c423078 /src/attacks.rs
parentbe1a88383619900d30d2e63ad91e041ec10392ae (diff)
downloadchessnost-973a8bf7a63cd185980fb7997da2ea8488c0070e.tar.gz
fix: correct RANK_6 constant
Diffstat (limited to 'src/attacks.rs')
-rw-r--r--src/attacks.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/attacks.rs b/src/attacks.rs
index d5bc8a3..7fc6b7d 100644
--- a/src/attacks.rs
+++ b/src/attacks.rs
@@ -9,7 +9,7 @@ static H_FILE: Bitboard = 0x8080808080808080;
static DIAG_C2_H7: Bitboard = 0x0080402010080400;
static DIAG_A1_H8: Bitboard = 0x8040201008040201;
static RANK_2: Bitboard = 0x000000000000FF00;
-static RANK_6: Bitboard = 0x0000FF0000000000;
+static RANK_6: Bitboard = 0x00FF800000000000;
/// An array where N-th item is an attack bitboard
/// of a piece on N-th square
@@ -274,7 +274,7 @@ impl Attacks {
((rank_attacks as u128 * DIAG_A1_H8 as u128) as Bitboard & H_FILE) >> (7 - file)
}
- fn bishop(&self, occupancy: Bitboard, square: u8) -> Bitboard {
+ pub fn bishop(&self, occupancy: Bitboard, square: u8) -> Bitboard {
let diagonal_mask =
self.ray_attacks[Direction::NoEa as usize][square as usize] |
self.ray_attacks[Direction::SoWe as usize][square as usize];
@@ -285,7 +285,7 @@ impl Attacks {
self.kindergarten_attacks_base(occupancy, diagonal_mask, square) | self.kindergarten_attacks_base(occupancy, anti_diagonal_mask, square)
}
- fn rook(&self, occupancy: Bitboard, square: u8) -> Bitboard {
+ pub fn rook(&self, occupancy: Bitboard, square: u8) -> Bitboard {
let vertical =
self.ray_attacks[Direction::Nort as usize][square as usize] |
self.ray_attacks[Direction::Sout as usize][square as usize];
@@ -296,7 +296,7 @@ impl Attacks {
self.kindergarten_attacks_file(occupancy, vertical, square) | self.kindergarten_attacks_base(occupancy, horizontal, square)
}
- fn queen(&self, occupancy: Bitboard, square: u8) -> Bitboard {
+ pub fn queen(&self, occupancy: Bitboard, square: u8) -> Bitboard {
self.rook(occupancy, square) | self.bishop(occupancy, square)
}
}