<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Rust on SCMB XYZ</title>
    <link>https://www.scmb.xyz/tags/rust/</link>
    <description>Recent content in Rust on SCMB XYZ</description>
    <generator>Hugo</generator>
    <language>en-gb</language>
    <copyright>&amp;copy; Seamus Bradley 2021–6</copyright>
    <lastBuildDate>Sat, 05 Jul 2025 21:33:27 +0100</lastBuildDate>
    <atom:link href="https://www.scmb.xyz/tags/rust/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Advent of Slowed Update</title>
      <link>https://www.scmb.xyz/post/advent-of-slowed-15-16-17/</link>
      <pubDate>Sat, 05 Jul 2025 21:33:27 +0100</pubDate>
      <guid>https://www.scmb.xyz/post/advent-of-slowed-15-16-17/</guid>
      <description>&lt;p&gt;I finished Parts 1 and 2 of Day 15, and I&amp;rsquo;ve managed parts 1 of Days 16 and 17.&#xA;For each of the unfinished part 2s, I know roughly what I solution should involve,&#xA;but I&amp;rsquo;m struggling to get there.&#xA;The goal of this exercise has always been to learn more about rust and to get some practice using it.&#xA;I have definitely done that: &lt;a href=&#34;https://codeberg.org/scmbradley/AdventOfCode/src/branch/main/rust/src/aoc_2024/aoc_2024_15.rs&#34;&gt;day 15&lt;/a&gt;,&#xA;in particular, involved writing two &lt;code&gt;impl&lt;/code&gt;s of a trait I created,&#xA;one for each part.&#xA;Thinking about what should be in the &lt;code&gt;impl&lt;/code&gt;s for the structs, and what should be in the trait,&#xA;as well as what I can provide default implementations for, was a really interesting exercise.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Advent of Slowed Days 13 and 14</title>
      <link>https://www.scmb.xyz/post/advent-of-slowed-13-14/</link>
      <pubDate>Thu, 08 May 2025 23:04:18 +0100</pubDate>
      <guid>https://www.scmb.xyz/post/advent-of-slowed-13-14/</guid>
      <description>&lt;p&gt;My deadline for finishing Day 14 of last year&amp;rsquo;s advent of code is the 20th,&#xA;but I have, in fact, already finished it.&#xA;I am not just scraping by now, I am smashing these deadlines.&#xA;This probably has more to do with nobody in my household being poorly this week&#xA;rather than any other factors.&#xA;In fact, between finishing Day 13 and starting Day 14, I even had some time to go back and&#xA;look at making some efficiency improvements to some slow tests.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Advent of Slowed Days 11, 12, and some refactoring</title>
      <link>https://www.scmb.xyz/post/advent-of-slowed-11-12/</link>
      <pubDate>Fri, 25 Apr 2025 13:37:47 +0100</pubDate>
      <guid>https://www.scmb.xyz/post/advent-of-slowed-11-12/</guid>
      <description>&lt;p&gt;So we&amp;rsquo;re nearing the end of April and I&amp;rsquo;m still (more or less) on schedule given the&#xA;&lt;a href=&#34;https://www.scmb.xyz/post/advent-of-slowed-dates/&#34;&gt;targets I set myself&lt;/a&gt;&#xA;at the start of the year.&#xA;In fact, I finished Day 11 before the deadline and so I took a little time to revisit&#xA;Day 5 Part 2, and a few other bits of refactoring.&lt;/p&gt;&#xA;&lt;h1 id=&#34;day-11&#34;&gt;Day 11&lt;/h1&gt;&#xA;&lt;p&gt;This was a pretty easy puzzle, and one that took the classic AoC form of&#xA;&amp;ldquo;Part 1: do this for n; Part 2: OK now do it for a bigger n&amp;rdquo;.&#xA;The obvious solution for Part 1 takes way way way too long to run for Part 2.&#xA;Essentially each step involves doing something to each element of a list.&#xA;That something returns 0, 1 or 2 new items for the next iteration.&#xA;So the size of the list can double each iteration if you put back in 2 elements each time.&#xA;Doing this for 25 iterations is kind of manageable, you get a list of up 33 million-ish items for each starting item.&#xA;(It&amp;rsquo;s actually less because you don&amp;rsquo;t always put 2 elements in the next list, but as a worst case estimate, this is ok).&#xA;Part 2 is to do the same thing for 75 iterations which puts you up in the sextillions of items.&#xA;The trick for Part 2 was to realise that order doesn&amp;rsquo;t matter, and all we ultimately care about is the final total number of items.&#xA;So if there are duplicate numbers in your list, you can just do the calculation once and keep track of the number of duplicates.&#xA;That means, instead of keeping track of a big list of items, you keep track of a smaller list of (item, repeats) pairs.&#xA;My implementation meant re-sorting and re-grouping the list every iteration, but I&amp;rsquo;m sure there&amp;rsquo;s an even more efficient way of doing it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Advent of Slowed Days 8, 9 and 10</title>
      <link>https://www.scmb.xyz/post/advent-of-slowed-8-9-10/</link>
      <pubDate>Thu, 03 Apr 2025 22:02:03 +0100</pubDate>
      <guid>https://www.scmb.xyz/post/advent-of-slowed-8-9-10/</guid>
      <description>&lt;p&gt;More advent of coding!&#xA;These last three days have been interesting,&#xA;and the main reason it&amp;rsquo;s taken so long to solve them&#xA;is finding time to do them.&lt;/p&gt;&#xA;&lt;h1 id=&#34;day-8&#34;&gt;Day 8&lt;/h1&gt;&#xA;&lt;p&gt;Another day, another input that is interpreted as a map.&#xA;I once again used the &lt;code&gt;coords&lt;/code&gt; module I wrote for an earlier day.&#xA;The story is that there are some antennas and you need to find&#xA;spots where the antennas resonate with each other.&#xA;What that amounts to is using a bit of vector arithmetic on the&#xA;coordinates of the antennas.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Advent of Slowed Days 5, 6 and 7</title>
      <link>https://www.scmb.xyz/post/advent-of-slowed-5-6-7/</link>
      <pubDate>Mon, 10 Mar 2025 15:27:38 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/advent-of-slowed-5-6-7/</guid>
      <description>&lt;p&gt;I am, once again, very behind schedule with my &lt;a href=&#34;https://www.scmb.xyz/post/advent-of-slowed-dates/&#34;&gt;Advent of Slowed&lt;/a&gt; adventure.&#xA;This is due to a combination of being busy at work, getting sick, my kids getting sick,&#xA;and Day 5, Part 2 being annoying (I think one of my commit messages was literally &amp;ldquo;Part 2 can go to hell&amp;rdquo;).&#xA;We are now somewhat back on track and I hope to catch up in the next week or two.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Advent of Slowed Days 3 and 4</title>
      <link>https://www.scmb.xyz/post/advent-of-slowed-3-4/</link>
      <pubDate>Mon, 20 Jan 2025 16:22:10 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/advent-of-slowed-3-4/</guid>
      <description>&lt;p&gt;And here we are, back on track.&#xA;After getting myself extremely behind schedule (already!) by trying to be too clever on Day 2,&#xA;I&amp;rsquo;ve breezed through Days 3 and 4.&#xA;These two days also demonstrate two Advent of Code classic solution types.&#xA;Day 3 is a &amp;ldquo;make the calculation trivial by doing all the work in the parser&amp;rdquo; solution,&#xA;and Day 4 is a &amp;ldquo;parse the input into some kind of grid, then query the grid&amp;rdquo;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Advent of Slowed Days 1 and 2</title>
      <link>https://www.scmb.xyz/post/advent-of-slowed-days-1-2/</link>
      <pubDate>Thu, 16 Jan 2025 09:26:24 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/advent-of-slowed-days-1-2/</guid>
      <description>&lt;p&gt;As I said in &lt;a href=&#34;https://www.scmb.xyz/post/advent-of-slowed-dates/&#34;&gt;my first Advent of Slowed post&lt;/a&gt;,&#xA;I started as I mean to carry on:&#xA;blowing through the deadlines I set myself.&#xA;According to the timeline I originally envisaged,&#xA;I should have finished Day 2 of last year&amp;rsquo;s Advent of Code on the 8th and&#xA;Day 3 on the 14th.&#xA;Well, late last night, on the 15th, I finally finished Day 2.&#xA;In my defense, most of the time I get to work on these problems is late in the evening with&#xA;a baby asleep on me.&#xA;I&amp;rsquo;m tired and distracted, and how much I get done depends on how deeply asleep he is.&#xA;I&amp;rsquo;m also doing these puzzles in Rust, a language I only started learning last year.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Advent of Slowed: Dates and Yak Shaving</title>
      <link>https://www.scmb.xyz/post/advent-of-slowed-dates/</link>
      <pubDate>Sat, 04 Jan 2025 22:13:27 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/advent-of-slowed-dates/</guid>
      <description>&lt;p&gt;As I mentioned in my &lt;a href=&#34;https://www.scmb.xyz/post/december-adventure-2024/&#34;&gt;December Adventure&lt;/a&gt; post,&#xA;I am planning to solve last year&amp;rsquo;s &lt;a href=&#34;https://adventofcode.com/&#34;&gt;Advent of Code&lt;/a&gt;,&#xA;but I&amp;rsquo;m going to take my time about it.&lt;/p&gt;&#xA;&lt;p&gt;I toyed with a couple of different ways of generating deadlines&#xA;for the puzzles.&#xA;I settled on the list of deadlines listed as &amp;ldquo;pow 1.5 (totals)&amp;rdquo; in the&#xA;&lt;a href=&#34;https://codeberg.org/scmbradley/AdventOfCode/src/branch/main/dates_calc.py&#34;&gt;code I used to experiment with dates&lt;/a&gt;.&#xA;As you might have noticed, I&amp;rsquo;ve already failed to meet the first deadline,&#xA;which, to be fair, is starting how I mean to go on.&#xA;I did actually finish day 1 this evening (only a day late)&#xA;but the write up will have to wait until tomorrow or Monday.&lt;/p&gt;</description>
    </item>
    <item>
      <title>December Adventure 2024</title>
      <link>https://www.scmb.xyz/post/december-adventure-2024/</link>
      <pubDate>Sun, 01 Dec 2024 20:49:23 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/december-adventure-2024/</guid>
      <description>&lt;p&gt;While I have enjoyed doing (the first week or two of) Advent of Code the last few years,&#xA;I think I&amp;rsquo;m going to not do it this year.&#xA;I currently have my one-month old son asleep on me, and this is simply not an environment&#xA;that&amp;rsquo;s conducive to that kind of problem-solving.&#xA;I think, instead, I will participate in &lt;a href=&#34;https://eli.li/december-adventure&#34;&gt;December Adventure&lt;/a&gt;&#xA;which seems like a much gentler way of having some community and bit of a push to do a bit of coding&#xA;this month.&#xA;I have a few plans for what I will work on, but I am deliberately not specifying them up front in case&#xA;I don&amp;rsquo;t actually decide to work on them this month.&#xA;This post will record what I got up to on each day, so I&amp;rsquo;ll be editing it throughout the month.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
