> Another approach I thought initially was to treat colors as 3d points and check the distance between them.
Granted, it doesn't matter much at all because they're just looking for the closest color, but it might be nice to do a transform into a perceptually uniform space (Oklab is both nice and computationally cheap) before calculating the distance, rather than just taking the euclidean distance of the raw pixel values like they do here.
If you combine that with caching the best matching emoji for each palette instead of calculating everything on the fly for each new color, there wouldn't even be a performance penalty for this.
Might be faster to work in palette space instead of RGB space. Instead of computing the RGB average value from a block, just pick the most representative palette index for that block and reverse lookup the best emoji for that palette index. All you need is an emoji lookup per each unique palette; there's only a few dozen unique palettes used in vanilla DOOM.
> Sounds like it might be an easy way to hack on doom without having to get a whole DOS environment set up.
I don't know doomgeneric, however before it, Chocolate Doom has been for long a common modern port (while respecting the original code as much as possible), allowing running on modern O/Ss.
This took me forever to understand the first example because that is not saturation, that is the proportion of red/green/blue. Saturation would be something different.
Granted, it doesn't matter much at all because they're just looking for the closest color, but it might be nice to do a transform into a perceptually uniform space (Oklab is both nice and computationally cheap) before calculating the distance, rather than just taking the euclidean distance of the raw pixel values like they do here.
If you combine that with caching the best matching emoji for each palette instead of calculating everything on the fly for each new color, there wouldn't even be a performance penalty for this.