5 ms·
The thing about donut.c is that its source code is shaped like a donut, that’s a huge part of its charm. While altering it to use shifts and adds is a fun exer
by malux85 2y ago
The thing about donut.c is that its source code is shaped like a donut, that’s a huge part of its charm.
While altering it to use shifts and adds is a fun exercise, since its source code is no longer shaped like the donut it renders, I would argue that a large part of its charm has disappeared and it’s no longer a donut.c
- Zamiel_Snawley 2y agoIt’s trivial to reformat the source code into a donut shape.
- zamadatix 2y agoSometimes it's those trivial changes which add a lot of the overall charm.
- refulgentis 2y agoNon-trivial, IMHO - automating it sounds non trivial, and doing by hand is quite non-trivial, right? We gotta go make hand edits line by line?
- mianos 2y agoConsidering the language, C and the size of the file, I would not argue it is not trivial. The key feature of donut.c is how small the file actually is. For something larger or in other languages, or having text strings, certainly not trivial.
- omoikane 2y agoFor a language like C, I would describe the formatting process as "straightforward" as opposed to "trivial". It's straightforward in that it feels very mechanical, but not trivial in the sense that it's difficult to fully automate the process. (The mechanical part is inserting spaces at the right places, the not so mechanical part is swapping tokens and rewriting expressions so that things line up). You can see an example recording here of how it's done: https://www.ioccc.org/2019/yang/obfuscation.html https://www.ioccc.org/2019/yang/obfuscation.html First half of it is writing and golfing, second half is the formatting bits. For languages like Perl and Ruby, the formatting process is easily automated and mostly trivial.
- refulgentis 2y agoThat visualizer is incredible, appreciate it and the insight - and 4 hours! Wow.
- qingcharles 2y agoWe need someone to write pastry.c which takes any C file and reorganizes the code into the shape of delicious bakery products.
- timewizard 2y agommmmm.. trivial donuts...
- rcxdude 2y agoIndeed. I feel like to capture the spirit of it you could make the layout on the chip look like a donut, which would be if anything more of a challenge than the layout of the source code.