pub fn apply_move(self, mv: Move) -> Result<Self, InvalidMoveError> {
        match mv {
            Move::Pass => {
                if self.legal_moves.is_empty() {
                    Ok(Self::new(self.board.pass(), !self.active_player))
                } else {
                    Err(InvalidMoveError)
                }
            }
            Move::Piece(loc) => {
                if self.legal_moves.contains(loc) {
                    Ok(Self::new(self.board.apply_move(loc), !self.active_player))
                } else {
                    Err(InvalidMoveError)
                }
            }
        }
    }
/// Compute the game state after a move.
Compute the game state after a move.
Compute the game state after a move .
pub fn apply_move(self, mv: Move) -> Result<Self, InvalidMoveError> {
        match mv {
            Move::Pass => {
                if self.legal_moves.is_empty() {
                    Ok(Self::new(self.board.pass(), !self.active_player))
                } else {
                    Err(InvalidMoveError)
                }
            }
            Move::Piece(loc) => {
                if self.legal_moves.contains(loc) {
                    Ok(Self::new(self.board.apply_move(loc), !self.active_player))
                } else {
                    Err(InvalidMoveError)
                }
            }
        }
    }
pub fn apply_move ( self , mv : Move ) -> Result < Self , InvalidMoveError > { match mv { Move :: Pass => { if self . legal_moves . is_empty ( ) { Ok ( Self :: new ( self . board . pass ( ) , ! self . active_player ) ) } else { Err ( InvalidMoveError ) } } Move :: Piece ( loc ) => { if self . legal_moves . contains ( loc ) { Ok ( Self :: new ( self . board . apply_move ( loc ) , ! self . active_player ) ) } else { Err ( InvalidMoveError ) } } } }
Compute the game state after a move.
Compute the game state after a move .
self
mv
Move
self
mv
Move