Started on aoc day 12
This commit is contained in:
31
advent_of_code/2022/12/src/main.rs
Normal file
31
advent_of_code/2022/12/src/main.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
fn main() {
|
||||
let test_input = include_str!("../test.txt")
|
||||
.split_whitespace()
|
||||
.collect::<Vec<&str>>();
|
||||
|
||||
let mut start = (0, 0);
|
||||
let mut end = (0, 0);
|
||||
let mut points : HashMap<(u32, u32), u32> = HashMap::new();
|
||||
|
||||
let mut y = 0;
|
||||
for line in test_input {
|
||||
let mut x = 0;
|
||||
for ch in line.chars() {
|
||||
let mut c = ch;
|
||||
if c == 'S' {
|
||||
c = 'a';
|
||||
start = (x, y);
|
||||
}
|
||||
if c == 'E' {
|
||||
c = 'z';
|
||||
end = (x, y);
|
||||
}
|
||||
|
||||
points.insert((x, y), c as u32 - 'a' as u32);
|
||||
x += 1;
|
||||
}
|
||||
y += 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user