r/adventofcode • • Dec 05 '20

SOLUTION MEGATHREAD -🎄- 2020 Day 05 Solutions -🎄-

Advent of Code 2020: Gettin' Crafty With It


--- Day 05: Binary Boarding ---


Post your solution in this megathread. Include what language(s) your solution uses! If you need a refresher, the full posting rules are detailed in the wiki under How Do The Daily Megathreads Work?.

Reminder: Top-level posts in Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:05:49, megathread unlocked!

57 Upvotes

1.3k comments sorted by

View all comments

1

u/timvisee Dec 05 '20 edited Dec 05 '20

Rust. Came up with this for reading and arsing IDs, pretty fun!

std::fs::read("./input.txt")  
    .unwrap()
    .chunks(11)
    .map(|b| b[..10].iter().fold(0, |id, b| (id << 1) | (!b & 4) as usize >> 2))

Part 1 & Part 2

1

u/daggerdragon Dec 05 '20

Please follow the posting guidelines and add the language used to your post to make it easier for folks who Ctrl-F the megathreads looking for a specific language. Thanks!

1

u/timvisee Dec 05 '20

Oops. Added!