Code Monkey home page Code Monkey logo

aoc2019's Introduction

AoC 2019

Here we go again, down another rabbit hole!

Using aoc-runner

Getting the input

To get the latest day's input, run

cargo aoc input

...or to get N's day input.

cargo aoc input -d N

Testing

A good way to solve the AoC puzzles would be to write the tests for your code first, before running your code on the actual inputs.

For example we'd write some tests for dayX like this

#[cfg(test)]
mod tests {
    use super::{part1_solver};

    #[test]
    fn dayX_part1() {
        assert_eq!(part1_solver("some test input"), "expected test output");
    }
}

Then we can run the tests by filtering on the function name

cargo test dayX

In this example, cargo test will run only those test functions which start with dayX in their names. Running cargo test without providing a filter will run all the tests in your codebase.

Running your code

Once you've tested your dayX relevant code, it's time to run your code, and get the final solutions.

To run the code for the latest puzzle

cargo aoc

To run the code for a specific day puzzle

cargo aoc -d X

Runing only part one or two can be achieved by calling

cargo aoc -p <1 or 2>

It can also be mixed and matched with the -d flag.

More info

More info about using cargo-aoc: https://github.com/gobanos/cargo-aoc

Desctructuring in rust

How to destructure in rust: https://pzol.github.io/getting_rusty/posts/20140417_destructuring_in_rust/

Though, there seems to be an issue with it: rust-lang/rust#62254

aoc2019's People

Watchers

James Cloos avatar Ivan Jukic 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.