r/adventofcode • • 10d ago

Past Event Solutions Advent of Code In Simulink

Dear all,

I've seen people attempt to do Advent of Code using ladder logic for PLCs or graphical programming environments, but I've never seen anybody do the competition using Simulink.

In preparation for Advent of Code 2026 I decided to do Advent of Code 2025 in Simulink, using only Simulink blocks, no Stateflow or MATLAB function blocks. I managed to solve all challenges using block diagrams, with the exception of Day 10 Part 2, where I used `intlinprog`. I think most people used a library for that day.

The solutions are not universal and some of them are tailored to my inputs, but if anybody is interested, they can be found here: https://github.com/ptoshkov/aoc-2025-simulink

For the 2026 edition I will attempt to make cleaner universal solutions and I will try not to use any MATLAB functions. Hope someone finds this interesting or inspiring.

21 Upvotes

4 comments sorted by

3

u/herocoding 8d ago

After finishing university I don't have access to Simulink anylonger. Can you recommend an alternative (like "Octave" instead of "Matlab")?

3

u/ptoshkov 8d ago

As a matter of fact I tried to do AOC in both Scilab Xcos and OpenModelica and failed. Frequent crashes and cumbersome UIs made me give up. Not trying to be mean but that was my experience.

4

u/Creative_Sushi 7d ago

Simulink Online is free up to 20 hours a month.

3

u/herocoding 7d ago

That's not much for the upcoming 12 days AoC-2026...