Python
Advent of Code 2025: Day 02
Day 2 of Advent of Code 2025 is a satisfying dive into pattern detection over numeric ranges, starting with pairs of repeated digit sequences and then generalising to any number of repeats. The Python solution below uses straightforward string slicing and chunking to get the job done with clear, …
Advent of Code 2025: Day 01
Day 1 of Advent of Code 2025 is a neat exercise in modular arithmetic, where you track a circular dial and count how often it hits zero. Part 1 counts only the zeros landed on at the end of rotations, and Part 2 upgrades that to count every click that passes through zero mid-rotation too. In this …
Pausing for Human Feedback in LangGraph
Adding a human-in-the-loop step to a LangGraph flow is an easy way to improve quality and control without adding branching or complexity. In this post we will build a tiny three-node graph that drafts copy with an LLM, pauses for human feedback, and then revises the draft, using LangGraph’s …
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
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 …
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
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 …
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 …
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 …
Sudoku Series: Implementing Hidden Set Rules
In the last Sudoku Series blog post we implemented the naked pair and the naked triple rules. In this post, we will look at implementing the hidden single, hidden pair and hidden triple rules. Applying these rules is documented on many websites, but the two I’ve liked during my research are …
Sudoku Series: Implementing Naked Set Rules
In the last Sudoku Series blog post we implemented the single candidate rule. In this post, we will look at implementing both the naked pair rule and the naked triple rule. These are documented alongside more advanced rules on a Mastering Sudoku website.
If you like this post and you’d like to …
Sudoku Series: Implementing the Single Candidate Rule
This week, we hit a major milestone: our solver can now complete very easy Sudoku puzzles, thanks to the simplest rule of all — the single candidate rule. By writing code that parses the grid repeatedly and looks for opportunities to apply this rule, we’re able to solve some of the simplest …











