pub fn is_legal_move(&self, stone: Stone, pos: u64) -> bool {
        if pos.count_ones() != 1 {
            return false;
        }
        let current_bits = self.bits_for(stone);
        let opponent_bits = self.bits_for(stone.flip());

        // Pos must be on an empty square to be legal
        if pos & (current_bits | opponent_bits) != 0 {
            return false;
        }

        for (i, shift) in SHIFT_DIRS.iter().enumerate() {
            let mut dir_mask = 0;
            let shift_mask = SHIFT_MASKS[i] & SHIFT_RAYS[pos.leading_zeros() as usize][i];
            let opponent_bits = opponent_bits & shift_mask;

            let mut current = pos;
            let mut next = current;
            while current != 0 {
                dir_mask |= current;
                next = dir_shift(current, *shift);
                current = next & opponent_bits;
            }
            if next & current_bits != 0 && dir_mask ^ pos != 0 {
                return true;
            }
        }
        false
    }
/// Checks whether or not a move is valid for the specified player.
///
/// The specified bitboard must have one and only one bit set. If this is
/// not true, the function will always return false.
///
/// # Examples
/// ```rust
/// use magpie::othello::{OthelloBoard, Stone};
///
/// let board = OthelloBoard::standard();
/// assert_eq!(false, board.is_legal_move(Stone::Black, 1_u64));
/// ```
Checks whether or not a move is valid for the specified player.
The specified bitboard must have one and only one bit set. If this is
not true, the function will always return false.
Checks whether or not a move is valid for the specified player . The specified bitboard must have one and only one bit set . If this is not true the function will always return false .
pub fn is_legal_move(&self, stone: Stone, pos: u64) -> bool {
        if pos.count_ones() != 1 {
            return false;
        }
        let current_bits = self.bits_for(stone);
        let opponent_bits = self.bits_for(stone.flip());
        // Pos must be on an empty square to be legal
        if pos & (current_bits | opponent_bits) != 0 {
            return false;
        }
        for (i, shift) in SHIFT_DIRS.iter().enumerate() {
            let mut dir_mask = 0;
            let shift_mask = SHIFT_MASKS[i] & SHIFT_RAYS[pos.leading_zeros() as usize][i];
            let opponent_bits = opponent_bits & shift_mask;
            let mut current = pos;
            let mut next = current;
            while current != 0 {
                dir_mask |= current;
                next = dir_shift(current, *shift);
                current = next & opponent_bits;
            }
            if next & current_bits != 0 && dir_mask ^ pos != 0 {
                return true;
            }
        }
        false
    }
pub fn is_legal_move ( & self , stone : Stone , pos : u64 ) -> bool { if pos . count_ones ( ) != 1 { return false ; } let current_bits = self . bits_for ( stone ) ; let opponent_bits = self . bits_for ( stone . flip ( ) ) ; // Pos must be on an empty square to be legal if pos & ( current_bits | opponent_bits ) != 0 { return false ; } for ( i , shift ) in SHIFT_DIRS . iter ( ) . enumerate ( ) { let mut dir_mask = 0 ; let shift_mask = SHIFT_MASKS [ i ] & SHIFT_RAYS [ pos . leading_zeros ( ) as usize ] [ i ] ; let opponent_bits = opponent_bits & shift_mask ; let mut current = pos ; let mut next = current ; while current != 0 { dir_mask |= current ; next = dir_shift ( current , * shift ) ; current = next & opponent_bits ; } if next & current_bits != 0 && dir_mask ^ pos != 0 { return true ; } } false }
Checks whether or not a move is valid for the specified player.
Checks whether or not a move is valid for the specified player .
&self
stone
Stone
pos
u64
examples
```rust
use magpie::othello::{OthelloBoard, Stone}.

let board = OthelloBoard::standard();
assert_eq!(false, board.is_legal_move(Stone::Black, 1_u64));
```
` ` ` rust use magpie :: othello :: { OthelloBoard Stone } . let board = OthelloBoard :: standard () ; assert_eq! ( false board . is_legal_move ( Stone :: Black 1_u64 )) ; ` ` `