NokiMo
Megan Fox
Megan Fox

patreon


Gap Detection Is Horrifying

This isn't aspirational code. It's more like an unavoidable car crash, where the expert driver steers into the inevitable hit to control and minimize any injuries.

I'm sharing this because I think it's an interesting, incredibly dense bit of logic. I mean LOOK AT THIS SELF-RELOOPING DOUBLE LOOP:

It's horrible, but it's wonderful. I'm iterating over a fixed array, but I reset the iteration essentially at random, and then rely on a secondary purely one-way linked list iteration to save my ass from it being a completely impossible to predict infinite loop. It's all just a nightmare that I can't look away from. Oh and of course it optionally iterates in both ways, because, OF COURSE.

This is the hell that is gaps. Never make gaps in your gate. Always make gaps. I don't know. It was equal parts exhilarating and horrifying to write and debug this over a few days.


Related Creators