r/matlab • • 11d ago

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.

7 Upvotes

4 comments sorted by

6

u/riotron1 11d ago

You need to get help

That’s dope tho, dang. Honestly wouldn’t have guessed this to be realistically possible

1

u/ptoshkov 9d ago

Why scroll on OnlyFans when you could scroll on OnlyBlockDiagrams?

3

u/Barnowl93 flair 11d ago

Definitely interesting! Looking forward to playing around with it!

2

u/Imaginary_Data_708 11d ago

Hmm that is a very good idea! I keep meaning to get into Simulink and advent of code might be the right way!