mirror of
https://github.com/Baipyrus/AoC-23.git
synced 2024-12-25 19:41:45 +00:00
extract '#' as galaxies
This commit is contained in:
parent
83925dfd48
commit
c06faa97ff
@ -8,8 +8,29 @@ pub fn part_two() {
|
||||
#[allow(dead_code)]
|
||||
pub fn part_one() {
|
||||
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>> {
|
||||
let name = "day11";
|
||||
println!("Executing module '{name}' entrypoint . . . ");
|
||||
|
Loading…
Reference in New Issue
Block a user