Show HN: Print chr$(205.5+rnd(1)) goto 10
16 comments
There is actually a whole book written about this line of code. A pdf is available on the Open Access tab.
https://mitpress.mit.edu/books/10-print-chr2055rnd1-goto-10
https://mitpress.mit.edu/books/10-print-chr2055rnd1-goto-10
Bravo. Just ran this, seeing the JIT kick in was a trip.
Data URIs: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_...
Data URIs: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_...
Chrome seems to compile before it runs it. Only Firefox takes some lines before it runs it as fast as Chrome. Now I wonder why it takes so long to do the JIT? I always thought that JIT compiles with every execution...
As I understand it there's a "baseline" compilation, then after n calls it's specialized according to the types/values seen.
It works but doesn't scroll automatically like others :) Still a neat idea! I had also written one in Z80 Assembly in 14-bytes for Amstrad CPC computers: https://github.com/ssg/mazecpc
Here it is with scrolling:
data:text/html,<script>a=()=>{document.write(Math.random()<0.5?'\u2571':'\u2572');document.body.style.cssText="margin:0;padding:0;font-family:monospace;word-break:break-word;font-size:3em;letter-spacing:0;font-stretch:ultra-expanded"};update=()=>{a();window.requestAnimationFrame(update);window.scroll(0,window.scrollMaxY)};update()</script>
data:text/html,<script>a=()=>{document.write(Math.random()<0.5?'\u2571':'\u2572');document.body.style.cssText="margin:0;padding:0;font-family:monospace;word-break:break-word;font-size:3em;letter-spacing:0;font-stretch:ultra-expanded"};update=()=>{a();window.requestAnimationFrame(update);window.scroll(0,window.scrollMaxY)};update()</script>
In which browsers? This doesn't seem to work for me in Chrome, but maybe it's just me. Works in Firefox and Safari.
Edit: Nevermind, I tried again and it did begin to run before the tab closed abruptly. Tried again in an incognito window and it worked, and it also worked in a regular Chrome window with only one tab. Tried to run it in a second tab in that same window and the tab instantly closed again. Anyone know why this might be the case?
Second edit: While it doesn't run in regular Chrome windows with multiple tabs, it does run in Incognito windows with multiple tabs. I don't think I have the expertise to dig further though.
Edit: Nevermind, I tried again and it did begin to run before the tab closed abruptly. Tried again in an incognito window and it worked, and it also worked in a regular Chrome window with only one tab. Tried to run it in a second tab in that same window and the tab instantly closed again. Anyone know why this might be the case?
Second edit: While it doesn't run in regular Chrome windows with multiple tabs, it does run in Incognito windows with multiple tabs. I don't think I have the expertise to dig further though.
I'm using breve these days and it works. It's chromium based
data:text/html,<script>a=()=>{document.write('\u{1F600}');document.body.style.cssText="margin:0;padding:0;font-family:monospace;word-break:break-word;font-size:3em;letter-spacing:0;font-stretch:ultra-expanded"};update=()=>{a();window.requestAnimationFrame(update)};update()</script>
or maybe change 1F600 to 1F44D :)WoW really cool effect! Love this kind of works!
Add 'line-height:1em;' to make it look a bit cooler.
The result looks like this:
╱╲╱╱╱╲╲╱╲╲╲╱╲╱╲╱╲╲╲╲╱╲╱╲╲╱╲╱╱╲╱╲╱╱╲╱╲╲╲╲╲╱╲╱╲╲╲╲╲╲╲╲╱╲╱╱╱╱╲╲╱╱╲╱╲╲╱╱╱╱╲╱╱╲╲╱╲╱╲╲╱╱╲╱╱╲╱╱╲╱╲╲╲╲╲╱╱╱╱╲╲╲╱╱╲╱╲╲╱╲╱╲╲╲╱╱╱╲╱╱╱╲╱╲╱╱╲╲╲╲╲╲╲╲╱╱╲╲╲╱╲╲╱╱╲╲╲╱╲╲╲╲╱╲╱╲╲╲╲╱╲╱╱╲╱╱╱╲╲╲╲
╲╱╲╱╲╲╲╱╱╲╱╱╲╱╲╲╱╱╲╱╲╲╱╲╲╱╲╲╲╲╲╲╱╲╱╱╲╱╱╱╱╱╱╲╲╱╱╲╱╱╲╱╱╲╲╲╲╱╱╲╱╱╱╱╱╲╲╱╲╱╲╲╲╱╱╱╱╲╱╲╱╲╱╱╱╱╲╲╲╲╱╱╱╱╱╱╱╲╲╱╲╲╱╱╱╱╱╲╱╲╱╱╱╱╲╲╱╱╱╱╱╱╲╱╲╲╱╲╲╱╱╲╱╲╱╲╱╲╲╱╲╱╱╲╱╲╱╲╲╲╲╲╱╲╲╱╱╲╱╱╲╱╲╱╲╱╲╱╱╲╱
╱╲╱╱╱╲╲╲╲╱╲╲╱╱╱╱╲╲╲╲╲╲╱╱╲╲╲╲╱╲╲╱╲╱╱╲╱╲╲╲╱╱╱╲╱╱╲╱╲╱╲╱╲╱╲╲╲╱╱╲╱╱╱╱╱╲╱╱╱╲╲╲╱╱╲╱╲╱╲╱╱╲╱╱╱╲╱╱╱╲╲╱╲╱╱╱╲╱╱╲╱╱╲╱╲╱╱╱╱╲╲╲╲╱╲╱╲╲╱╲╱╱╱╲╱╲╱╲╲╲╲╲╱╲╱╱╲╱╲╱╲╲╲╲╱╲╱╱╱╲╲╱╱╲╱╱╲╲╲╲╲╲╲╲╱╱╱╱╲╲╱
╲╱╲╱╲╲╲╱╲╲╱╲╱╱╲╱╱╲╲╱╱╲╱╱╲╱╱╲╲╱╲╱╱╲╲╱╱╱╱╱╲╲╱╲╲╱╱╱╲╲╲╲╱╱╲╲╱╲╲╱╱╱╱╱╲╱╱╱╲╱╱╱╱╱╲╱╲╲╱╲╱╲╱╲╱╱╱╲╱╲╲╲╱╱╱╲╲╱╱╱╱╲╲╲╱╲╲╲╲╱╲╱╱╱╱╲╱╲╱╱╱╲╱╱╲╱╱╲╱╲╱╱╱╱╲╱╱╲╱╲╱╱╲╱╲╱╱╲╱╲╲╲╱╲╲╲╱╲╱╱╱╲╱╱╲╲╱╲╱╲╲
╲╲╲╱╱╱╲╲╱╱╱╲╱╲╱╱╱╲╲╱╱╲╲╲╱╱╲╱╱╲╲╲╲╱╲╱╱╲╲╲╲╲╲╱╱╱╱╱╱╲╱╲╲╱╱╲╱╲╲╱╱╲╲╱╱╱╲╱╱╲╱╱╲╱╱╲╱╲╱╱╱╱╲╱╱╱╲╱╱╱╲╱╱╲╱╱╲╱╲╲╱╲╲╲╱╲╲╲╲╱╱╲╱╱╱╲╱╲╲╲╱╲╲╲╱╲╱╱╲╱╲╲╱╱╱╱╱╲╲╱╲╱╲╱╲╱╱╲╱╲╲╲╲╲╱╱╲╱╱╱╱╲╲╲╲╱╲╲╱╲╱
╲╱╲╲╱╲╲╲╱╱╲╱╲╲╱╱╲╱╲╱╲╲╱╲╲╲╱╲╱╲╱╲╲╲╲╲╱╲╱╲╱╱╱╱╱╱╲╲╱╲╲╱╲╱╱╲╱╱╲╱╱╱╱╲╱╲╱╱╱╲╱╲╲╲╲╱╲╲╱╲╲╱╲╱╱╱╱╲╱╲╲╲╱╱╲╲╱╱╲╲╱╲╲╱╲╱╲╱╱╱╲╲╱╲╱╱╲╲╲╲╱╲╱╱╱╲╲╱╱╱╱╱╲╲╱╱╱╱╱╱╱╱╱╱╲╱╲╲╱╱╲╲╱╱╲╲╱╱╲╱╲╲╱╱╱╱╲╱╲╲╱Underrated comment!
data:text/html,<script>a=()=>{document.write(Math.random()<0.5?'\u2571':'\u2572');document.body.style.cssText="margin:0;padding:0;font-family:monospace;word-break:break-word;font-size:3em;letter-spacing:0;font-stretch:ultra-expanded"};update=()=>{a();window.requestAnimationFrame(update)};update()</script>
Copy and paste the above "link" in your browser.