Live data from Hacker News

Asteroids JavaScript Bookmarklet to blow up any web site

erkie.github.com

41–50 of 77 posts

Re: Asteroids JavaScript Bookmarklet to blow up any web site

#41

Does anyone want to explain how this works? I had no idea dragging onto a tab could start up javascript on a page. It's amazing!

What you're talking about has been around forever, and is called a "bookmarklet"

http://en.wikipedia.org/wiki/Bookmarklet

Re: Asteroids JavaScript Bookmarklet to blow up any web site

#46

It's oddly non-deterministic. Add two ships and fly around a bit. They're paths will quickly diverge.

It's not that it's non-deterministic, it's just that, since your javascript interpreter doesn't execute each instance and its event handlers in parallel, each instance will receive slightly different inputs. This is because the number of times each instance's main loop fires before its keyup/down handler gets called will vary.

If you load up, say, 6 instances, hold the up button for a while to get them up to full speed, then turn for 4 or 5 seconds and let go, they'll be a bit divergent, but not too badly. They should all be going roughly the same direction, and wrapping around at roughly the same time.

If you load up 6 instances again, hold the up button for a while, and then turn back and forth very rapidly for a short period of time, they'll be much more divergent.

Re: Asteroids JavaScript Bookmarklet to blow up any web site

#49

Does anyone want to explain how this works? I had no idea dragging onto a tab could start up javascript on a page. It's amazing!

What you're talking about has been around forever, and is called a "bookmarklet" http://en.wikipedia.org/wiki/Bookmarklet

What a terrible explanation..
Post reply on HN