A simple guessing game diving into NodejsAugust 23, 2014
I first heard about Node.js (Nodejs) on the Changelog podcast in early 2010 and I have been looking at Nodejs now and then for the past four years and I have never really taken the time to sit down and use it. When I have taken the time I never found any good use case or an interesting project to build on top of Nodejs or maybe more importantly, why I should use Nodejs in the first place. Which problem does it solve? For me, none really. There is a lot to be said about Nodejs and projects that are built with Nodejs as a platform.
My first project is a version of the classic Guess the number game where you have to guess a number between 1 and 100. This game is a popular assignment when you start out learning a programming language so I thought it would be a great exercise to take on and it was! I had a lot of fun building this game and make it run on Nodejs. I did not dabble to deep in the readline module and relayed on console.log for output text to terminal and the readline question method to receive input from the user. I’m quite happy with the result and I will most likely polish and comment the code over the coming weeks.
You can find the game which I’ve named Guess100 in its current state over at my GitHub account. It is fully functional and I consider this a 1.0 release. If you want to improve it or has any kind of feedback or comments, don’t hesitate to make a pull request or start a discussion using the Disqus comments below. I have a few other projects lined up as I’ve taken on the learn BackboneJS as well and I think Nodejs will come in handy in many ways both as tool and as a server side technology.