So, <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;danverbraganza&#x2F;8447acc70ad08c92d4fd" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;danverbraganza&#x2F;8447acc70ad08c92d4fd</a> has an uglified version of the same code, shortening identifiers, removing extraneous whitespace, and (!) replacing bool(x) with not x to save 2 characters.<p>That&#x27;s a good first stab at it, but it can definitely be smaller, esp. if you&#x27;re willing to add more lines (which I&#x27;m not). Happy hacking!