A shot at solving the puzzle described by James Grime in https://www.youtube.com/watch?v=pFHsrCNtJu4
My apologies if the code is a bit opaque. I just coded this up to see if I could get something working, so the output is pretty unintelligible. Hopefully, if you watch the video, then you can see what I'm getting at.