this post was submitted on 20 Jun 2024
446 points (98.1% liked)
Programmer Humor
19572 readers
1533 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
32 is ASCII space, the highest number you need is 114 for r (or 122 for z if you want to be generic), that's a range of 82 or 90 values.
The target string has 13 characters, a long long has 8 bytes or 16 nibbles -- 13 fits into 16 so nibbles (the
(x >>= 4) & 15
) it is. Also the initial x happens to have 13 nibbles in it so that makes sense. But a nibble only has 16 values, not 82, so you need some kind of compression and that's the rest of the math, no idea how it was derived.If I were to write that thing I'd throw PAQ at it it can probably spit out an arithmetic coding that works, and look even more arcane as you wouldn't have the obvious nibble steps. Or, wait, throw NEAT at it: Train it to, given a specific initial seed, produce a second seed and a character, score by edit distance. The problem space is small enough for the approach to be feasible even though it's actually a terrible use of the technique, but using evolution will produce something that's utterly, utterly inscrutable.