During my senior year of high school, I took an independent study course in C++. Originally it had been a full fledged C++ course, but since only 4 students signed up, the school put us all in its independent study program instead. The program worked by allowing students to work by themselves to create a project, and at the end of the semester each student would present their project to a committee to show that they had actually learned something.
On the surface it seemed like a great program, but the school did its hardest to keep us from learning anything. The lady in charge of the program forbid us from using the computers that had C++ compilers, claiming they were “too old”, and we weren’t allowed to install anything on the computers we did have access to.
At first we were resilient and installed compilers we found online anyway. But getting caught got us in a lot of trouble, and this lady was mean – at one point yelling at me for a solid 20 minutes for breaking one of her rules. This environment wore us down, and eventually we resided ourselves to knowing that we weren’t going to efficiently learn anything about C++ while we were at school, so we used a lot of our time to goof off.
It was during this time that I discovered the game of Snake. When I was tired of reading up on programming or dealing with crap from the lady in charge of the computer lab, I’d blow off steam by playing online games. Sometimes I’d spend the whole hour and a half period playing games. Of these games, Snake ended up being my favorite. I honestly sucked at it then and still suck at it now, but it was pretty mindless and actually pretty fun.
A few days ago, while working on some other JavaScript project for this site, I randomly started thinking about these olden days. After remembering how much I loved Snake I thought to myself “Hrm, I bet I could write a version of Snake entirely in JavaScript”. Since Snake is such a simple game, I decided to run with the idea and try and crank out a JavaScript version as quick as possible. You can see what I’ve got so far by following the below link:
http://patorjk.com/games/snake
That is fresh from my hard drive, and it’s a really bare bones version. I hope to add a couple more features and to optimize it some over the next week. Since JavaScript is interpreted, the game may be a little jumpy on some of your computers (let me know if you have any major problems). When it’s totally done I’ll probably also post the source as a JavaScript example. You could peak at it right now if you wanted, but it’s in a not-ready-for-prime-time state right now.
As an aside, under the hood the snake is a linked list. I googled “JavaScript linked list” for some quick linked list code and came across this link, which is actually pretty nifty. It’s worth a look if it’s been a while since you’ve done anything with linked lists.
TAAG
TAAG was updated with a couple of fonts (they all start with “JS”) and I fixed up the feature that allows you to share messages you create with others.