fn push_room(&mut self, room: usize) -> usize {
        debug_assert!(0 < room && room < 5);
        let mut steps = DEPTH;
        let doorstep = 7 + (room - 1) * DEPTH - 1; // Not a real index, but becomes one +1.
        while steps > 0 {
            if self.0[doorstep + steps] == 0 {
                self.0[doorstep + steps] = room as u8;
                return steps;
            }
            steps -= 1;
        }
        panic!("Tried to push room {} into a full room", room);
    }
// Assumes an amphipod is right outside the room and pulls it into the deepest
// free seat in the room. Returns the steps this takes.
// Remember that rooms are 1-indexed.
Assumes an amphipod is right outside the room and pulls it into the deepest
free seat in the room. Returns the steps this takes.
Remember that rooms are 1-indexed.
Assumes an amphipod is right outside the room and pulls it into the deepest free seat in the room . Returns the steps this takes . Remember that rooms are 1 - indexed .
fn push_room(&mut self, room: usize) -> usize {
        debug_assert!(0 < room && room < 5);
        let mut steps = DEPTH;
        let doorstep = 7 + (room - 1) * DEPTH - 1; // Not a real index, but becomes one +1.
        while steps > 0 {
            if self.0[doorstep + steps] == 0 {
                self.0[doorstep + steps] = room as u8;
                return steps;
            }
            steps -= 1;
        }
        panic!("Tried to push room {} into a full room", room);
    }
fn push_room ( & mut self , room : usize ) -> usize { debug_assert ! ( 0 room room 5 ) ; let mut steps = DEPTH ; let doorstep = 7 + ( room - 1 ) * DEPTH - 1 ; // Not a real index, but becomes one +1. while steps > 0 { if self . 0 [ doorstep + steps ] == 0 { self . 0 [ doorstep + steps ] = room as u8 ; return steps ; } steps -= 1 ; } panic ! ( " " room ) ; }
Assumes an amphipod is right outside the room and pulls it into the deepest
free seat in the room.
Assumes an amphipod is right outside the room and pulls it into the deepest free seat in the room .
&mut self
room
usize