Code Monkey home page Code Monkey logo

aoc2022-rust's Introduction

Advent of Code 2022 in Rust

If you've never heard of Advent of Code, you're missing out. Check it out now at adventofcode.com!

I mostly do AoC puzzles for fun, generally coding in Python, but I've also found that it's a great way to get some experience with other programming languages, such as Julia or Rust.

This repository contains all my solutions to the AoC 2022 puzzles using Rust.

As I'm still learning Rust, the code may not always be as simple or idiomatic as it could be. If you have suggestions for things I could improve, please don't hesitate to file an issue or submit a PR. Thanks!

Usage

Make sure you have Rust and Git installed, then open a terminal and run:

git clone https://github.com/ageron/aoc2022-rust
cd aoc2022-rust
cargo run --release

On my MacBook, this runs in about 1.7 seconds.

You can specify days to run if you want, for example this will run days 2, 4, and 6:

cargo run --release 2 4 6

Getting the data

I've also included a little get_data.py utility to automatically download the data of the day, at the right time (you'll get a countdown if you're early). I was too lazy to code it in Rust, but perhaps I'll port it one day. To use it, just type the following command in a terminal, replacing {day} with the day you want:

cd /path/to/this/repository
python get_data.py 2022 {day}

The script requires the requests and pytz libraries, which you can install like this:

python -m pip install --user requests pytz

The first time you run get_data.py, you will be asked to login to AoC in your browser, find your session cookie, and save it into a .session file in the current directory.

Have fun!

aoc2022-rust's People

Contributors

ageron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.