summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/2020/1.txt (renamed from data/1.txt)0
-rw-r--r--data/2020/2.txt (renamed from data/2.txt)0
-rw-r--r--data/2020/3.txt (renamed from data/3.txt)0
-rw-r--r--data/2020/4.txt (renamed from data/4.txt)0
-rw-r--r--data/2020/5.txt (renamed from data/5.txt)0
-rw-r--r--data/2020/6.txt (renamed from data/6.txt)0
-rw-r--r--data/2020/7.txt (renamed from data/7.txt)0
-rw-r--r--data/2020/8.txt (renamed from data/8.txt)0
-rw-r--r--data/2020/9.txt (renamed from data/9.txt)0
-rw-r--r--src/2020/1/mod.rs4
-rw-r--r--src/2020/2/mod.rs2
-rw-r--r--src/2020/3/mod.rs2
-rw-r--r--src/2020/4/mod.rs4
-rw-r--r--src/2020/5/mod.rs4
-rw-r--r--src/2020/6/mod.rs4
-rw-r--r--src/2020/7/mod.rs4
-rw-r--r--src/2020/8/mod.rs4
-rw-r--r--src/2020/9/mod.rs4
18 files changed, 16 insertions, 16 deletions
diff --git a/data/1.txt b/data/2020/1.txt
index 15a9273..15a9273 100644
--- a/data/1.txt
+++ b/data/2020/1.txt
diff --git a/data/2.txt b/data/2020/2.txt
index 45e8c19..45e8c19 100644
--- a/data/2.txt
+++ b/data/2020/2.txt
diff --git a/data/3.txt b/data/2020/3.txt
index 8985593..8985593 100644
--- a/data/3.txt
+++ b/data/2020/3.txt
diff --git a/data/4.txt b/data/2020/4.txt
index 646dcfe..646dcfe 100644
--- a/data/4.txt
+++ b/data/2020/4.txt
diff --git a/data/5.txt b/data/2020/5.txt
index 86c40f6..86c40f6 100644
--- a/data/5.txt
+++ b/data/2020/5.txt
diff --git a/data/6.txt b/data/2020/6.txt
index cb5c69a..cb5c69a 100644
--- a/data/6.txt
+++ b/data/2020/6.txt
diff --git a/data/7.txt b/data/2020/7.txt
index 8d098c3..8d098c3 100644
--- a/data/7.txt
+++ b/data/2020/7.txt
diff --git a/data/8.txt b/data/2020/8.txt
index 296e397..296e397 100644
--- a/data/8.txt
+++ b/data/2020/8.txt
diff --git a/data/9.txt b/data/2020/9.txt
index 3102d88..3102d88 100644
--- a/data/9.txt
+++ b/data/2020/9.txt
diff --git a/src/2020/1/mod.rs b/src/2020/1/mod.rs
index 1c18cad..ec3e1f2 100644
--- a/src/2020/1/mod.rs
+++ b/src/2020/1/mod.rs
@@ -1,5 +1,5 @@
pub fn part1() -> anyhow::Result<i64> {
- let ints = crate::util::read_ints("data/1.txt")?;
+ let ints = crate::util::read_ints("data/2020/1.txt")?;
for i in &ints {
for j in &ints {
if i + j == 2020 {
@@ -11,7 +11,7 @@ pub fn part1() -> anyhow::Result<i64> {
}
pub fn part2() -> anyhow::Result<i64> {
- let ints = crate::util::read_ints("data/1.txt")?;
+ let ints = crate::util::read_ints("data/2020/1.txt")?;
for i in &ints {
for j in &ints {
for k in &ints {
diff --git a/src/2020/2/mod.rs b/src/2020/2/mod.rs
index 1026b03..d2cf88d 100644
--- a/src/2020/2/mod.rs
+++ b/src/2020/2/mod.rs
@@ -65,7 +65,7 @@ pub fn part2() -> anyhow::Result<i64> {
}
fn read_lines() -> anyhow::Result<Vec<Line>> {
- let f = std::fs::File::open("data/2.txt")
+ let f = std::fs::File::open("data/2020/2.txt")
.context("couldn't find data file 2.txt")?;
let f = std::io::BufReader::new(f);
f.lines()
diff --git a/src/2020/3/mod.rs b/src/2020/3/mod.rs
index 298c121..6658b64 100644
--- a/src/2020/3/mod.rs
+++ b/src/2020/3/mod.rs
@@ -79,6 +79,6 @@ pub fn part2() -> anyhow::Result<i64> {
}
fn read_map() -> anyhow::Result<Map> {
- let map_str = crate::util::read_file("data/3.txt")?;
+ let map_str = crate::util::read_file("data/2020/3.txt")?;
Map::parse(&map_str)
}
diff --git a/src/2020/4/mod.rs b/src/2020/4/mod.rs
index a249b0f..827e648 100644
--- a/src/2020/4/mod.rs
+++ b/src/2020/4/mod.rs
@@ -4,7 +4,7 @@ const REQUIRED_KEYS: &[&str] =
&["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"];
pub fn part1() -> anyhow::Result<i64> {
- let batch = crate::util::read_file_str("data/4.txt")?;
+ let batch = crate::util::read_file_str("data/2020/4.txt")?;
let mut valid = 0;
for passport in parse(&batch)? {
let mut cur_valid = true;
@@ -22,7 +22,7 @@ pub fn part1() -> anyhow::Result<i64> {
}
pub fn part2() -> anyhow::Result<i64> {
- let batch = crate::util::read_file_str("data/4.txt")?;
+ let batch = crate::util::read_file_str("data/2020/4.txt")?;
let mut valid = 0;
for passport in parse(&batch)? {
let mut cur_valid = true;
diff --git a/src/2020/5/mod.rs b/src/2020/5/mod.rs
index d0005f8..e574a45 100644
--- a/src/2020/5/mod.rs
+++ b/src/2020/5/mod.rs
@@ -2,7 +2,7 @@ use anyhow::Context as _;
use std::convert::TryInto as _;
pub fn part1() -> anyhow::Result<i64> {
- let input = crate::util::read_file_str("data/5.txt")?;
+ let input = crate::util::read_file_str("data/2020/5.txt")?;
let mut max = 0;
for line in input.lines() {
let id = seat_id(line)?;
@@ -15,7 +15,7 @@ pub fn part1() -> anyhow::Result<i64> {
pub fn part2() -> anyhow::Result<i64> {
let mut seats = vec![false; 1024];
- let input = crate::util::read_file_str("data/5.txt")?;
+ let input = crate::util::read_file_str("data/2020/5.txt")?;
for line in input.lines() {
let id = seat_id(line)?;
seats[id as usize] = true;
diff --git a/src/2020/6/mod.rs b/src/2020/6/mod.rs
index 8a9d81c..9d22667 100644
--- a/src/2020/6/mod.rs
+++ b/src/2020/6/mod.rs
@@ -1,5 +1,5 @@
pub fn part1() -> anyhow::Result<i64> {
- let input = crate::util::read_file_str("data/6.txt")?;
+ let input = crate::util::read_file_str("data/2020/6.txt")?;
let mut yes = std::collections::HashSet::new();
let mut total = 0;
for line in input.lines() {
@@ -17,7 +17,7 @@ pub fn part1() -> anyhow::Result<i64> {
}
pub fn part2() -> anyhow::Result<i64> {
- let input = crate::util::read_file_str("data/6.txt")?;
+ let input = crate::util::read_file_str("data/2020/6.txt")?;
let mut yes = std::collections::HashSet::new();
for c in 'a'..='z' {
yes.insert(c);
diff --git a/src/2020/7/mod.rs b/src/2020/7/mod.rs
index 79334d4..26fa507 100644
--- a/src/2020/7/mod.rs
+++ b/src/2020/7/mod.rs
@@ -3,7 +3,7 @@ use anyhow::Context as _;
type Graph = std::collections::HashMap<String, Vec<(i64, String)>>;
pub fn part1() -> anyhow::Result<i64> {
- let input = crate::util::read_file_str("data/7.txt")?;
+ let input = crate::util::read_file_str("data/2020/7.txt")?;
let graph = parse(&input)?;
let mut colors = 0;
for color in graph.keys() {
@@ -15,7 +15,7 @@ pub fn part1() -> anyhow::Result<i64> {
}
pub fn part2() -> anyhow::Result<i64> {
- let input = crate::util::read_file_str("data/7.txt")?;
+ let input = crate::util::read_file_str("data/2020/7.txt")?;
let graph = parse(&input)?;
// subtract 1 to not count the shiny gold bag itself
count_bags(&graph, "shiny gold").map(|i| i - 1)
diff --git a/src/2020/8/mod.rs b/src/2020/8/mod.rs
index 0e5d686..c5bf835 100644
--- a/src/2020/8/mod.rs
+++ b/src/2020/8/mod.rs
@@ -44,7 +44,7 @@ impl std::str::FromStr for Op {
}
pub fn part1() -> anyhow::Result<i64> {
- let input = crate::util::read_file_str("data/8.txt")?;
+ let input = crate::util::read_file_str("data/2020/8.txt")?;
let opcodes = parse(&input)?;
let (acc, success) = run(&opcodes)?;
if success {
@@ -54,7 +54,7 @@ pub fn part1() -> anyhow::Result<i64> {
}
pub fn part2() -> anyhow::Result<i64> {
- let input = crate::util::read_file_str("data/8.txt")?;
+ let input = crate::util::read_file_str("data/2020/8.txt")?;
let opcodes = parse(&input)?;
for i in 0..opcodes.len() {
match opcodes[i].ty {
diff --git a/src/2020/9/mod.rs b/src/2020/9/mod.rs
index ac7e14c..9684099 100644
--- a/src/2020/9/mod.rs
+++ b/src/2020/9/mod.rs
@@ -1,7 +1,7 @@
pub fn part1() -> anyhow::Result<i64> {
const WINDOW: usize = 25;
- let list = crate::util::read_ints("data/9.txt")?;
+ let list = crate::util::read_ints("data/2020/9.txt")?;
for i in 0..(list.len() - WINDOW) {
let set = &list[i..i + WINDOW];
let n = list[i + WINDOW];
@@ -16,7 +16,7 @@ pub fn part1() -> anyhow::Result<i64> {
pub fn part2() -> anyhow::Result<i64> {
const WINDOW: usize = 25;
- let list = crate::util::read_ints("data/9.txt")?;
+ let list = crate::util::read_ints("data/2020/9.txt")?;
let mut invalid = None;
for i in 0..(list.len() - WINDOW) {
let set = &list[i..i + WINDOW];