day03 task 2 cleanup
This commit is contained in:
@@ -102,11 +102,9 @@ fn task2(p1: &Vec<&str>, p2: &Vec<&str>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_points(path: &Vec<&str>) -> HashMap<(i32, i32), usize> {
|
fn get_points(path: &Vec<&str>) -> HashMap<(i32, i32), usize> {
|
||||||
let mut directions = HashMap::new();
|
let directions = vec![('U', (0, 1)), ('D', (0, -1)), ('L', (-1, 0)), ('R', (1, 0))]
|
||||||
directions.insert('U', (0, 1));
|
.into_iter()
|
||||||
directions.insert('D', (0, -1));
|
.collect::<HashMap<_, _>>();
|
||||||
directions.insert('L', (-1, 0));
|
|
||||||
directions.insert('R', (1, 0));
|
|
||||||
path.iter()
|
path.iter()
|
||||||
.map(|it| {
|
.map(|it| {
|
||||||
let direction = it.chars().next().unwrap();
|
let direction = it.chars().next().unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user