Blog Posts

I try to post new content every week. The search bar above can help you find what you’re looking for.

You may also find the following links useful:
20262025Tags

Advent of Code 2025: Preparations
Advent of Code 2025: Preparations

Advent of Code 2025 is almost here, and this year I am aiming squarely at speed and optimisation across all 12 puzzles using Python and UV. I will publish a short post every day covering the approach and performance choices, and you are very welcome to join in using whichever language you want to …

Sudoku Series: Implementing Wing Rules
Sudoku Series: Implementing Wing Rules

The next rules to implement for the Sudoku solver are called wing rules. There are a few of these rules used in solving Sudoku, but some are hard to identify and are for very advanced solves. The two needed to solve most Sudoku puzzles are called XY-Wing and XYZ-Wing:

  • XY-Wing uses a pivot cell with …

Do Not Goto Fail
Do Not Goto Fail

Style guides are not bikeshedding; they are seatbelts that stop simple edits turning into catastrophic bugs. The infamous #gotofail incident shows how a tiny deviation from a basic rule like “always use braces” can undermine critical security checks, and how automated style enforcement …

Advent of Code 2024 Ruby Solutions: Day 7
Advent of Code 2024 Ruby Solutions: Day 7

Day 7 of Advent of Code 2024 boils down to testing all left-to-right operator choices between fixed numbers and summing the targets that are achievable, and a compact base-k iterator in Ruby keeps both parts small, clear, and fast. You can browse the rest of this series under Advent of Code. The …

Controlling flow with conditional edges in LangGraph
Controlling flow with conditional edges in LangGraph

Conditional edges let your LangGraph apps make decisions mid-flow, so today we will branch our simple joke generator to pick a pun or a one-liner while keeping wrap_presentation exactly as it was. In the previous post we built a two-node graph with joke_writer and wrap_presentation, and now we will …

A Primer in LangGraph
A Primer in LangGraph

LangGraph makes it easy to wire simple, reliable LLM workflows as graphs, and in this post we will build a tiny two‑node graph that turns a topic into a joke and then formats it as a mini conversation ready to display or send. By the end, you will have a minimal Python project with a typed JokeState …

Advent of Code 2024 Ruby Solutions: Day 6
Advent of Code 2024 Ruby Solutions: Day 6

First I’d like to apologise that this is the second week in a row that I’ve covering Advent of Code. I’ve not had as much time to write this week as I’d like to. I will try to get something more substantial out in the following weeks.

Day 6 of Advent of Code 2024 turned out …

Advent of Code 2024 Ruby Solutions: Day 5
Advent of Code 2024 Ruby Solutions: Day 5

Day 5 of Advent of Code 2024 is all about enforcing page ordering rules and pulling the “middle” value out at the right time, and my Ruby solution keeps it tidy with a small helper, a simple validator, and a lightweight reordering trick for the second half. If you want to browse …

Sudoku Series: Implementing the Fish Rules
Sudoku Series: Implementing the Fish Rules

The next rules to implement for the Sudoku solver are called the fish rules. There are three versions of these rules but they all share the same principles:

  • X-Wing works with a 2x2 fish pattern.
  • Swordfish works with a 3x3 fish pattern.
  • Jellyfish works with a 4x4 fish pattern.

If you like this post …

Advent of Code 2024 Ruby Solutions: Day 4
Advent of Code 2024 Ruby Solutions: Day 4

Day 4 of Advent of Code 2024 turns a simple word search into a neat grid‑traversal exercise, and my Ruby solution keeps it readable, fast, and precise. This post explains the requirements for both parts, then walks through how the code solves them, including how diagonals and boundaries are handled. …

Sudoku Series: Implementing the Locked Candidates Rule
Sudoku Series: Implementing the Locked Candidates Rule

Up until now in the Sudoku Series we’ve implemented a number of rules for Sudoku solving. I had been trying to remember the name of an old iPhone Sudoku app I used to enjoy. The reason I wanted to find it was that it used to be good at reviewing a puzzle and telling you what the next logical …

Advent of Code 2024 Ruby Solutions: Day 3
Advent of Code 2024 Ruby Solutions: Day 3

Advent of Code is an annual event that invites programmers to solve a series of themed puzzles each December, and this post is the third in my ongoing series for 2024. Day 3, “Mull It Over”, seemed simple at first glance: find and evaluate multiplications in a corrupted memory dump. But …