Hacker News new | past | comments | ask | show | jobs | submit login
Checkbox Olympics (checkboxolympics.com)
148 points by Gedxx on June 21, 2022 | hide | past | favorite | 48 comments



Looks like a good place to workout before attempting to switch off notifications in some popular applications.


Certain cookie opt-out dialogs are a good training ground as well.


When done, don't forget to click the "back" arrow in the upper left corner. There is another checkbox event (hurdles...)

In a weird way this reminds me of the old 80s "epyx" sports game which seemed to involve typeing keys as fast as you can.

https://en.wikipedia.org/wiki/Summer_Games_(video_game)


I remember playing a version of this on the (386?) PC. Bashing the various keys did not go down well with my dad.

https://www.freegameempire.com/games/Summer-Games


My "speedrun":

  var simulateClick = function (elem) {
   // Create our event (with options)
   var evt = new MouseEvent('click', {
    bubbles: true,
    cancelable: true,
    view: window
   });

   // If cancelled, don't dispatch our event
   var canceled = !elem.dispatchEvent(evt);
  };

  var run = () => {    
    var el = document.querySelector('input[type=checkbox]:not(:checked)')
    simulateClick(el)
  }
                     
  setInterval(run, 100)


My tool-assisted speedrun (0.001s):

  let setGo = document.querySelector(".setGo");
  let observer = new MutationObserver(mutations => {
      if (setGo.classList.contains("going")) {
          for (const { target } of mutations) {
              if (target.checked == target.disabled) {
                  target.click();
              }
          }
      }
  });
  observer.observe(setGo, {attributes: true});
  document.querySelectorAll(".theSport input").forEach(checkbox => {
      observer.observe(checkbox, {attributes: true});
  });
Explanation: instead of messing about with timers, it asks to be informed when any attribute changes (could use attributeFilter to only hear about "class" for setGo and "disabled" for checkboxes, but I didn’t bother). This is faster than can be acheived with setTimeout, setInterval or requestAnimationFrame, as timers are deliberately speed-capped. (Whereas mutation observers create microtasks, so we can go through this whole thing in one frame.)

When the observer gets notified (in a microtask), it checks if we’re going (in order to avoid false starts), and then goes through the checkboxes it’s been told just changed, and checks if they’re enabled and unchecked, and clicks them. In practice, the first mutation will come in with mutation records for setGo and the first checkbox, which we’ll click, which will trigger an event (a task) from the page code which enables the second checkbox, which will trigger an immediate mutation notification (a microtask), &c. until it’s all done, without ever rendering a frame in the meantime.


Dunno quite what your idea was with canceled: your comment doesn’t match behaviour at all. As for dispatching a click event, you can just use .click().

Your speedrun code can be reduced to this:

  setInterval(() => document.querySelector('input[type=checkbox]:not(:checked)').click(), 100)
It would be significantly improved by the addition of :enabled and then reduction of interval time.


Brute approach (This doesn't account for whether a checkbox is checked or not so I don't actually know if the game prevents everything getting checked programmatically all at once. I had to set the setTimeout to "2" instead of "1" so it would actually record some time!):

  document.querySelector('.readyButton').click();
  waitForStart();

  function waitForStart() {
    if (document.querySelector('.setGo').classList.value.includes("going")) { 
      for(x=0; x<document.querySelectorAll('input[type="checkbox"]').length; x++) { document.querySelectorAll('input[type="checkbox"]')[x].click(); }
    }
    else { setTimeout(waitForStart, 2); }
  }


I went with a manual-mix approach:

  var boxes = document.querySelectorAll("#root > div > div.sportsWrapper > div.theSport > div:nth-child(2) > input[type=checkbox]")
Then "start", wait for go signal while getting the code below ready on console. on go run the code:

  boxes.forEach(b => b.click())
Got: Time: 0.268


If you're going to cheat why not all the way:

    document.querySelector(".time").innerHTML = '<b>Time:</b> 0.0001';
    Array.from(document.querySelectorAll(".theSport input[type='checkbox']"))
      .forEach(e => { e.disabled = false; e.checked = true; });


     $('.readyButton').click(); setTimeout(()=> [...document.querySelectorAll('input[type="checkbox"]')].map(cb => cb.click()), 3000)

This gives me 0.143 in Safari which is just a proof that DOM is freaking slow haha!


setTimeout doesn't guarantee that it will execute exactly after 3000.

  (() => {
    const targ = $(".setGo");
    const targ2 = $(".theSport > div:nth-child(2)");
    const observer = new MutationObserver((mutations, observer) => {
      if (mutations[0]?.target?.classList.contains('going')) {
        targ2.childNodes.forEach(c => c.click());
      }
    });
  
    observer.observe(targ, {
      subtree: false,
      attributes: true
    });
  
    $('.readyButton').click()
  })();
  
