rusty_spire
EngineA headless Slay the Spire 2 engine, written as a Rust library.
Slowly building up towards an Ironman. Every line is one week since I started tracking.
Since 17 Aug 2026
I'm a programmer and student at TGM in Vienna, studying Information Technology in the DSAIData Science and AI branch. My projects mostly revolve around backends, optimisation, data science and whatever I'm currently interested in. I also love challenging my brain, especially in the age of AI. Outside of programming, my main hobby is sport (especially swimming), and I'm currently training for an Ironman. I use Arch btw.
A headless Slay the Spire 2 engine, written as a Rust library.
An Android calculator with its own expression parser. Invalid inputs are blocked by a state machine.
Botball robots for the European Conference on Educational Robotics 2026.
A Cloudflight Coding Contest pipeline that lets an AI coding agent solve and optimise the levels, with a focus on speed.
A headless Slay the Spire 2 engine, written as a Rust library.

An Android calculator with its own expression parser. Invalid inputs are blocked by a state machine.

Botball robots for the European Conference on Educational Robotics 2026.

German flash cards for science lessons, right in the browser. The cards come from the same LaTeX files as the paper cards.

Some of my Advent of Code 2025 solutions, written in Java.

A REST API for a simulated flood early warning system. It serves stations, measurements and alerts in JSON or XML, and a web client shows them.
A Cloudflight Coding Contest pipeline that lets an AI coding agent solve and optimise the levels, with a focus on speed.

The Cloudflight Coding Contest Classic 2026, solved with the ccc-rs pipeline. Level 6 is an optimisation level, and several of its cases are proven optimal.
A headless Slay the Spire 2 engine, written as a Rust library.
An engine for Slay the Spire 2 without any graphics, as a Rust library. It plays full runs: combat, the map, events, shops, card rewards, relics, potions, rest sites and the transitions between acts. All five characters are in it, with 592 cards, 298 relics, 107 enemies and 65 events (and 1,580 tests).
It doesn’t make any decisions itself. The caller picks an action and the engine moves on to the next decision. It’s built to be called millions of times by other code, for example a search.
let mut state = rusty_spire::new_run("my seed");
while state.is_over().is_none() {
let actions = state.available_actions();
let choice = actions.as_slice()[0];
state.apply(choice);
}
apply resolves everything up to the player’s next decision. The caller never sees a trigger chain or an enemy turn halfway through. The views only show what a good human player could see or work out (an enemy’s intent pattern, for example, but not its exact next move).
The reference is the decompiled C# of the game. Every mechanic has a comment that names the class it comes from. The randomness copies the game’s own generator, named streams and seeding, so the same seed with the same decisions gives the same run.
conformance/ runs the real game and the engine side by side and compares their output line by line. In replay mode the game plays a run and records each choice, then the engine applies the same choices. Right now 6,010 seeds agree, covering the random numbers, rewards, shops, rooms, combat, events, maps and full runs.
That still isn’t a proof. A bug in the act entrance relics got through a fully green sweep and only came up when a player hit it in a normal run.
The state is one flat structure. In a normal run nothing lives on the heap, and cloning the state is a plain byte copy (the deck and the relic list hold up to 48 cards and 32 relics inline before they move to the heap). Without any shared handles, threads can search in parallel.
Starter Ironclad deck against one enemy:
| Measure | Rate |
|---|---|
| whole combats on one core, with the clone | 59,000 per second |
| one action | 1.2 µs |
| whole combats on 16 threads | 547,000 per second |
Rust with one dependency (xxhash-rust, for seeding the random streams). The conformance check is a small Godot project in C# plus Python scripts. A separate solver crate builds on the public interface without changing the engine.
It’s an unofficial project. The repo has no code or assets from the game (the decompiled source isn’t in it either).

An Android calculator with its own expression parser. Invalid inputs are blocked by a state machine.
An Android calculator I wrote by hand in Java. Both the look and the way it reacts to input are copied from the iPhone calculator. The maths runs on its own parser (no eval() and no libraries).
Before writing any code I went through the iPhone calculator state by state, pressing every button in each state and writing down what happened (for example whether a second dot gets ignored or what a ( right after a number does). Those notes turned into a table with one row per button and one column per state. Only then did I write the code model from the table and test it.
The full table is in the repo.
The input is always in one of nine states, which say what the last character is (DIGIT, DOT, OP, OPEN and so on). Each button checks the current state and does what the table says for it. That’s why something like 07 or 5.. never shows up on the display. Some presses also change what’s already on the display. A ( after a number becomes x(, and a second operator replaces the first one.
This is what the display does while you type 5 ( 3 + x . 5 =:
| You press | Display | Why |
|---|---|---|
5 |
5 |
replaces the start 0 |
( |
5x( |
adds the x before the bracket |
3 + |
5x(3+ |
normal input |
x |
5x(3x |
replaces the + |
. |
5x(3x0. |
adds the 0 |
5 |
5x(3x0.5 |
normal input |
= |
7.5 |
closes the bracket, then calculates |
Open brackets are counted. A ) only works while a bracket is still open, and brackets you didn’t close get closed when you press = (you never see them).
Backspace uses a stack that mirrors the input character by character, with the state and the bracket count at each position. Deleting a character pops the stack, which brings the previous state back.
On = a tokenizer turns the string into tokens, then a recursive descent parser evaluates them. Every level of precedence is its own method (expression for + -, term for x /, then power, unary and primary) and calls the next level down. ^ is right-associative, which is why power() calls itself for its right side instead of looping.
Division by zero and 0^0 show Error. The result gets rounded with BigDecimal (otherwise 0.1 + 0.2 would show 0.30000000000000004). Anything with more than 15 digits shows Overflow.
The expression stays visible above the result. You can keep calculating with the result right away.
The UI copies the iPhone calculator too, with orange operators, dark grey digits and a lighter grey top row. The buttons have a 4:5 ratio. In landscape and on tablets the button grid takes the full width and half the screen height.
Java and the Android SDK. The input handling, the tokenizer and the parser are plain Java without any libraries.

Botball robots for the European Conference on Educational Robotics 2026.
Details follow.

German flash cards for science lessons, right in the browser. The cards come from the same LaTeX files as the paper cards.
A flash card app for the science lessons (NaWi) at my school, with ten topics from first to fourth year and 217 cards. Everything in it is in German.
The cards already existed as LaTeX files for printing paper cards. Every card is in there twice, once as \frontcard and once as \backcard with the same number. The app reads those same files. It only looks at these two commands and skips the rest of the document.
Formulas are rendered with KaTeX (chemistry with \ce{...} from mhchem). If KaTeX can’t handle a formula, only that formula shows up red while the rest of the card still works.
The repo is also the website. To add a topic, the teacher uploads the .tex file into decks/ with GitHub’s upload button. A GitHub Action then updates the deck list, and about two minutes later the new topic is on the start page.
TextEdit on macOS saves files as rich text without asking. The app checks for that and shows it on the tile (same for a file without cards or one that didn’t load).
GitHub Pages lets browsers cache files for about ten minutes, which would make a changed deck show up late. For decks the service worker asks the network first and only uses the cache when you’re offline.
You see the question, flip the card and say if you knew it. By default you have to know a card twice in a row before it’s gone. One wrong answer and it starts from zero again. In the settings you can change the two to anything from one to five.
Unfinished cards go back into the queue. In random order they land somewhere in the second half, so you can’t just learn the order.
Your progress is saved in the browser for each deck. If a deck changes, new cards get added to your queue, deleted ones disappear, and the rest of your progress stays.
For tests there’s a Probetest mode. You pick the topics and how many questions you want, then every card comes up exactly once. At the end you get a percentage.
Plain JavaScript modules with no framework and no build step (the only library is KaTeX). It’s hosted on GitHub Pages and works offline through a service worker.

Some of my Advent of Code 2025 solutions, written in Java.
Advent of Code is a set of programming puzzles that comes out every December. I did some of the 2025 ones in Java, just for fun. So far that’s the first five days, with both parts each.
| Day | The puzzle | How I solved it |
|---|---|---|
| 1 | a dial from 0 to 99 that turns left and right | modulo for part 1, part 2 counts every pass over 0 from the length of each turn |
| 2 | IDs that are one digit pattern repeated | every number in each range gets checked as a string |
| 3 | pick digits from a line to make the biggest number | always the biggest digit that still leaves enough digits after it (2 in part 1, 12 in part 2) |
| 4 | a grid of paper rolls, count the ones with fewer than four neighbours | part 2 removes them again and again until nothing changes |
| 5 | check IDs against a list of ranges | part 2 merges overlapping ranges and adds up their lengths |
Nothing fancy, mostly plain loops. Day 2 really does try every single number in each range.
The puzzle inputs aren’t in the repo, because Advent of Code asks people not to share them.

A REST API for a simulated flood early warning system. It serves stations, measurements and alerts in JSON or XML, and a web client shows them.
Five simulated stations on the Donau, Salzach, Mur and Inn take a measurement every minute. The API serves their data with filters, statistics and alerts. A small web client shows it in charts.
It started as a school task, but I treated it as a full project. All of the code is written by hand (without AI), which took around 30 to 40 hours.
The starting point was the course’s starter repo with a few warm-up tasks. After those I split the rest into GitHub issues, each with a goal and a “done when” checklist, and worked through them in order. Most commits reference their issue.
The task only asked for believable values that build on the previous measurement. I went further and put a small hydrology model behind them.
Rain comes from one round rain cell at a time. It enters the map from a random border, moves across at a constant speed and disappears when its lifetime ends or it leaves the map. A station gets rain while it’s inside the cell. Wet and dry periods form a two-state Markov chain. The length of each period is drawn once from an exponential distribution and then counted down tick by tick.
Each river has one catchment that works like a reservoir: rain goes in and drains into the river slowly. Every tick does this:
S = S + rain × 0.3
S = S − S × Δt / k
Q = Q_base + S / k × A × 1000 / 3600
h = h₀ + (Q / a)^(1/b)
Only 30 % of the rain reaches the catchment storage S (in mm). k says how slowly it drains (after k hours without rain about 37 % is left). Together with the catchment area A that gives the discharge Q in m³/s. The water level h comes from Q through a rating curve. Level and flow rate always rise and fall together. Without rain the river falls fast at first and then more and more slowly.
The model can’t do low water, because a river never drops below its dry-weather level. It also has no travel time downstream (all stations on one river react at the same moment).
These aren’t realistic flood levels (a real river reaches its warning level maybe once a year). I picked them by running the simulation for 100 years and choosing levels that give about 2.4 warning periods per week and one critical period every two weeks, across all stations.
| River | Catchment | Warning | Critical |
|---|---|---|---|
| Donau | 100,000 km² | 175 cm | 200 cm |
| Salzach | 4,400 km² | 195 cm | 270 cm |
| Mur | 7,000 km² | 185 cm | 255 cm |
| Inn | 5,800 km² | 190 cm | 265 cm |
A station that is inactive or has no measurement from the last three intervals shows UNKNOWN.
Temperature wanders around 15 °C and gets pulled back towards it (an Ornstein–Uhlenbeck process). The battery drains while a station is online. At 5 % the station goes into maintenance until it’s fully charged again.
On startup the server first simulates a 30-day warm-up so the rivers can settle, then the last seven days. When you open the client, the charts already show a week of history.
Java 17, Spring Boot 3.2 and Gradle, with all data kept in memory. The tests switch the simulation off and use a fixed Clock. The API is documented with OpenAPI and Swagger UI. The web client uses jQuery and Chart.js.
A Cloudflight Coding Contest pipeline that lets an AI coding agent solve and optimise the levels, with a focus on speed.
A pipeline for the Cloudflight Coding Contest where an AI coding agent (Claude Code) does the solving. The pipeline itself doesn’t know any puzzle. It handles everything around the solver and checks each result before it gets uploaded, since a wrong upload costs penalty minutes.
It’s a template, so every contest gets its own repo made from it. ccc-classic-2026 is one of those. The predecessor was ccc-pipeline, a first version in Java.
/level runs the whole loop. Each step is a normal command that also works by hand:
cargo ccc fetch 3 download level 3 and read it in
cargo ccc validate 3 compare with the worked example
cargo ccc all 3 solve every real input once
cargo ccc submit 3 check again, confirm, upload
The agent writes one file per level (level3.rs with a solve function). Downloading, reading the input, comparing and uploading all happen in the harness, which the agent isn’t supposed to touch.
validate compares the output with the example and answers GO or NO-GO (with the first difference). submit refuses outputs that are older than the current code. A human also has to confirm every upload.
Some levels accept many correct answers, where a plain comparison doesn’t work. Those levels get their own check function with the rules from the statement, written separately from the solver. If the level comes with the game’s own sandbox script, that runs as a second checker. It runs in Node with the permission model turned on and can only read the level files.
A statement PDF can hold text that a person never sees (white or tiny text, or text off the page) but an AI reading the PDF does. After every download a guard renders the pages as images and compares them with the text layer of the PDF. The comparison runs in a separate Claude session without any tools. If there’s hidden text, the agent only gets an image-only copy of the PDF. The original goes into a quarantine folder for a human to look at.
The harness is written in Rust. all solves all input files in parallel. Its outputs are saved with a fingerprint of the build and only get solved again after a code change. For optimisation levels it keeps the best answer per case across runs, so quick experiments with a short time budget can’t make the result worse.
The login comes straight from Firefox (no token to paste in).
Rust for the harness, Node for the sandbox checker and Ghostscript for rendering the PDFs. A setup script creates a new contest repo straight from GitHub without cloning the template.

The Cloudflight Coding Contest Classic 2026, solved with the ccc-rs pipeline. Level 6 is an optimisation level, and several of its cases are proven optimal.
The Cloudflight Coding Contest Classic 2026, which we did as a team of three. The contest ran for four hours (15:00 to 19:00). Levels 1 to 5 just have to be correct. Level 6 is an optimisation problem and took most of the time.
We finished 5th in Vienna and 17th in the world. After the contest I kept working on level 6 for three more days and ended up below the winning score.
There’s a hexagonal board with a pattern of cells to build. Six emitters sit on the border ring. Every tick each emitter either does nothing, switches on or off, or moves one step along the ring. Then every active emitter fires a beam across the board. A cell hit by exactly two beams becomes matter (three or more remove it again). Once the whole pattern is matter and no cell right next to it is, that copy counts and the pattern gets cleared.
You have to build the pattern a given number of times. The score is the number of program lines, so lower is better.
The solver is a beam search. Every tick, each kept state gets expanded by all 4⁶ = 4096 possible instruction lines, and only the best ones survive. We ran it on all cases, merged the best program per case between the three of us and uploaded that.
The solver got rewritten in Rust, which made it 6 to 10 times faster than the best beam search we had during the contest. Its optimiser restarts from a random prefix of the best program, on one of the 12 rotations and mirrors of the board, and only keeps verified improvements.
For lower bounds there’s an exact model. The board is rewritten in line coordinates, and a CP-SAT solver answers “is there a program with T lines?”. If the answer for one line less than the best known program is no, that program is proven optimal.
Most of the late gain came from the beam width. On big patterns, wider beams kept getting closer to the known optima. With widths between 100,000 and 500,000 (plus a few cases from the exact searches) the total went from 14,431 down to 14,350.
| medium | large | enormous | total | |
|---|---|---|---|---|
| contest end | 5,814 | 4,689 | 4,088 | 14,591 |
| best now | 5,800 | 4,596 | 3,954 | 14,350 |
| proven optimal | 208 of 210 | 115 of 190 | 15 of 140 |
The winner of the contest had 14,362.
The screenshot at the top is from a small local dashboard that tracked the scores, the bounds and the running jobs.
The solvers are Rust and run in the ccc-rs pipeline. The exact models use Python with OR-Tools CP-SAT. The dashboard is a small Python server with only the standard library.
| Modifier () | |
|---|---|
| Hold this key | |
| Windows | |
| Caps + ← ↑ → ↓ | Focus a window |
| Caps + Shift + ← ↑ → ↓ | Move a window |
| Caps + drag | Move with the mouse |
| mouse over | Focus with the mouse |
| Caps + Q | Close a project |
| Workspaces | |
| Caps + 1 | Home |
| Caps + 2 | Projects |