reorganize data files, use data files for all days (even when not provided as download)
This commit is contained in:
parent
cebe864c8b
commit
5215f3bb5f
@ -4,6 +4,4 @@ version = "0.1.0"
|
||||
authors = ["Stefan Bühler <stbuehler@web.de>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
|
1
data/day15
Normal file
1
data/day15
Normal file
@ -0,0 +1 @@
|
||||
5,2,8,16,18,0,1
|
1
data/day23
Normal file
1
data/day23
Normal file
@ -0,0 +1 @@
|
||||
315679824
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day1/input");
|
||||
const INPUT: &str = include_str!("../../data/day1");
|
||||
|
||||
fn main() {
|
||||
let expenses: Vec<_> = INPUT.split_whitespace().map(|s| s.parse::<u32>().unwrap()).collect();
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day10/input");
|
||||
const INPUT: &str = include_str!("../../data/day10");
|
||||
|
||||
fn calc(input: &[u32], cache: &mut [Option<u64>], ndx: usize) -> u64 {
|
||||
if let Some(n) = cache[ndx] {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day11/input");
|
||||
const INPUT: &str = include_str!("../../data/day11");
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
enum Cell {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day12/input");
|
||||
const INPUT: &str = include_str!("../../data/day12");
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
enum Rotate {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day13/input");
|
||||
const INPUT: &str = include_str!("../../data/day13");
|
||||
|
||||
struct Input {
|
||||
now: i128,
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day14/input");
|
||||
const INPUT: &str = include_str!("../../data/day14");
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
const INPUT: &str = "5,2,8,16,18,0,1";
|
||||
const INPUT: &str = include_str!("../../data/day15");
|
||||
|
||||
struct Memory {
|
||||
turn: usize,
|
||||
@ -27,7 +27,7 @@ impl Memory {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let input: Vec<usize> = INPUT.split(",").map(|s| s.parse().unwrap()).collect();
|
||||
let input: Vec<usize> = INPUT.trim().split(",").map(|s| s.parse().unwrap()).collect();
|
||||
let mut mem = Memory::new();
|
||||
for &value in &input {
|
||||
mem.remember(value);
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::ops::RangeInclusive;
|
||||
use std::collections::{HashSet, HashMap};
|
||||
|
||||
const INPUT: &str = include_str!("../../data/day16/input");
|
||||
const INPUT: &str = include_str!("../../data/day16");
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Field {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::ops::Range;
|
||||
|
||||
const INPUT: &str = include_str!("../../data/day17/input");
|
||||
const INPUT: &str = include_str!("../../data/day17");
|
||||
|
||||
#[derive(Clone, Copy, Default)]
|
||||
struct Dimension {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day18/input");
|
||||
const INPUT: &str = include_str!("../../data/day18");
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
enum Op {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::sync::Arc;
|
||||
|
||||
const INPUT: &str = include_str!("../../data/day19/input");
|
||||
const INPUT: &str = include_str!("../../data/day19");
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
enum Rule {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::convert::TryInto;
|
||||
|
||||
const INPUT: &str = include_str!("../../data/day2/input");
|
||||
const INPUT: &str = include_str!("../../data/day2");
|
||||
|
||||
struct Policy {
|
||||
min: usize,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
const INPUT: &str = include_str!("../../data/day20/input");
|
||||
const INPUT: &str = include_str!("../../data/day20");
|
||||
|
||||
#[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, Debug)]
|
||||
enum Side {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
|
||||
const INPUT: &str = include_str!("../../data/day21/input");
|
||||
const INPUT: &str = include_str!("../../data/day21");
|
||||
|
||||
struct FoodDescription<'a> {
|
||||
ingredients: HashSet<&'a str>,
|
||||
|
@ -2,7 +2,7 @@ use std::collections::{VecDeque, HashSet};
|
||||
|
||||
type Deck = VecDeque<u32>;
|
||||
|
||||
const INPUT: &str = include_str!("../../data/day22/input");
|
||||
const INPUT: &str = include_str!("../../data/day22");
|
||||
|
||||
fn parse_player(block: &str) -> (u32, Deck) {
|
||||
let block = block.strip_prefix("Player ").unwrap();
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::mem::replace;
|
||||
|
||||
const INPUT: &str = "315679824";
|
||||
const INPUT: &str = include_str!("../../data/day23");
|
||||
|
||||
type Item = usize;
|
||||
|
||||
@ -200,14 +200,14 @@ impl Cups {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut cups = Cups::parse(INPUT);
|
||||
let mut cups = Cups::parse(INPUT.trim());
|
||||
for _ in 0..100 {
|
||||
cups.mix();
|
||||
}
|
||||
cups.rotate_to_one();
|
||||
println!("Cups: {}", cups.iter().skip(1).map(|c| format!("{}", c)).collect::<Vec<_>>().join(""));
|
||||
|
||||
let mut cups = Cups::parse(INPUT);
|
||||
let mut cups = Cups::parse(INPUT.trim());
|
||||
cups.extend(10..=1000000);
|
||||
for _ in 0..10000000 {
|
||||
cups.mix()
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
const INPUT: &str = include_str!("../../data/day24/input");
|
||||
const INPUT: &str = include_str!("../../data/day24");
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||
enum Direction {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day25/input");
|
||||
const INPUT: &str = include_str!("../../data/day25");
|
||||
|
||||
const MOD: u32 = 20201227;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day3/input");
|
||||
const INPUT: &str = include_str!("../../data/day3");
|
||||
|
||||
struct Forest {
|
||||
pub rows: usize,
|
||||
|
@ -2,7 +2,7 @@ pub mod passport;
|
||||
|
||||
use passport::Passport;
|
||||
|
||||
const INPUT: &str = include_str!("../../../data/day4/input");
|
||||
const INPUT: &str = include_str!("../../../data/day4");
|
||||
|
||||
fn main() {
|
||||
let passports = Passport::parse_list(INPUT);
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day5/input");
|
||||
const INPUT: &str = include_str!("../../data/day5");
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
|
||||
struct Seat {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day6/input");
|
||||
const INPUT: &str = include_str!("../../data/day6");
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
|
||||
struct Answers {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::collections::{HashMap, HashSet, VecDeque};
|
||||
|
||||
const INPUT: &str = include_str!("../../data/day7/input");
|
||||
const INPUT: &str = include_str!("../../data/day7");
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||
struct BagId(usize);
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day8/input");
|
||||
const INPUT: &str = include_str!("../../data/day8");
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
enum Instruction {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const INPUT: &str = include_str!("../../data/day9/input");
|
||||
const INPUT: &str = include_str!("../../data/day9");
|
||||
|
||||
// store sums of elems in different row and colum, but just once
|
||||
// | 0 | 1 | 2 | 3 | ...
|
||||
|
Loading…
Reference in New Issue
Block a user