Writing a Snake Game for the Terminal in Object-Oriented JavaScript (Node.js)
Usually when you think of a JavaScript game, you probably imagine something played in the browser, either rendered to the DOM or in an HTML5 canvas element.
For a recent Node.js project, I wanted to render pixels to a terminal interface instead of a browser. For this, I was going to need to find and learn how to use a terminal UI library like curses. The most popular one in the JavaScript environment is blessed.
I thought writing the classic Snake game would be a fun and easy project to get used to blessed, so I wrote 🐍 Snek.js.
The source code makes a point of separating the game logic from the user interface, so all the I/O (key input, pixel drawing output) is done through the interface, which would make it easy to extend to be used for web, too!