Commit Graph

641 Commits

Author SHA1 Message Date
ba1b7b693e Use reusable parser wrapper more 2021-12-18 14:54:05 +01:00
7d331f9131 Implement day 18 2021 2021-12-18 14:46:27 +01:00
dfd8b2b985 Partially smart, partially brute-force day 17 2021-12-17 10:04:36 +01:00
0f6167e90f Merge common parts of parsers 2021-12-16 19:26:10 +01:00
3e2a3f5206 Avoid allocating and tracking bits manually 2021-12-16 19:12:34 +01:00
8cc2245492 Optimize hex parser 2021-12-16 18:46:19 +01:00
fb167ef899 Implementation day 16
Not clean but it works.
2021-12-16 09:55:53 +01:00
4240f8fc8c Avoid queueing worse routes 2021-12-15 18:40:20 +01:00
9a4ac427e0 Use Dijkstra instead of A*
The available distance heuristic doesn't save enough steps to offset its
overhead.
2021-12-15 18:29:08 +01:00
c3929a56d8 Slow implementation for day 15 2021-12-15 07:54:14 +01:00
9e37026f30 Remove unnecessary indexing 2021-12-14 19:54:45 +01:00
a926243f0d Improve "winning" logic
You don't need to check every possible win condition, just the one you
touched.
2021-12-14 19:51:57 +01:00
a35ae82548 Replace unnecessary HashMap and allocations 2021-12-14 19:39:00 +01:00
8a0b72f111 Implementation day 14 2021 2021-12-14 09:25:38 +01:00
b5866b2d8a Modify points in-place
Thanks to skius from libera##rust for the idea
2021-12-13 22:55:14 +01:00
554683bc64 Actually apply nom 2021-12-13 22:20:02 +01:00
1031a8cdbb Avoid allocating the final buffer twice 2021-12-13 21:40:00 +01:00
5c764f6627 Don't use silly hashsets 2021-12-13 21:34:48 +01:00
ffe8d27469 Clean up day 13 a little. 2021-12-13 08:52:57 +01:00
d471f170b3 Very dirty solution day 13 2021-12-13 08:50:00 +01:00
07cbf6cf53 Fix upcoming clippy warning 2021-12-12 15:56:05 +01:00
6e3252ce5a Add formal benchmarking code 2021-12-12 15:33:52 +01:00
0897e2e907 Implement day 12 part 2 2021-12-12 11:31:54 +01:00
4d1fdd9cc0 Implement day 12 part 1 2021-12-12 11:09:14 +01:00
84c160cf54 Simplify part 2 2021-12-11 17:20:22 +01:00
440d454911 Implement day 11 2021-12-11 13:56:10 +01:00
50cd6d8171 Implementation day 10 2021 2021-12-10 10:46:02 +01:00
dde9c0adbf Update to RC version of clap
Deriving a parser has become an opt-in feature so we need to enable
that.
2021-12-09 12:14:15 +01:00
e0e1bc26e8 Simplify implementation day 8
The second part doesn't actually need to start the search at the low
points; just iterating everything and keeping track of visited spaces is
enough.

Now that the iterator is only used in part 1, we inline the iterator to
remove some overhead from the code.
2021-12-09 12:02:07 +01:00
77ce31980b Implement day 9 2021-12-09 11:56:29 +01:00
8c78106846 Bit-optimize day 8
The state of a seven segment display can be stored in a byte after all.
Using NonZeroU8 makes the Options smaller too.
2021-12-08 13:52:08 +01:00
22f767e8df Implement day 08 2021 2021-12-08 13:31:33 +01:00
3434966ac2 Just use the median, obviously 2021-12-07 13:22:43 +01:00
c5f66fcc09 Avoid more allocations in day 7 part 1 2021-12-07 11:41:19 +01:00
c02f1e11c5 Convert recursion to iteration 2021-12-07 11:00:26 +01:00
d099614217 Improve part 2 with binary search 2021-12-07 10:40:34 +01:00
766ee91719 Brute-force day 7 part 2 2021-12-07 10:12:01 +01:00
2f3eb50a5b Implement day 7 part 1 2021-12-07 09:45:58 +01:00
b369f9d36a Implement day 6 2021 2021-12-06 09:21:00 +01:00
1433b0cdbe Implement day 5
Nom is really nice and fast, why did I write parsers manually before.
2021-12-05 11:31:14 +01:00
5e52da6e6b Use iterator instead of range 2021-12-04 11:57:01 +01:00
e50b812aed Day 4: more efficiently ignore completed cards 2021-12-04 11:40:40 +01:00
fdef10a78e Less awkward line length hack 2021-12-04 11:28:32 +01:00
392aefb32d Less allocations in day 3 part 2
By working with binary numbers as integers rather than byte strings, we
don't need to allocate a Vec for each of them, reducing us to just the
allocations in the outer Vec.
2021-12-04 11:13:54 +01:00
fb358be8f0 Implementation day 4 2021 2021-12-04 10:43:02 +01:00
612d3ecb6b Tricky solution day 03, could possibly be improved 2021-12-03 09:21:13 +01:00
d08a4e0e4e Merge day 1 solutions 2021-12-02 18:50:26 +01:00
ed844a997c Create reusable line reader 2021-12-02 18:27:48 +01:00
c9468ba139 Implementation 2021 day 2 2021-12-02 08:21:49 +01:00
938eda0d22 Rework day 1
Simplify part 2 a lot, by not actually computing the sums because they
do not matter, only the changes do. Also eliminate the allocation
overhead while parsing line-by-line input.

Fixes the existing clippy error because the offending line no longer
exists.
2021-12-01 20:35:27 +01:00