from Hacker News

Snake in a QR Code

by phit_ on 9/4/20, 1:08 PM with 82 comments

  • by skrebbel on 9/4/20, 2:25 PM

    If you want to see a variation of this concept in the wild, in active use by lots of people, check out PICO-8 cartidges.

    PICO-8 is a virtual game console. I.e. it's an emulator for an oldschool game console that doesn't exist in reality. It's designed to be easy to code for while maintaining the limits and aesthetics of old game computers

    PICO-8 games are, of course, distributed on cartridges. However because it's a virtual console, the cartridges are virtual too: they're PNG files.

    Try browsing PICO-8 games here: https://www.lexaloffle.com/bbs/?sub=2&cat=7

    Press the play button the play a game right inside the web browser, but be sure to click the little "Cart" link right below the playing area to see what's going on. You'll see it open a little PNG file.

    That PNG file is the cartridge. It contains the entire game.

    The file format is explained here: https://pico-8.fandom.com/wiki/P8PNGFileFormat. Obviously, because PICO-8 carts are purely digital, the format doesn't need any of the contrast, the error correction features or the orientation markers that QR-codes have. You can't take a picture of a cart with your phone and play it. You need the exact same, byte-for-byte PNG file. But it's still super cool.

  • by rob74 on 9/4/20, 2:09 PM

    Cool, so all the 1k demos/intros from Assembly (https://archive.assembly.org/2019/1k-intro) could also be distributed via QR code... the 4k intros unfortunately not. Maybe it's time for a new category ;)
  • by gitgud on 9/4/20, 3:26 PM

    I wonder if snake could fit in a data uri, like this:

    https://bytex64.net/code/datasnake/

  • by Taniwha on 9/5/20, 2:23 AM

    I crossed my eyes and stared for ages, still could not see the snake, I hate these magic eye things
  • by MStrehovsky on 9/4/20, 2:04 PM

    Here's another Snake game that can fit in a QR code, this one written in C#: https://twitter.com/MStrehovsky/status/1214955696556515331

    (It doesn't need a .NET runtime; it's fully self-contained and runs on Windows as a native app.)

  • by kevincox on 9/4/20, 3:17 PM

    I wish more QR-scanners supported data URLs. I think it would be very cool to distribute tiny web-apps via QR code.
  • by squid_demon on 9/4/20, 4:24 PM

    Don't worry. There is no malicious code contained within this QR code!
  • by outadoc on 9/4/20, 2:03 PM

    Too bad virtually no one will flash it using a Windows device.
  • by bovermyer on 9/4/20, 1:58 PM

    Might be interesting to print this on business cards and distribute at conventions or something like that.
  • by aarondf on 9/4/20, 8:35 PM

    If you want to play snake in Excel, you can do that too!

    https://aaronfrancis.com/2013/remaking-cellphone-snake-in-mi...

  • by fiatjaf on 9/4/20, 3:24 PM

    I'm still waiting for someone to make an app that encodes and decodes large data into multiple QR codes that are displayed in a moving sequence.

    That would be the best way to transfer files in physical locations.

  • by ariasemi on 9/4/20, 10:09 PM

    Really cool!

    He also made a video about it: https://www.youtube.com/watch?v=ExwqNreocpg

  • by pxi on 9/5/20, 8:10 AM

    It's a cool idea. Here's another one; a Mira fractal generator in SmallBASIC:

    https://smallbasic.github.io/images/screenshots/mira.bas.png

  • by brassattax on 9/4/20, 2:04 PM

    I was looking for the snake in the QR code itself (and found it!) before reading the article
  • by tgsovlerkhgsel on 9/4/20, 7:20 PM

    The HTML5 version converted to a data URL would be a more accessible demo than a windows executable I think, especially if it supported mobile input.

    Unfortunately, scanning large QR codes doesn't seem to work too well in practice :(

  • by agumonkey on 9/4/20, 3:24 PM

    a new vector emerges
  • by captn3m0 on 9/4/20, 2:35 PM

    Am I the only one who thought this would be a game with the roaming around inside a QR code?
  • by qwertox on 9/4/20, 8:29 PM

    Initially I was looking at the QR-code and thinking about punchcards, code golf and javascript, but reading that it contains a Windows executable was a surprise.
  • by inlined on 9/4/20, 2:30 PM

    Am I the only one unwilling to run a non-sandboxed process I found on a tech demo?