Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Very cool idea! On my first two tries, I quickly got to 94% but then got absolutely stuck there. The 94% seemed like a local optimum (moving any slider one slot in either direction

Any way to explain that?

Also: it would be cool to have a way to forfeit and get the solution.



I had this issue. Didn't realize that on my phone I was fat-fingering and struggling to get exactly one movement on a slider instead of two.


Oh, that's probably it!


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.


94% means you need only one slide up or down, so 6 posibilities. If you move one and it doesn't solve, you can't move another without getting the first to the old position.


I don't think that's possible. When I tried it, if you only pick one number the percentage match goes up or down.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: