pub fn available_moves(&self, move_buffer: &mut Vec<Move>) {
        // Go through each vehicle in the stage
        for vehicle_id in 0..self.vehicles.len() {

            // Attempt to move the vehicle forward or backward
            for &direction in &[Direction::Forward, Direction::Backward] {
                let move_ = Move { vehicle_id, direction };

                // Keep only valid moves
                if self.make_move(move_).is_some() {
                    move_buffer.push(move_);
                }
            }
        }
    }
/// Fill the buffer with possible moves for the current stage
Fill the buffer with possible moves for the current stage
Fill the buffer with possible moves for the current stage
pub fn available_moves(&self, move_buffer: &mut Vec<Move>) {
        // Go through each vehicle in the stage
        for vehicle_id in 0..self.vehicles.len() {
            // Attempt to move the vehicle forward or backward
            for &direction in &[Direction::Forward, Direction::Backward] {
                let move_ = Move { vehicle_id, direction };
                // Keep only valid moves
                if self.make_move(move_).is_some() {
                    move_buffer.push(move_);
                }
            }
        }
    }
pub fn available_moves ( & self , move_buffer : & mut Vec < Move > ) { // Go through each vehicle in the stage for vehicle_id in 0 .. self . vehicles . len ( ) { // Attempt to move the vehicle forward or backward for & direction in & [ Direction :: Forward , Direction :: Backward ] { let move_ = Move { vehicle_id , direction } ; // Keep only valid moves if self . make_move ( move_ ) . is_some ( ) { move_buffer . push ( move_ ) ; } } } }
Fill the buffer with possible moves for the current stage
Fill the buffer with possible moves for the current stage
&self
move_buffer
&mut Vec<Move>
&self
move_buffer
&mut Vec<Move>