<feed xmlns='http://www.w3.org/2005/Atom'>
<title>adventofcode-2022, branch main</title>
<subtitle>Advent of Code 2022</subtitle>
<link rel='alternate' type='text/html' href='https://spragg-ssl.co.uk/projects/cgit.cgi/adventofcode-2022/'/>
<entry>
<title>Puzzle 19: Separate "exhaustive" and "exhaustive w/ shortcuts" builds</title>
<updated>2023-01-30T19:07:53+00:00</updated>
<author>
<name>Adam Spragg</name>
<email>adam@spra.gg</email>
</author>
<published>2023-01-29T16:30:46+00:00</published>
<link rel='alternate' type='text/html' href='https://spragg-ssl.co.uk/projects/cgit.cgi/adventofcode-2022/commit/?id=2e85da91bb8ff59faa74213d9b2428abacb8dcc9'/>
<id>2e85da91bb8ff59faa74213d9b2428abacb8dcc9</id>
<content type='text'>
Allows playing with the shortcuts more easily, while keeping a strictly
exhaustive strategy around for comparison.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Allows playing with the shortcuts more easily, while keeping a strictly
exhaustive strategy around for comparison.
</pre>
</div>
</content>
</entry>
<entry>
<title>Puzzle 19: Add maximum-geode-building shortcut</title>
<updated>2023-01-30T19:07:53+00:00</updated>
<author>
<name>Adam Spragg</name>
<email>adam@spra.gg</email>
</author>
<published>2023-01-29T16:14:31+00:00</published>
<link rel='alternate' type='text/html' href='https://spragg-ssl.co.uk/projects/cgit.cgi/adventofcode-2022/commit/?id=d3e37c83f8ba0df7a8240031ad5fa55a761f362c'/>
<id>d3e37c83f8ba0df7a8240031ad5fa55a761f362c</id>
<content type='text'>
If we have enough robots to collect enough materials every turn to build
a new geode robot every turn, and enough materials to build a geode
robot this turn, it's trivial to calculate how many geodes it's possible
to collect in the remaining time.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we have enough robots to collect enough materials every turn to build
a new geode robot every turn, and enough materials to build a geode
robot this turn, it's trivial to calculate how many geodes it's possible
to collect in the remaining time.
</pre>
</div>
</content>
</entry>
<entry>
<title>Puzzle 19: Make geode product an unsigned long.</title>
<updated>2023-01-30T19:07:53+00:00</updated>
<author>
<name>Adam Spragg</name>
<email>adam@spra.gg</email>
</author>
<published>2023-01-29T16:19:35+00:00</published>
<link rel='alternate' type='text/html' href='https://spragg-ssl.co.uk/projects/cgit.cgi/adventofcode-2022/commit/?id=5c8e1d84d998449bb590bce60566594e1c7012da'/>
<id>5c8e1d84d998449bb590bce60566594e1c7012da</id>
<content type='text'>
Because it can never be negative, and some of the blueprint combinations
can cause it to wrap. This gives us one more factor of two breathing
room.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Because it can never be negative, and some of the blueprint combinations
can cause it to wrap. This gives us one more factor of two breathing
room.
</pre>
</div>
</content>
</entry>
<entry>
<title>Puzzle 19: Add option for debug output</title>
<updated>2023-01-30T19:07:53+00:00</updated>
<author>
<name>Adam Spragg</name>
<email>adam@spra.gg</email>
</author>
<published>2023-01-29T16:03:37+00:00</published>
<link rel='alternate' type='text/html' href='https://spragg-ssl.co.uk/projects/cgit.cgi/adventofcode-2022/commit/?id=b43bdf75540c9daab5c94317bf910d0eba3755ab'/>
<id>b43bdf75540c9daab5c94317bf910d0eba3755ab</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Puzzle 19: Don't build a robot if we could have built it earlier</title>
<updated>2023-01-19T14:16:54+00:00</updated>
<author>
<name>Adam Spragg</name>
<email>adam@spra.gg</email>
</author>
<published>2023-01-19T14:16:54+00:00</published>
<link rel='alternate' type='text/html' href='https://spragg-ssl.co.uk/projects/cgit.cgi/adventofcode-2022/commit/?id=0fcf120446f29f4715a422744ad70eb06247c500'/>
<id>0fcf120446f29f4715a422744ad70eb06247c500</id>
<content type='text'>
Either we don't need it, or we did but it's too late.

Speeds up part 2 from 570s (9m30s) to 5.2s
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Either we don't need it, or we did but it's too late.

