Your guess is as good as mine; I’m still trying to figure out what is happening here. I drew the development sketch for this algorithm on a piece of paper towel while the effects of anesthesia were wearing off in a hospital.

Initially written in TypeScript and transpiled into 127.66KB of JavaScript, it uses the Immutable-js library for persistent data structures and is rendered with the canvas API in your web browser.