Day 1: Secret Entrance

Megathread guidelines

FAQ

  • hadesM
    link
    fedilink
    arrow-up
    3
    ·
    3 months ago

    the idea is that crossing the zero is easy to detect by dividing the total dial movement by 100. I.e. if you cross from 120 to 90 you will detect that 120/100=1 changed to 90/100=0. The only case when this doesn’t work is when you stop at zero going in the negative direction, hence the extra if

    • Deebster
      link
      fedilink
      arrow-up
      1
      ·
      3 months ago

      The thing I couldn’t comprehend was where 1000000000050 had come from.

      • hadesM
        link
        fedilink
        arrow-up
        2
        ·
        3 months ago

        ah that’s just because i needed rounding towards infinity and not towards zero. In other words i wanted -10/100 to be -1 and not zero. But i couldn’t figure it out on the spot, so i just made it never negative :)