Code Monkey home page Code Monkey logo

advent-of-code-2019's Introduction

Advent Of Code 2019: Tutorial Solutions in Rust

Copyright (c) 2019 Bart Massey

Herein lie Rust solutions to at least some of the problems of the 2019 Advent of Code. Advent of Code is a fantastic exercise, and I thank the author and others involved profusely for their excellent work. Thanks also to relsqui for pointing me at this back in 2015.

Previously

Organization

The solutions are in directories named day01 through day25. For each solution, I have included cleaned-up Rust code. There is a README.md in every problem directory containing algorithm descriptions, comments and usage instructions. I have also included the problem descriptions (part1.md and part2.md) and my specific input.txt for posterity.

The solutions load library code from the included libaoc crate. See its documentation for details.

Code Quality

There are no special system tests written for this code other than the ones provided as part of the problem --- there are occasional unit tests. I regard passing both parts of a day's problem as strong validation, although I've been wrong about this in the past. More tests should get written.

These programs are not production-quality: it is considered acceptable to panic on erroneous input.

Goals

The goals of these solutions are to:

  • Provide correct solutions with reasonable runtimes.

  • Illustrate reasonable solution strategies.

  • Illustrate the use of Rust in problem-solving.

As always I expect to learn some Rust and a little bit of software engineering I should already have known writing these.

Infrastructure

There's some engineering infrastructure here in the form of the template directory and the mkday.sh and process-aoc.sh shell scripts. These speed each day's setup considerably. At the beginning of each day I sh mkday.sh. (The day number is tracked automatically but can be overwritten on the command line.) At the end of the day I select and copy the page source of the day's AoC webpage and then

xclip -selection CLIPBOARD -out | sh ../process-aoc.sh

to get markdown into the problem files for posterity.

You can get times for all parts of all days with sh times.sh (will build before timing). This also verifies that everything runs. You can use sh clean.sh to run cargo clean in the day directories โ€” Rust target directories are huge. Use the -a flag to also clean in libaoc.

Misc

These solutions deserve a much more thorough top-level description than I usually have the energy to write. Apologies.


This work is licensed under the "MIT License". Please see the file LICENSE in the source distribution of this software for license terms.

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.