2020: day23: use rotate_left from VecDeque

This commit is contained in:
Antoine Martin 2020-12-24 02:06:29 +01:00
parent 022ca7daab
commit d998cb02aa

View file

@ -53,8 +53,7 @@ impl CupCircle {
/// This doesn't change anything to the cup circle layout, except that the new first cup is /// This doesn't change anything to the cup circle layout, except that the new first cup is
/// considered the "current" cup at the end of a step in our implementation /// considered the "current" cup at the end of a step in our implementation
fn shift(&mut self) { fn shift(&mut self) {
let front = self.0.pop_front().unwrap(); self.0.rotate_left(1);
self.0.push_back(front);
} }
/// Executes one step of the game /// Executes one step of the game