Live data from Hacker News

Play snake in the URL address bar

demian.ferrei.ro

61–70 of 100 posts

Re: Play snake in the URL address bar

#61

Very interesting. What inspired you to build this, I'd love to hear the story behind this.

> What inspired you to build this, I'd love to hear the story behind this.

Actually, i don't remember! Sorry, it's been a while (a decade, it seems... oh well)

This is probably my mind retro-creating a story, but i think this started with me wondering about how the Braille system worked. Like, did each Braille symbol map to a single letter, or to a whole syllable, or even a concept? Or, were more than one Braille symbol needed for some letters, like Morse?

Turns out each Braille symbol fits within a 2x4 grid of points. That's 2 possible states (point is on or off) for each of those 8 points. So 2^8 = 256 possible values. That's a byte! And luckily, Unicode encodes all those 256 possible values, and maps them to codepoints in a very systematic way.

So obviously, i started to wonder what kind of things could be represented on these Braille grids. The snake game was a natural fit, and a fun programming experience. But i also considered other things, like a horizontal Tetris. Or a Game of Life rendered on the URL, which i actually implemented(1), but i didn't find as entertaining as snake, because the 4-tile height restriction impeded any interesting patterns, like gliders (even with wrap-around logic). I think i even made some brute-force searching for horizontal or diagonal gliders trying out different born/survive rules(2), but couldn't find any interesting patterns, other than still life, blinkers, and some "moving walls" kind of things.

Anyways, that's for the Braille part. The idea of using the address bar to render the game, i have no idea where that came from TBH. Maybe i stole the idea from some other animated or pretty thing on URLs? I wish i remembered.

(1): https://github.com/epidemian/URLife

(2): See https://en.wikipedia.org/wiki/Life-like_cellular_automaton. The Game of Life rabbit hole goes deep.

Re: Play snake in the URL address bar

#62
post #10

next time doom please :)

I've actually thought about rendering DOOM on the favicon. I don't see why it shouldn't be possible. Maybe @Franciscouzo could tackle that challenge! https://news.ycombinator.com/item?id=45408825

I am pretty sure this already exists.

https://vidferris.github.io/FaviconDoom/favicondoom.html

Re: Play snake in the URL address bar

#64

Wow! It's such a surprise to see this old project of mine here on HN front page! I must say, if you're experiencing any issues playing this, it's probably because it was designed to be played on the browsers of 10 years ago hehe. Here's how the game used to look and play in its former days of glory: https://github.com/epidemian/snake/blob/master/gameplay.gif?... Since then, browsers have made some so-called "security…

This is very very cool. And also the second worst abuse of the browser I've ever seen ;) I doff my hat to you!

Re: Play snake in the URL address bar

#65

This is awesome. My only issue is that the character used for whitespace looks janky in my browser, like a bunch of non-monospaced squares. A potential remedy: because Unicode contains all 256 possible 4x2 Braille patterns, why not use ⣿ as the background and carve out the snake/food as negative space, e.g. ⣿⣿⣛⣛⣛⣛⣛⣩⣽⣿⣯⣿⣿⣿ This would ensure uniform spacing and is just as legible.

Yes, i thought of doing that. The problem is that, while it would definitely help on the early game, it would also mess things badly on the late game. As you snake grows, it'll take more and more space on the grid, and you'll start seeing more and more janky whitespace-replacement characters. The game gets faster as you progress, so it's definitely not a good idea to make it jankyer when you're try-harding it :P I'd…

You could also flip the palette at half point.
Post reply on HN