DailyJS

You are a Robot...

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

tutorials javascript games

You are a Robot...

Posted by Alex R. Young on .
Featured

tutorials javascript games

You are a Robot...

Posted by Alex R. Young on .
That smiling face is you.

You are a robot, that smiling face represents you.

My digital residual self image isn't what it once was, but surely I'm more than a smiling face glyph! JS Robot by Pavel Evsegneev an open source game for learning JavaScript. The GitHub repository is here: Ahineya / jsrobot.

The levels are unit tested with Mocha, and the author accepts pull requests for new levels. Levels are defined as text files, like this:

########
#_  $f #
########

The _ is the start position, $ and # are walls, and f is the finish. The player must write JavaScript that pushes the robot to the f position. The full list of symbols is defined in map.js:

var SYMBOL_TYPES = {  
  '#': 'wall',
  '$': 'wall',
  'space': 'space',
  '_': 'start',
  'f': 'finish'
};

It's a fun game that may have a few surprises for beginners learning JavaScript, and the code is clean. You could easily extend it to have fancier graphics or a different narrative, but I like the text-based interface. It would be nice to optionally play it in a terminal by installing it with npm.