Just a little demo I made of a fully functioning game of snake encoded entirely within a valid url (around 1033 bytes of code encoded into a 1464 byte url).
You are on a completely different level. Wow. I am going to spend absolutely too long tomorrow trying to work out how on earth you've done that. Cheers!
Can't update the post now, but I've actually got it down to 713 bytes, which I'm pretty happy with! I could remove features/colors/styles at this point, but I think I'll leave it there for now.
https://news.ycombinator.com/formatdoc says that between angles it should work, but it does not. Or i don't know how to use it, it doesn't seem to do anything.
That was actually the original plan! But unfortunately it seems like my phone's qr code reader won't open it in a browser automatically. I then tried using a url shortener to link to it but absolutely no shortener that I could find would take a data: url.
I could host my own shortener to do it, but it feels like that is cheating the spirit of the challenge.
I'll keep playing with it though, add touch device controls, maybe a site to allow generating different versions of the url (different colours, sizes, game over messages, etc).
1. You can change directions multiple times within a tick, making the last direction to be effective.
2. You can change to any directions, including the opposite direction of your current movement, which usually results in :( as the snakes head bumps into its body...
3. Except when the snake has length 1 or 2, then it's OK, as the snake either does not have a body yet, or its body and head switch places at the next tick.
As a combination of 1 and 2, quickly turning around is a risky move.
"When decoded, the script appears to be a Snake game implemented using JavaScript and the HTML5 canvas element. The script creates an HTML page with a canvas element and adds event listeners for arrow keys and space bar to control the game."
Wow, that's actually impressive. Any idea how chat gpt would know that? Surely it's not making the request for it and surely it's not actually decoding any base64 right?
Wow that's impressive. Is ChatGPT updating its model fast enough that this repo could have been included or is it really figuring out what this is from the code itself?
https://danielgjackson.github.io/tinyjs#snake
...and even a 224 byte version (240 as a URL), but with a few too many sacrifices.