From dc974ec0e99fa86bf4b0798ef798e2dc57f97c1f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 18 Jul 2022 00:27:08 +0200 Subject: [PATCH] Add 'Bitboard::{ANTI_,}DIAGONAL' --- src/board/bitboard/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/board/bitboard/mod.rs b/src/board/bitboard/mod.rs index d2c8921..d2f3723 100644 --- a/src/board/bitboard/mod.rs +++ b/src/board/bitboard/mod.rs @@ -38,6 +38,12 @@ impl Bitboard { Bitboard(0b11111111_00000000_00000000_00000000_00000000_00000000_00000000_00000000), ]; + /// The diagonal from [Square::A1] to [Square::H8]. + pub const DIAGONAL: Bitboard = Bitboard(0x8040201008040201); + + /// The diagonal from [Square::A8] to [Square::H1]. + pub const ANTI_DIAGONAL: Bitboard = Bitboard(0x0102040810204080); + /// Count the number of pieces in the [Bitboard]. #[inline(always)] pub fn count(self) -> u32 {