extract '#' as galaxies

This commit is contained in:
Baipyrus 2024-01-25 17:45:13 +01:00
parent 83925dfd48
commit c06faa97ff

View File

@ -8,8 +8,29 @@ pub fn part_two() {
#[allow(dead_code)] #[allow(dead_code)]
pub fn part_one() { pub fn part_one() {
let input = setup(); let input = setup();
let mut galaxies = extract(input);
} }
fn extract(symbols: Vec<Vec<String>>) -> Vec<Galaxy> {
let mut galaxies = Vec::new();
for (y, line) in symbols.iter().enumerate() {
for (x, symbol) in line.iter().enumerate() {
if symbol.as_str() == "." { continue; }
galaxies.push(Galaxy { x, y });
}
}
galaxies
}
struct Galaxy {
x: usize,
y: usize,
}
fn setup() -> Vec<Vec<String>> { fn setup() -> Vec<Vec<String>> {
let name = "day11"; let name = "day11";
println!("Executing module '{name}' entrypoint . . . "); println!("Executing module '{name}' entrypoint . . . ");