Speeds up part 2 from 570s (9m30s) to 5.2s
</pre>
</div>
</content>
</entry>
<entry>
<title>Puzzle 20: Do a linear scan for the num we're looking for</title>
<updated>2023-01-19T13:56:59+00:00</updated>
<author>
<name>Adam Spragg</name>
<email>adam@spra.gg</email>
</author>
<published>2023-01-19T13:56:59+00:00</published>
<link rel='alternate' type='text/html' href='https://spragg-ssl.co.uk/projects/cgit.cgi/adventofcode-2022/commit/?id=816b7d55d6d3dfb31904cb5d4813fb500984ab5b'/>
<id>816b7d55d6d3dfb31904cb5d4813fb500984ab5b</id>
<content type='text'>
When the number of iterations was small, looking near the original
position of the num was a good idea. As the number of iterations
increases, the positions are fairly random, so speed of lookup is mostly
a factor of how quickly we can scan the whole buffer.

Speeds up part 2 of the problem from 2.2s to 0.12s.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the number of iterations was small, looking near the original
position of the num was a good idea. As the number of iterations
increases, the positions are fairly random, so speed of lookup is mostly
a factor of how quickly we can scan the whole buffer.

Speeds up part 2 of the problem from 2.2s to 0.12s.
</pre>
</div>
</content>
</entry>
<entry>
<title>Puzzle 16: Solve part 2 fully</title>
<updated>2023-01-18T14:42:49+00:00</updated>
<author>
<name>Adam Spragg</name>
<email>adam@spra.gg</email>
</author>
<published>2023-01-18T14:42:49+00:00</published>
<link rel='alternate' type='text/html' href='https://spragg-ssl.co.uk/projects/cgit.cgi/adventofcode-2022/commit/?id=8f0114df375c7b9bd750e3e0e6fbecb964639d3d'/>
<id>8f0114df375c7b9bd750e3e0e6fbecb964639d3d</id>
<content type='text'>
We now manage the general case of dividing up the work between as many
plumbers as available, as equally as possible. Works for the test case
and the full input case.

(Actually, it seems to speed up the full input case, from around 68s to
55s!)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We now manage the general case of dividing up the work between as many
plumbers as available, as equally as possible. Works for the test case
and the full input case.

(Actually, it seems to speed up the full input case, from around 68s to
55s!)
</pre>
</div>
</content>
</entry>
<entry>
<title>Puzzle 16: Extract function to find the flow of a given path</title>
<updated>2023-01-18T14:24:18+00:00</updated>
<author>
<name>Adam Spragg</name>
<email>adam@spra.gg</email>
</author>
<published>2023-01-18T14:24:18+00:00</published>
<link rel='alternate' type='text/html' href='https://spragg-ssl.co.uk/projects/cgit.cgi/adventofcode-2022/commit/?id=883b750205525295ba14b368dc92d6485c4176cb'/>
<id>883b750205525295ba14b368dc92d6485c4176cb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Puzzle 16: Improve debug output</title>
<updated>2023-01-18T14:16:15+00:00</updated>
<author>
<name>Adam Spragg</name>
<email>adam@spra.gg</email>
</author>
<published>2023-01-18T14:16:15+00:00</published>
<link rel='alternate' type='text/html' href='https://spragg-ssl.co.uk/projects/cgit.cgi/adventofcode-2022/commit/?id=25479a6ba2eee01639937ba63fba683bfee5a977'/>
<id>25479a6ba2eee01639937ba63fba683bfee5a977</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Puzzle 16: Speed up the permute skipping code</title>
<updated>2023-01-17T16:32:24+00:00</updated>
<author>
<name>Adam Spragg</name>
<email>adam@spra.gg</email>
</author>
<published>2023-01-17T14:58:52+00:00</published>
<link rel='alternate' type='text/html' href='https://spragg-ssl.co.uk/projects/cgit.cgi/adventofcode-2022/commit/?id=69a900c9b0e720c791f3d3deb28fc8de17f8cc8c'/>
<id>69a900c9b0e720c791f3d3deb28fc8de17f8cc8c</id>
<content type='text'>
By realising that the first time we hit the need to skip, the items to
be skipped will be in sorted order; to change them to reverse-sorted
order just requires reversing the items, not re-sorting them backwards.

(On part 1 of the puzzle with a 40 minute limit, the timing goes from
6.6s to 4.3s, average of 5 runs.)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
By realising that the first time we hit the need to skip, the items to
be skipped will be in sorted order; to change them to reverse-sorted
order just requires reversing the items, not re-sorting them backwards.

(On part 1 of the puzzle with a 40 minute limit, the timing goes from
6.6s to 4.3s, average of 5 runs.)
</pre>
</div>
</content>
</entry>
</feed>
