#[repr(u8)]pub enum File {
One = 0,
Two = 1,
Three = 2,
Four = 3,
Five = 4,
Six = 5,
Seven = 6,
Eight = 7,
Nine = 8,
}Expand description
A file (column) on a shogi board.
Variants§
One = 0
File One
Two = 1
File Two
Three = 2
File Three
Four = 3
File Four
Five = 4
File Five
Six = 5
File Six
Seven = 6
File Seven
Eight = 7
File Eight
Nine = 8
File Nine
Implementations§
Source§impl File
impl File
Source§impl File
impl File
Sourcepub const fn flip(self) -> Self
pub const fn flip(self) -> Self
Flip the file horizontally around the central file File::Five.
This mirrors the file in the central file. It maps File::One to File::Nine, and vice-versa, and similar for all other files.
§Examples
assert_eq!(File::Five.flip(), File::Five);
assert_eq!(File::One.flip(), File::Nine);Sourcepub const fn bitboard(self) -> BitBoard
pub const fn bitboard(self) -> BitBoard
Get a bitboard with all squares on this file set.
File 1 is the east-most file board diagrams.
§Examples
assert_eq!(File::Eight.bitboard(), bitboard! {
. X . . . . . . .
. X . . . . . . .
. X . . . . . . .
. X . . . . . . .
. X . . . . . . .
. X . . . . . . .
. X . . . . . . .
. X . . . . . . .
. X . . . . . . .
});Sourcepub const fn west(self) -> BitBoard
pub const fn west(self) -> BitBoard
Get a bitboard with all squares to the West of this file set.
§Examples
use haitaka_types::*;
assert_eq!(File::Nine.west(), BitBoard::EMPTY);
assert_eq!(File::Eight.west(), File::Nine.bitboard());
assert_eq!(File::Two.west(), bitboard!{
X X X X X X X . .
X X X X X X X . .
X X X X X X X . .
X X X X X X X . .
X X X X X X X . .
X X X X X X X . .
X X X X X X X . .
X X X X X X X . .
X X X X X X X . .
});Sourcepub const fn east(self) -> BitBoard
pub const fn east(self) -> BitBoard
Get a bitboard with all squares to the East of this file set.
§Examples
use haitaka_types::*;
assert_eq!(File::One.east(), BitBoard::EMPTY);
assert_eq!(File::Two.east(), File::One.bitboard());
assert_eq!(File::Seven.east(), bitboard!{
. . . X X X X X X
. . . X X X X X X
. . . X X X X X X
. . . X X X X X X
. . . X X X X X X
. . . X X X X X X
. . . X X X X X X
. . . X X X X X X
. . . X X X X X X
});Trait Implementations§
Source§impl Ord for File
impl Ord for File
Source§impl PartialOrd for File
impl PartialOrd for File
impl Copy for File
impl Eq for File
impl StructuralPartialEq for File
Auto Trait Implementations§
impl Freeze for File
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnwindSafe for File
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more