Giter VIP home page Giter VIP logo

advent-of-code-rust's Introduction

Advent Of Code in Rust

rust

My rust solutions to Advent of Code puzzles.

This project uses aoc-runner and cargo-aoc

Running Solutions

cargo-aoc does not support workspaces and multi-year projects, so you have to run them as binaries.

cargo build
cargo run --bin aoc2021

To run a release version add --release to the above arguments

To run tests:

cargo test

New days

cargo-aoc can be used to get your input data, you need to set your aoc web session id with

cargo aoc credentials -s {token}  # get this from Application tab in chrome tools for aoc website

then you can just run

cargo aoc input [ -d {day} -y {year} ] # defaults to today's date
cargo aoc input -d 4 -y 2021

Generators

To parse the input quickly, use #[aoc_generator(dayX}] and implement a function that will convert the data input file to types required. e.g. for day 01, a list of strings that need to be converted to integers:

#[aoc_generator(day1)]
pub fn input_generator(input: &str) -> Vec<u32> {
    common::input_vec(input)
}

Other examples are in the cargo_aoc docs and in the worked solutions, e.g. src/day_03.rs


advent-of-code-rust's People

Contributors

markjfisher avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.