r/programming • • Aug 30 '15

JavaScript “maze generator” in a tweet

https://twitter.com/botond_balazs/status/637960240055615488
841 Upvotes

177 comments sorted by

View all comments

Show parent comment

1

u/koviko Aug 30 '15 edited Aug 30 '15

This is missing three of the other tricks:

  • Using <tt> instead of <pre>
  • Combining the ternary operator into a string-array
  • Passing multiple parameters to document.write instead of concatenating strings

So we can get down to 134 characters:

data:text/html,<tt style=line-height:1><script>for(i=4e3;i--;)document.write("\u2571\u2572"[Math.random()*2|0],i% 80?"":"\n")</script>