Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ljgago committed Oct 29, 2021
0 parents commit 2d4e1dd
Show file tree
Hide file tree
Showing 129 changed files with 1,553 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
110 changes: 110 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
[package]
name = "advent_of_code"
version = "1.0.0"
authors = ["John Doe"]
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[[bin]]
name = "day01"
path = "src/day01/bin/main.rs"

[[bin]]
name = "day02"
path = "src/day02/bin/main.rs"

[[bin]]
name = "day03"
path = "src/day03/bin/main.rs"

[[bin]]
name = "day04"
path = "src/day04/bin/main.rs"

[[bin]]
name = "day05"
path = "src/day05/bin/main.rs"

[[bin]]
name = "day06"
path = "src/day06/bin/main.rs"

[[bin]]
name = "day07"
path = "src/day07/bin/main.rs"

[[bin]]
name = "day08"
path = "src/day08/bin/main.rs"

[[bin]]
name = "day09"
path = "src/day09/bin/main.rs"

[[bin]]
name = "day10"
path = "src/day10/bin/main.rs"

[[bin]]
name = "day11"
path = "src/day11/bin/main.rs"

[[bin]]
name = "day12"
path = "src/day12/bin/main.rs"

[[bin]]
name = "day13"
path = "src/day13/bin/main.rs"

[[bin]]
name = "day14"
path = "src/day14/bin/main.rs"

[[bin]]
name = "day15"
path = "src/day15/bin/main.rs"

[[bin]]
name = "day16"
path = "src/day16/bin/main.rs"

[[bin]]
name = "day17"
path = "src/day17/bin/main.rs"

[[bin]]
name = "day18"
path = "src/day18/bin/main.rs"

[[bin]]
name = "day19"
path = "src/day19/bin/main.rs"

[[bin]]
name = "day20"
path = "src/day20/bin/main.rs"

[[bin]]
name = "day21"
path = "src/day21/bin/main.rs"

[[bin]]
name = "day22"
path = "src/day22/bin/main.rs"

[[bin]]
name = "day23"
path = "src/day23/bin/main.rs"

[[bin]]
name = "day24"
path = "src/day24/bin/main.rs"

[[bin]]
name = "day25"
path = "src/day25/bin/main.rs"

[dependencies]
regex = "1"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Leonardo Javier Gago

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Advent of Code Rust Starter

- [Day 1](src/day01)
- [Day 2](src/day02)
- [Day 3](src/day03)
- [Day 4](src/day04)
- [Day 5](src/day05)
- [Day 6](src/day06)
- [Day 7](src/day07)
- [Day 8](src/day08)
- [Day 9](src/day09)
- [Day 10](src/day10)
- [Day 11](src/day11)
- [Day 12](src/day12)
- [Day 13](src/day13)
- [Day 14](src/day14)
- [Day 15](src/day15)
- [Day 16](src/day16)
- [Day 17](src/day17)
- [Day 18](src/day18)
- [Day 19](src/day19)
- [Day 20](src/day20)
- [Day 21](src/day21)
- [Day 22](src/day22)
- [Day 23](src/day23)
- [Day 24](src/day24)
- [Day 25](src/day25)

## Usage

The project is configured for `run`, `test` and `build` each day independently.

For example:

# only run the day01
$ cargo run --bin day01

# only test the day02
$ cargo test --bin day02

# only build the day03
$ cargo build --bin day03

Folder structure:

└── src
└── day01
   ├── bin
   │   ├── main.rs
   │   ├── part1.rs
   │   └── part2.rs
   ├── README.md
   └── resources
   └── input.txt

Happy coding!

[MIT License](LICENSE)
10 changes: 10 additions & 0 deletions src/day01/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Advent of Code - Day 1

## Part One

TODO

## Part Two

TODO

14 changes: 14 additions & 0 deletions src/day01/bin/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//! # Advent of Code - Day 1
mod part1;
mod part2;

fn main() {
let _input = include_bytes!("../resources/input.txt");

println!("--- Part One ---");
println!("Result: {}", part1::result().unwrap());

println!("--- Part Two ---");
println!("Result: {}", part2::result().unwrap());
}
15 changes: 15 additions & 0 deletions src/day01/bin/part1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! # Advent of Code - Day 1 - Part One
pub fn result() -> Result<i64, &'static str> {
Ok(0)
}

#[cfg(test)]
mod day01 {
use super::*;

#[test]
fn test_result() {
assert_eq!(Ok(0), result());
}
}
15 changes: 15 additions & 0 deletions src/day01/bin/part2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! # Advent of Code - Day 1 - Part Two
pub fn result() -> Result<i64, &'static str> {
Ok(0)
}

#[cfg(test)]
mod day01 {
use super::*;

#[test]
fn test_result() {
assert_eq!(Ok(0), result());
}
}
Empty file added src/day01/resources/input.txt
Empty file.
10 changes: 10 additions & 0 deletions src/day02/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Advent of Code - Day 2

## Part One

TODO

## Part Two

TODO

14 changes: 14 additions & 0 deletions src/day02/bin/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//! # Advent of Code - Day 2
mod part1;
mod part2;

fn main() {
let _input = include_bytes!("../resources/input.txt");

println!("--- Part One ---");
println!("Result: {}", part1::result().unwrap());

println!("--- Part Two ---");
println!("Result: {}", part2::result().unwrap());
}
15 changes: 15 additions & 0 deletions src/day02/bin/part1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! # Advent of Code - Day 2 - Part One
pub fn result() -> Result<i64, &'static str> {
Ok(0)
}

#[cfg(test)]
mod day02 {
use super::*;

#[test]
fn test_result() {
assert_eq!(Ok(0), result());
}
}
15 changes: 15 additions & 0 deletions src/day02/bin/part2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! # Advent of Code - Day 2 - Part Two
pub fn result() -> Result<i64, &'static str> {
Ok(0)
}

#[cfg(test)]
mod day02 {
use super::*;

#[test]
fn test_result() {
assert_eq!(Ok(0), result());
}
}
Empty file added src/day02/resources/input.txt
Empty file.
10 changes: 10 additions & 0 deletions src/day03/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Advent of Code - Day 3

## Part One

TODO

## Part Two

TODO

14 changes: 14 additions & 0 deletions src/day03/bin/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//! # Advent of Code - Day 3
mod part1;
mod part2;

fn main() {
let _input = include_bytes!("../resources/input.txt");

println!("--- Part One ---");
println!("Result: {}", part1::result().unwrap());

println!("--- Part Two ---");
println!("Result: {}", part2::result().unwrap());
}
15 changes: 15 additions & 0 deletions src/day03/bin/part1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! # Advent of Code - Day 3 - Part One
pub fn result() -> Result<i64, &'static str> {
Ok(0)
}

#[cfg(test)]
mod day03 {
use super::*;

#[test]
fn test_result() {
assert_eq!(Ok(0), result());
}
}
15 changes: 15 additions & 0 deletions src/day03/bin/part2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! # Advent of Code - Day 3 - Part Two
pub fn result() -> Result<i64, &'static str> {
Ok(0)
}

#[cfg(test)]
mod day03 {
use super::*;

#[test]
fn test_result() {
assert_eq!(Ok(0), result());
}
}
Empty file added src/day03/resources/input.txt
Empty file.
10 changes: 10 additions & 0 deletions src/day04/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Advent of Code - Day 4

## Part One

TODO

## Part Two

TODO

Loading

0 comments on commit 2d4e1dd

Please sign in to comment.