mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-27 13:50:32 +01:00
Compare commits
2 Commits
0b91da04b3
...
d9d5947c3b
| Author | SHA1 | Date | |
|---|---|---|---|
| d9d5947c3b | |||
| cc8b4ce353 |
@@ -4,4 +4,4 @@ version = "0.1.0"
|
||||
authors = ["Bert Peters <bert.ljpeters@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
regex = "0.1"
|
||||
regex = "1"
|
||||
|
||||
@@ -73,10 +73,10 @@ fn main() {
|
||||
let door_label = line.unwrap();
|
||||
let caps = room_pattern.captures(&door_label).unwrap();
|
||||
|
||||
let name = caps.at(1).unwrap();
|
||||
let checksum = caps.at(4).unwrap();
|
||||
let name = caps.get(1).unwrap().as_str();
|
||||
let checksum = caps.get(4).unwrap().as_str();
|
||||
if is_valid(name, checksum) {
|
||||
let sector_id = caps.at(3).unwrap().parse().unwrap();
|
||||
let sector_id = caps.get(3).unwrap().as_str().parse().unwrap();
|
||||
cur_sum += sector_id;
|
||||
|
||||
let decoded: String = name.chars()
|
||||
|
||||
@@ -4,5 +4,5 @@ version = "0.1.0"
|
||||
authors = ["Bert Peters <bert.ljpeters@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
regex = "^0.1"
|
||||
lazy_static = "^0.2"
|
||||
regex = "1"
|
||||
lazy_static = "1"
|
||||
|
||||
@@ -4,4 +4,4 @@ version = "0.1.0"
|
||||
authors = ["Bert Peters <bert.ljpeters@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
regex="^0.1"
|
||||
regex="1"
|
||||
|
||||
@@ -48,7 +48,7 @@ fn parse_fold(input: &[u8]) -> IResult<&[u8], Fold> {
|
||||
)(input)
|
||||
}
|
||||
|
||||
fn apply_fold(dots: &mut Vec<Coords>, fold: Fold) {
|
||||
fn apply_fold(dots: &mut [Coords], fold: Fold) {
|
||||
match fold {
|
||||
Fold::X(coord) => dots.iter_mut().for_each(|(x, _)| {
|
||||
if *x >= coord {
|
||||
|
||||
Reference in New Issue
Block a user