This gives me consistent Time: 0.001 in FF. "Time: not yet set" in Edge/Chrome.


Today I learned. Thank you!


Wow in Chrome 102.0.5005.115 (Official Build) (arm64) it gives me 3.273s which proves that point even more


Hopefully you forgot to exclude 3sec timeout from that


I got 0.087 with firefox but subsequent tries are all in the 0.3-0.8 range.


I wonder how much of the time is spent in the onclick handler. Each of those clicks has to wait for the onclick handler before the next one executes, IIUC?


0.012 in Edge


Some of us have our stash of ~10 domain names for our side projects (that we renew year after year, with some embarrassment). Tim's got 90 linked from https://theuselessweb.com/

I wonder if he renews them on the cheap somehow, either way there are some really funny ones in there


Are you intentionally setting random tabindex values just to mess with keyboard users? I would like to suggest adding "Checkbox Paralympics" version, where keyboard users could compete too.


I decided to use Python instead of JS for this:

    import pyautogui as m
    from fastgrab import screenshot

    m.PAUSE = 0

    while 1:
        x, y = m.position()
        r, g, b, _ = screenshot.Screenshot().capture((x, y, 1, 1))[0][0]
        if (r, g, b) in ((50, 205, 50), (127, 224, 127)):
            break

    m.moveRel(-35, 105)

    for _ in range(27):
        m.click()
        m.moveRel(23, 0)
    m.click()
My record is 0.03 in FF

EDIT: 0.02 in Chromium


r/mildlyinteresting, but would have been better if after the race you were shown your rank among other participants.


considering how people are already gaming/cheating on this, it's useless stats. Sure, you can write code to check for bots and the bots will write code to beat it...and so on


A deep learning model on the blockchain should be able to figure out cheaters from mouse movements and click intervals no?

But yeah you are right.


Similar, a bit more challenging: https://checkboxrace.com/


My TAS can be slightly adjusted to work with this one:

  let observer = new MutationObserver(mutations => {
      for (const { target } of mutations) {
          if (target.checked == target.disabled) {
              target.click();
          }
      }
  });
  document.querySelectorAll("[type=checkbox]").forEach(checkbox => {
      observer.observe(checkbox, {attributes: true});
  });
Then click on the first checkbox and it’ll do all of the rest. Time varies a bit, best I’ve done in a couple of dozen attempts is 00:00:03.


This basically told me I need a new / different trackball. The coefficient of static friction is too high in my current one to do this accurately - I need more force to start the ball rolling than I need to move to the next checkbox.

I'm using a Sanwa Supply one now

Looks like it might be a ploopy with BTS instead of their rollerbearings.


Have you cleaned the ball and the bearings recently? I need to clean a Logitech M570 about every 2-3 weeks.


Cool game! Doesn't really work for me on mobile because the second box is obscured by the SET button.


Click "ready" then wait for the "Go" to go green. Then you can start racing, and here at least, I was able to click through the Set light


Kind of like minesweeper, but without the strategy part?

Because once a minesweeper addict has reached a certain base level of skill, the strategy part stops to be about where the mines are, it becomes all about reordering the click queue for speed. (don't ask me how I know)


"Set" covers the 2nd checkbox. Fun


It would be nice if I got to see how I did against other players.


I got: 100 Meter Sprint 18.509

110 Meter Hurdles 18.85

Total Time: 37.359

with a mouse on desktop chrome.


What am I doing with my life...


Perhaps finding timed checkbox challenges more fun than the other thing? Here are some more ideas for a break:

- https://news.ycombinator.com/item?id=30517626

- https://news.ycombinator.com/item?id=31191152

- https://news.ycombinator.com/item?id=24320277


On my tablet the slightes movement of the pen causes firefox to select stuff instead of switching the checkbox. Causes extreme slow-down.

Under normal circumstances I don't like websites to try to mess with selection, copynpaste, ... but in this case it would be both helpful and justified.


setInterval(() => { if(document.querySelector('.going')) { document.querySelectorAll('.theSport input').forEach(box => { box.click(); }); }}, 10);


best game! Time: 9.598

edit 1: 9.004 at my pixel, i am mobile gamer now! pog

edit 2: 6.446 on phone !


Good job! I can't get below 10 on my iPad.


Apple devices are not made for gaming ;)


I think this demonstrates that:

1) the hit area of native checkboxes should be larger, and

2) fieldsets with checkboxes should come with a native "Toggle All" button


it would be such a dream if the hit area for native checkboxes would be larger


Aargh - no keyboard shortcuts allowed!

That's me knocked out in the qualifying rounds of the checkbox olympics ;-)


More like Carpal Olympics, amirite?


In Chrome on a Note 10+ Set is covering the second checkbox and is uncheckable


15 and change on desktop Firefox


13.533 on a mbp trackpad




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

Search: