Play JavaScript Magic Square Game
This is one of my favorite JavaScript games. If you like it, click through on the
source link, or search on the game's author for more of his examples.
It's not the cleanest code I've ever seen, but then I'm one to speak. Personally, I'm more a fan of lamba style functions (ex: window.myfunctionname = function(){ /* stuff */}) because you could test for the existence of the interface, attached to a specific object before trying to call properties or methods. One of my favorite elements of this example is that the presentation details are left to CSS classes rather than specified in the JavaScript. It may seen like a dumb little detail, but my experience with JavaScript programmers is that they often try to control all of those details instead of leaving it to folks with a skillset more suited to design. (That's not to say that my example illustrates good design... it does not. But then design isn't my fortay.) Some of the other cool features of this script are that it keeps track of the number of moves and seconds elapsed. It also lets you choose the number of squares and reflows the board using some classic DHTML techniques. All in all, this is a very cool example, and an engaging game (if you enjoy puzzle games.) That said... enjoy. To start the game, either select a new level and press "Go" or click on any of the board pieces to shuffle them and start the game.
Other Sites and Related InformationLearn JavaScript through Bilbo's Examples
|
|