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> {
|
||||
let mut directions = HashMap::new();
|
||||
directions.insert('U', (0, 1));
|
||||
directions.insert('D', (0, -1));
|
||||
directions.insert('L', (-1, 0));
|
||||
directions.insert('R', (1, 0));
|
||||
let directions = vec![('U', (0, 1)), ('D', (0, -1)), ('L', (-1, 0)), ('R', (1, 0))]
|
||||
.into_iter()
|
||||
.collect::<HashMap<_, _>>();
|
||||
path.iter()
|
||||
.map(|it| {
|
||||
let direction = it.chars().next().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user