Code Monkey home page Code Monkey logo

aoc's Introduction

My Rust solutions for Advent of Code.

I started doing these in 2022 to learn Rust, decided afterwards to go back and try to do all of them all the way back from 2015.

The solutions are organized in workspaces, one workspace per year.

To run a solution and see its answers, go to a solution's folder and:

~/aoc/2015/day01_not_quite_lisp ❯ RUST_LOG=info cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `/home/anfa/aoc/target/debug/day01_not_quite_lisp`
[2023-08-07T18:57:09Z INFO  day01_not_quite_lisp] Part 1 answer: 138
[2023-08-07T18:57:09Z INFO  day01_not_quite_lisp] Part 2 answer: 1771

Some solutions have debug printouts, you can see those by changing the RUST_LOG flag:

~/aoc/2015/day01_not_quite_lisp ❯ RUST_LOG=debug cargo run

To check if a solution passes the tests:

~/aoc/2015/day01_not_quite_lisp ❯ cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.02s
     Running unittests src/main.rs (/home/anfa/aoc/target/debug/deps/day01_not_quite_lisp-462e43bd5ba4d516)

running 3 tests
test tests::part1_tests ... ok
test tests::part2_tests ... ok
test tests::check_answers ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Or, from the root folder:

~/aoc ❯ cargo test --bin day01_not_quite_lisp
    Finished test [unoptimized + debuginfo] target(s) in 0.02s
     Running unittests src/main.rs (/home/anfa/aoc/target/debug/deps/day01_not_quite_lisp-462e43bd5ba4d516)

running 3 tests
test tests::part1_tests ... ok
test tests::part2_tests ... ok
test tests::check_answers ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

When I start working on a new puzzle I generate a new project based on the template project using cargo generate. Like this:

~/aoc/2016 ❯ cargo generate -p ../template --name dayXX_new_puzzle --force

I try to write a README in each solution, describing what I have learned and my thoughts on the particular problem. Take that stuff with a grain of salt, I am still learning so I am bound to make mistakes.

aoc's People

Contributors

daedrus avatar

Stargazers

 avatar

Watchers

 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.