πŸŽ„ My solutions to Advent of Code 2022.

Overview

πŸŽ„ advent-of-code-2022

Overview

This repository contains my solutions to Advent of Code 2022.

I decided to take this year as an opportunity to learn Rust. My goal will be to write simple, readable, and idiomatic Rust code as much as I can. I will be restricting myself to the standard library and try to get familiar with it.

I will also try to add basic comments explaining my approach, as well as benchmark the code.

Note - This is my first time writing Rust programs. For many of my solutions there might be a better way, in terms of efficiency or writing Rust-y code.

Solutions

All common utility stuff is defined in the src/lib.rs file. Solutions for day XY are defined in the src/solvers/day_XY.rs file. Inputs for day XY are in the inputs/XY.txt and inputs/XY_test.txt (which is the sample input).

Note:

  • The solutions and tests been checked with Cargo & Rust v1.65.0.
  • The benchmarks been checked with Cargo & Rust v1.67.0-nightly.

Run

# Running all solutions
$ cargo run --release -- all
# Running a particular solution
$ cargo run --release -- run <day> [part] # day = XY, part = a / b (optional, runs both parts by default)

Test

Sample input for each day has been used to write unit tests.

# Testing all sample inputs
$ cargo test
# Testing sample input for particular day
$ cargo test XY

Benchmarks

Note: This requires features from the unstable release chain, which can be installed using -

$ rustup install nightly

Once nightly rust has been installed

# Running all benchmarks
$ cargo +nightly bench
# Running benchmarks for particular day
$ cargo +nightly bench XY

Stars obtained

16 / 50 ⭐

Other Advent of Code solutions

Year Repo Language
2021 advent-of-code-2021 Python
2022 advent-of-code-2022 (this repo) Rust

Acknowledgements

Thanks to Eric Wastl for creating and managing the Advent of Code project.

You might also like...
πŸŽ„ Advent of Code written in various languages. (2015-2022)

πŸŽ„ Advent of Code This repository contains my solutions to the Advent of Code puzzles. Every year, I will try to solve the puzzles in a different lang

Trying to solve Advent of Code 2022 in 25 different languages (1 day = 1 language)

Advent of Code 2022: 15/25 langs I’ll try to solve this Advent of Code using different language for each day. Any programs needed to run the code will

I will be attempting Advent of Code 2022 with Rust, a language I have never learned before.

Advent of Code 2022 This year, I will be attempting Advent of Code with Rust, a language I have never learned before. I will also be taking some notes

Advent of Code 2022 - my answers

Advent of Code 2022 my answers Development occurs in language-specific directories: Haskell Kotlin Python Rust Day1.hs Day1.kt day1.py day1.rs Day2.hs

Advent of Code 2022 - in Rust!

Advent of Code 2022 My solutions to problems in 2022 edition of Advent of Code, written in Rust. How to use this repo: The best way to see how solutio

Advent of Code 2021 puzzles & solutions in Rust

Advent of Code 2021 These are puzzles for the Advent of Code 2021 challenge, written and solved in the Rust programming language. The puzzle for each

Repository with my Advent of Code 2021 puzzle solutions πŸŽ„
Repository with my Advent of Code 2021 puzzle solutions πŸŽ„

πŸŽ„ Advent of Code 2021 πŸŽ„ I decided to stick with Rust this year and try to improve a bit on it, I basically haven't used it since last year's AoC, so

My solutions to Advent of Code 2021 (mostly in rust)

Advent of Code 2021 Small code to solve problems at https://adventofcode.com/2021. Most of the code are written in Rust. How to run solutions For exam

πŸŽ„My Advent of Code 2021 solutions in the Rust programming language

Advent of Code 2021 in Rust My Advent of Code 2021 solutions in the Rust programming language. This repository holds a separate Rust project for each

Owner
Vighnesh Shenoy
Always learning.
Vighnesh Shenoy
Advent of Code 2022 Solutions (in Rust)

Advent of Code 2022 My solutions for Advent of Code 2022, written in Rust. This repository provides a good template for anyone interested in writing t

Sam Mohr 3 Dec 2, 2022
My solutions for Advent of Code 2022, written in Rust

Template largely copied from RikvanToor/aoc-rust-template, upgraded for clap v4. This template can be forked/cloned from beeb/aoc-rust. Usage First, f

Valentin Bersier 2 Dec 15, 2022
πŸ¦€ Rust solutions for Advent of Code 2022

?? Advent of Code 2022 Solutions for Advent of Code in Rust. 2022 Results Day Part 1 Part 2 Day 1 ⭐ ⭐ Day 2 ⭐ ⭐ Day 3 ⭐ ⭐ Day 4 ⭐ ⭐ Day 5 ⭐ ⭐ Day 6 ⭐

Felix SpΓΆttel 10 Dec 28, 2022
Solutions to Advent of Code 2022 in Rust Β πŸ¦€

AdventOfCode2022 ?? Solutions to AoC 2022 in Rust ?? Usage cargo run --release --bin DAY # run a specific day cargo run --release # run all

Axel Lindeberg 32 Jan 5, 2023
Here are my Advent of Code solutions for 2022.

advent-of-code-2022 This repository contains my Advent of Code solutions for 2022. I am doing them in Ruby, Crystal, and Rust, and as I release each d

Kirk Haines 4 Dec 31, 2022
πŸŽ„ My Advent of Code solutions in Rust. http://adventofcode.com/2022

Advent of Code 2022 in Rust My Advent of Code 2022 solutions in the Rust programming language. This repository holds a separate Rust project for each

Tim VisΓ©e 98 Jan 4, 2023
My Advent of Code 2022 solutions, in Rust.

AoC 2022 My solutions for the 2022 edition of Advent of Code in Rust. Simply run cargo run --release --bin dayXX to solve. Some days require z3, insta

Orson Peters 6 Jan 26, 2023
Advent of Code 2022 (Rust)

Advent of Code 2022 ?? | -+- A /=\ /\ /\ ___ _ __ _ __ __ __ i/ O \i / \/

Dominik Harmim 2 Dec 15, 2022
Advent of Code 2022 in Rust πŸ¦€

Advent of Code 2022 in Rust ??

Philippe Bouamriou 3 Dec 2, 2022
My try at Advent of Code 2022 in Rust.

Advent of Code 2022 My solutions to Advent of Code 2022, written in Rust. I love seeing the variety of solution other people come up with, so I decide

Luke Taylor 6 Dec 15, 2022