3 ms·
The score is defined as follows: function score (r, g, b, rr, gg, bb) { const maxRErr = Math.max(r, 15 - r) const maxGErr = Math.max(g, 1
by miggol 3y ago
The score is defined as follows:
function score (r, g, b, rr, gg, bb) {
const maxRErr = Math.max(r, 15 - r)
const maxGErr = Math.max(g, 15 - g)
const maxBErr = Math.max(b, 15 - b)
const maxDist = Math.sqrt(maxRErr * maxRErr +
maxGErr * maxGErr +
maxBErr * maxBErr)
const rErr = Math.abs(rr - r)
const gErr = Math.abs(gg - g)
const bErr = Math.abs(bb - b)
const dist = Math.sqrt(rErr * rErr +
gErr * gErr +
bErr * bErr)
return Math.floor(100 * (1 - dist / maxDist))
}
Before even starting to count the error, it calculates the maximum error possible for the target colour. That makes sense! We want the percentages to feel more or less the same every round. Otherwise a medium grey would score relatively higher with every guess.
But to answer your question, I don't think the local optimum situation you are describing is possible. I'm no math wizard but looking at this function there must (surely?) always be a direction to move one slider to get a higher score, unless you're bang on. So I think you just missed out on that one move, which does get ever more likely as your guesses get closer.