Changed VecDeque for Vec

This commit is contained in:
Jan-Bulthuis 2024-12-06 19:21:21 +01:00
parent 5b3445fe39
commit 8c9ec6cbb1
1 changed files with 3 additions and 5 deletions

View File

@ -1,5 +1,3 @@
use std::collections::VecDeque;
use aoc_runner_derive::{aoc, aoc_generator};
// type Input = ((usize, usize), Vec<Vec<u8>>);
@ -20,7 +18,7 @@ const NEXT_DIR: [usize; 5] = [RIGHT as usize, LEFT as usize, UP as usize, 0, DOW
fn parse(input: &str) -> Input {
let lines = input.split("\n");
let mut pos = (0, 0);
let mut stones = VecDeque::new();
let mut stones = Vec::with_capacity(input.len());
let map: Vec<Vec<u8>> = lines
.enumerate()
@ -30,7 +28,7 @@ fn parse(input: &str) -> Input {
.map(|(x, c)| match c {
'.' => EMPTY,
'#' => {
stones.push_back((x, y));
stones.push((x, y));
WALL
}
'^' => {
@ -45,7 +43,7 @@ fn parse(input: &str) -> Input {
let mut jumps = vec![vec![[u8::MAX; 5]; map[0].len()]; map.len()];
while let Some((x, y)) = stones.pop_front() {
for (x, y) in stones {
for dir in NEXT_DIR {
let mut d = 1;
loop {