Skip to content

Commit

Permalink
chore: Preparations for AoC 2021!
Browse files Browse the repository at this point in the history
  • Loading branch information
icyJoseph committed Nov 18, 2021
1 parent 31e2a8e commit 1325124
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 2021/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"deno.enable": true,
"deno.unstable": true
}
2 changes: 2 additions & 0 deletions 2021/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["./*/src/.."]
21 changes: 21 additions & 0 deletions 2021/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Aoc 2021

Rust + Deno :heart:

## Generate a new day with Rust

```bash
cargo generate --git https://github.com/icyJoseph/advent-of-code.git template --name day-1
```

## Run Rust binaries

```bash
cargo run --bin day-1
```

## Run Deno scripts

```bash
deno run --allow-read --allow-write deno/day-1.ts
```
9 changes: 9 additions & 0 deletions 2021/day-1/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
authors = ["Joseph Chamochumbi <[email protected]>"]
edition = "2018"
name = "day-1"
version = "0.1.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
aoc = {git = "https://github.com/icyJoseph/advent-of-code.git"}
14 changes: 14 additions & 0 deletions 2021/day-1/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use aoc;

fn solve(raw: String) -> () {
println!("{}", raw);
}

fn main() {
let input = aoc::get_input(2021, 1);

let raw_input = std::fs::read_to_string("./input/day-1.in").expect("Error reading input");

solve(input);
solve(raw_input);
}
12 changes: 12 additions & 0 deletions 2021/deno/day-1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const input = await Deno.readTextFile("./input/day-1.in");

/**
* Part One
*/

console.log("Part One:", input);

/**
* Part Two
*/
console.log("Part Two:", input);

0 comments on commit 1325124

Please sign in to comment.