Skip to content

Commit f52e877

Browse files
committed
reorg cont'd
1 parent 17a4b9c commit f52e877

File tree

303 files changed

+4943
-4550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+4943
-4550
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ __pycache__/
1616
*.log
1717

1818
input.txt
19+
answer.txt
1920

2021
/build/
2122
build/

2015/day1/day1.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//! [Day 1: Not Quite Lisp](https://adventofcode.com/2015/day/1)
22
33
/// Solve the puzzle.
4-
fn solve(data: &str) -> (i32, i32) {
4+
#[must_use]
5+
pub fn solve(data: &str) -> (i32, i32) {
56
let mut floor = 0;
67
let mut position = 0;
78
let mut enter = 0;
@@ -22,8 +23,8 @@ fn solve(data: &str) -> (i32, i32) {
2223
}
2324

2425
/// Main function.
25-
fn main() {
26-
let mut args = aoc::parse_args();
26+
pub fn main() {
27+
let args = aoc::parse_args();
2728

2829
args.run(solve);
2930
}

2015/day10/day10.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
//! [Day 10: Elves Look, Elves Say](https://adventofcode.com/2015/day/10)
22
33
/// main function
4-
fn main() {
5-
let mut args = aoc::parse_args();
4+
pub fn main() {
5+
let args = aoc::parse_args();
66
args.run(solve);
77
}
88

9-
fn solve(data: &str) -> (usize, usize) {
9+
/// # Panics
10+
/// over malformed input
11+
#[must_use]
12+
pub fn solve(data: &str) -> (usize, usize) {
1013
let data = data.trim_ascii();
1114

1215
(calc(data, 40), calc(data, 50))

2015/day11/day11.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::fmt;
44

55
#[derive(Clone)]
6-
struct Password {
6+
pub struct Password {
77
pwd: Vec<char>,
88
loops: usize,
99
}
@@ -90,15 +90,18 @@ impl fmt::Display for Password {
9090
}
9191
}
9292

93-
fn solve(data: &str) -> (Password, Password) {
93+
/// # Panics
94+
/// over malformed input
95+
#[must_use]
96+
pub fn solve(data: &str) -> (Password, Password) {
9497
let mut pwd: Password = Password::new(data.trim_ascii());
9598

9699
(pwd.next_valid(), pwd.next_valid())
97100
}
98101

99102
/// main function
100-
fn main() {
101-
let mut args = aoc::parse_args();
103+
pub fn main() {
104+
let args = aoc::parse_args();
102105
args.run(solve);
103106
}
104107

2015/day12/day12.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ use regex::Regex;
44
use serde_json::Value;
55

66
/// main function
7-
fn main() {
8-
let mut args = aoc::parse_args();
7+
pub fn main() {
8+
let args = aoc::parse_args();
99
args.run(solve);
1010
}
1111

12-
fn solve(data: &str) -> (i32, i32) {
12+
/// # Panics
13+
/// over malformed input
14+
#[must_use]
15+
pub fn solve(data: &str) -> (i32, i32) {
1316
(part1(data), part2(data))
1417
}
1518

2015/day13/day13.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ fn calc<'a>(names: &FxHashSet<&'a str>, happiness: &FxHashMap<(&'a str, &'a str)
2424
.unwrap()
2525
}
2626

27-
fn solve<'a>(data: &'a str) -> (i32, i32) {
28-
let mut names: FxHashSet<&'a str> = FxHashSet::default();
29-
let mut happiness: FxHashMap<(&'a str, &'a str), i32> = FxHashMap::default();
27+
/// # Panics
28+
/// over malformed input
29+
#[must_use]
30+
pub fn solve(data: &str) -> (i32, i32) {
31+
let mut names: FxHashSet<&str> = FxHashSet::default();
32+
let mut happiness: FxHashMap<(&str, &str), i32> = FxHashMap::default();
3033

3134
let re =
3235
Regex::new(r"^(.+) would (gain|lose) (\d+) happiness units by sitting next to (.+)\.$")
@@ -64,8 +67,8 @@ fn solve<'a>(data: &'a str) -> (i32, i32) {
6467
}
6568

6669
/// main function
67-
fn main() {
68-
let mut args = aoc::parse_args();
70+
pub fn main() {
71+
let args = aoc::parse_args();
6972
args.run(solve);
7073
}
7174

2015/day14/day14.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,16 @@ fn solve_duration(data: &str, max_duration: u32) -> (u32, u32) {
8080
(max_distance, *scores.iter().max().unwrap())
8181
}
8282

83-
fn solve(data: &str) -> (u32, u32) {
83+
/// # Panics
84+
/// over malformed input
85+
#[must_use]
86+
pub fn solve(data: &str) -> (u32, u32) {
8487
solve_duration(data, 2503)
8588
}
8689

8790
/// Main function.
88-
fn main() {
89-
let mut args = aoc::parse_args();
91+
pub fn main() {
92+
let args = aoc::parse_args();
9093
args.run(solve);
9194
}
9295

2015/day15/day15.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ struct Ingredient {
1111
texture: i64,
1212
calories: i64,
1313
}
14-
fn solve(data: &str) -> (i64, i64) {
14+
15+
/// # Panics
16+
/// over malformed input
17+
#[must_use]
18+
pub fn solve(data: &str) -> (i64, i64) {
1519
// load data
1620
let mut ingredients = Vec::new();
1721
let re = Regex::new(r"(\w+): capacity (-?\d+), durability (-?\d+), flavor (-?\d+), texture (-?\d+), calories (-?\d+)").unwrap();
@@ -105,8 +109,8 @@ fn solve(data: &str) -> (i64, i64) {
105109
}
106110

107111
/// main function
108-
fn main() {
109-
let mut args = aoc::parse_args();
112+
pub fn main() {
113+
let args = aoc::parse_args();
110114
args.run(solve);
111115
}
112116

2015/day16/day16.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ impl<'a> Puzzle<'a> {
6767
}
6868

6969
/// main function
70-
fn solve(data: &str) -> (u32, u32) {
70+
#[must_use]
71+
pub fn solve(data: &str) -> (u32, u32) {
7172
let puzzle = Puzzle::new(data);
7273
(puzzle.part1(), puzzle.part2())
7374
}
7475

75-
fn main() {
76-
let mut args = aoc::parse_args();
76+
pub fn main() {
77+
let args = aoc::parse_args();
7778
args.run(solve);
7879
}

2015/day17/day17.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ use itertools::Itertools;
44
use rustc_hash::FxHashMap;
55

66
/// main function
7-
fn main() {
8-
let mut args = aoc::parse_args();
7+
pub fn main() {
8+
let args = aoc::parse_args();
99
args.run(solve);
1010
}
1111

12-
fn solve(data: &str) -> (i32, usize) {
12+
/// # Panics
13+
/// over malformed input
14+
#[must_use]
15+
pub fn solve(data: &str) -> (i32, usize) {
1316
solve_eggnot(data, 150)
1417
}
1518

0 commit comments

Comments
 (0)