Skip to content

Commit 393db17

Browse files
committed
feat: updated readme with day 5
1 parent ea3fd90 commit 393db17

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
- [Day 2](https://github.com/ankjevel/adventofcode/tree/2019/day_02) 🌟 🌟
88
- [Day 3](https://github.com/ankjevel/adventofcode/tree/2019/day_03) 🌟 🌟
99
- [Day 4](https://github.com/ankjevel/adventofcode/tree/2019/day_04) 🌟 🌟
10+
- [Day 5](https://github.com/ankjevel/adventofcode/tree/2019/day_05) 🌟 🌟

day_01/src/part_01.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use std::io;
22

33
pub fn main(input: &Vec<i32>) -> io::Result<Vec<i32>> {
4-
Ok(input.iter()
4+
Ok(input
5+
.iter()
56
.map(|&mass| ((mass.clone() as f64 / 3.0).floor() as i32) - 2)
67
.collect())
78
}

day_03/src/structs.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub enum Direction {
33
Up,
44
Down,
55
Left,
6-
Right
6+
Right,
77
}
88

99
#[derive(Clone, Copy, Eq, PartialEq, Hash, Debug)]
@@ -13,23 +13,20 @@ pub struct Movement {
1313
}
1414

1515
impl Movement {
16-
pub fn new (input: &str) -> Movement {
16+
pub fn new(input: &str) -> Movement {
1717
let mut chars = input.chars();
1818

1919
let direction = match chars.next().unwrap() {
2020
'U' => Direction::Up,
2121
'D' => Direction::Down,
2222
'L' => Direction::Left,
2323
'R' => Direction::Right,
24-
_ => panic!("direction not defined")
24+
_ => panic!("direction not defined"),
2525
};
2626

2727
let steps = chars.as_str().parse::<i32>().unwrap();
2828

29-
Movement {
30-
direction,
31-
steps,
32-
}
29+
Movement { direction, steps }
3330
}
3431
}
3532

@@ -40,10 +37,7 @@ pub struct Point {
4037
}
4138

4239
impl Point {
43-
pub fn new () -> Point {
44-
Point {
45-
x: 0,
46-
y: 0,
47-
}
40+
pub fn new() -> Point {
41+
Point { x: 0, y: 0 }
4842
}
4943
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy