advent-of-code/2021/readme.md

92 lines
2.3 KiB
Markdown
Raw Permalink Normal View History

2021-12-01 08:47:18 -06:00
# 2021
This year, I've been tinkering a lot with [Deno][deno] as a [TypeScript][ts]
runtime and have been really enjoying it. I'm hoping to write this year's AoC
solutions using it.
Specifically, here's my `deno --version` output:
2021-12-13 09:53:03 -06:00
$ deno --version
2021-12-01 08:47:18 -06:00
deno 1.16.3 (release, x86_64-unknown-linux-gnu)
v8 9.7.106.5
typescript 4.4.2
2021-12-16 17:00:15 -06:00
It looks like I'm also doing some of these in Nim.
2021-12-06 11:39:34 -06:00
2021-12-13 09:53:03 -06:00
$ nim --version
Nim Compiler Version 1.6.0 [Linux: amd64]
Compiled at 2021-10-19
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 727c6378d2464090564dbcd9bc8b9ac648467e38
active boot switches: -d:release
2021-12-16 17:00:15 -06:00
And I decided part way through to do some Rust.
$ rustc --version
rustc 1.58.0-beta.2 (0e07bcb68 2021-12-04)
Enjoy!
2021-12-01 10:45:41 -06:00
## Usage
2021-12-16 17:00:15 -06:00
Run these solutions like so from their respective directories:
2021-12-01 10:45:41 -06:00
deno run --unstable --allow-all $DAY.ts
2021-12-06 11:39:34 -06:00
And the Nim ones like so:
2021-12-13 09:53:03 -06:00
nim c -d:release -d:ssl --run day$DAY.nim
2021-12-06 11:39:34 -06:00
2021-12-16 17:00:15 -06:00
And Rust:
rustc -O --out-dir build day$DAY.rs && ./build/day$DAY
2021-12-06 11:39:34 -06:00
And if you want to measure memory usage with Deno programs:
mkdir -p build
deno compile --output build/$DAY --unstable --allow-all $DAY.ts
/usr/bin/time -v ./build/$DAY
2021-12-06 11:39:34 -06:00
Or for Nim programs:
mkdir -p build
2021-12-13 09:53:03 -06:00
nim c -d:release -d:ssl --outdir:build day$DAY.nim
/usr/bin/time -v ./day$DAY
2021-12-06 11:39:34 -06:00
2021-12-16 17:00:15 -06:00
And similarly for Rust:
rustc -O --out-dir build day$DAY.rs
/usr/bin/time -v ./build/day$DAY
2021-12-01 09:46:18 -06:00
# Days
2021-12-16 17:00:15 -06:00
- [x] Day 1: [Deno](./deno/1.ts), [Nim](./nim/day1.nim)
- [x] Day 2: [Deno](./deno/2.ts), [Nim](./nim/day2.nim)
- [x] Day 3: [Deno](./deno/3.ts), [Nim](./nim/day3.nim)
- [x] Day 4: [Nim](./nim/day4.nim)
- [x] Day 5: [Nim](./nim/day5.nim)
- [x] Day 6: [Nim](./nim/day6.nim)
- [x] Day 7: [Nim](./nim/day7.nim)
- [x] Day 8: [Nim](./nim/day8.nim)
- [x] Day 9: [Nim](./nim/day9.nim)
- [x] Day 10: [Nim](./nim/day10.nim)
- [x] Day 11: [Nim](./nim/day11.nim)
- [x] Day 12: [Nim](./nim/day12.nim)
- [x] Day 13: [Nim](./nim/day13.nim)
- [x] Day 14: [Nim](./nim/day14.nim)
- [x] Day 15: [Nim](./nim/day15.nim)
2021-12-17 11:36:38 -06:00
- [x] Day 16: [Rust](./rust/day16.rs)
2021-12-20 15:16:39 -06:00
- [x] Day 17: [Rust](./rust/day17.rs)
- [x] Day 18: [Nim](./nim/day18.nim)
2021-12-22 12:19:21 -06:00
- [x] Day 19: [Nim](./nim/day19.nim)
- [x] Day 20: [Nim](./nim/day20.nim)
- [x] Day 21: [Nim](./nim/day21.nim)
2021-12-01 09:47:17 -06:00
- [ ] Day 22
- [ ] Day 23
- [ ] Day 24
- [ ] Day 25
2021-12-01 09:46:18 -06:00
2021-12-01 08:47:18 -06:00
[deno]: https://deno.land/
[ts]: https://deno.land/manual/typescript