fn from_str(board_str: &str) -> Result<Self, Self::Err> {
        if board_str.len() != (NUM_SPACES as usize) {
            return Err(ParseBoardError);
        }

        let mut active_bitboard: u64 = 0;
        let mut opponent_bitboard: u64 = 0;

        for char in board_str.chars() {
            active_bitboard <<= 1;
            opponent_bitboard <<= 1;

            match char {
                'X' => (active_bitboard |= 1),
                'O' => (opponent_bitboard |= 1),
                '-' => (),
                _ => return Err(ParseBoardError),
            };
        }

        Ok(Board {
            active_bitboard: Bitboard::from(active_bitboard),
            opponent_bitboard: Bitboard::from(opponent_bitboard),
            just_passed: false,
        })
    }
/// Parse a board in the FFO format, assuming Black is going first.
Parse a board in the FFO format, assuming Black is going first.
Parse a board in the FFO format assuming Black is going first .
fn from_str(board_str: &str) -> Result<Self, Self::Err> {
        if board_str.len() != (NUM_SPACES as usize) {
            return Err(ParseBoardError);
        }
        let mut active_bitboard: u64 = 0;
        let mut opponent_bitboard: u64 = 0;
        for char in board_str.chars() {
            active_bitboard <<= 1;
            opponent_bitboard <<= 1;
            match char {
                'X' => (active_bitboard |= 1),
                'O' => (opponent_bitboard |= 1),
                '-' => (),
                _ => return Err(ParseBoardError),
            };
        }
        Ok(Board {
            active_bitboard: Bitboard::from(active_bitboard),
            opponent_bitboard: Bitboard::from(opponent_bitboard),
            just_passed: false,
        })
    }
fn from_str ( board_str : & str ) -> Result < Self , Self :: Err > { if board_str . len ( ) != ( NUM_SPACES as usize ) { return Err ( ParseBoardError ) ; } let mut active_bitboard : u64 = 0 ; let mut opponent_bitboard : u64 = 0 ; for char in board_str . chars ( ) { active_bitboard <<= 1 ; opponent_bitboard <<= 1 ; match char { 'X' => ( active_bitboard |= 1 ) , 'O' => ( opponent_bitboard |= 1 ) , '-' => ( ) , _ => return Err ( ParseBoardError ) , } ; } Ok ( Board { active_bitboard : Bitboard :: from ( active_bitboard ) , opponent_bitboard : Bitboard :: from ( opponent_bitboard ) , just_passed : false , } ) }
Parse a board in the FFO format, assuming Black is going first.
Parse a board in the FFO format assuming Black is going first .
board_str
&str
board_str
&str