Live data from Hacker News

Snakisms

pippinbarr.github.io

21–30 of 148 posts

Re: Snakisms

#23

Great game, but why does it consume soooo much CPU?

JavaScript, probably.

More serious answer: it's using HTML5 canvas, which is quite inefficient as rendering APIs go. For example, if you use n colours when rendering a frame, and your game runs at m frames per second, you are invoking the browser's CSS parser n×m times a second, because CSS colour strings are the only way to express colours, and it is an exclusively immediate-mode API.

The engine in use might be layering on top additional inefficiencies.

(I love how easy to use HTML5 canvas is, but its CPU usage, performance and power consumption properties make me want to cry.)

Re: Snakisms

#24
post #9

I have no idea what this is, as the entire page just shows up as completely blank to my screen reader. Guessing some sort of game.

It's little games based on Snake for various "isms":

For a couple of examples, the dualism version says "Arrows control snake body. Mind controls snake mind." and utilitarianism gives you two dead-end paths, one with 1 food and one with 5 food. Stoicism lets you run into walls and just sit there without losing.

Re: Snakisms

#25

Is there an online gorilla.bas :-) ?

Funny you should ask. I translated it to Javascript a few months ago, fixing a couple of bugs in the original game in the process[1]: http://www.kylem.net/stuff/gorilla/gorilla.html

[1] and surely introducing a couple bugs of my own. I almost got it pixel-perfect, but I couldn't figure out QBasic's arc-drawing algorithm! (And the "slow rendering" is artificial delays. Because whole frames are drawn at a time with HTML5, you have to do something on purpose to get the slow city drawing effect.)

Post reply on HN