Spelchan.com Logo



The project for chapter 2 is the game of NIM. As with all projects in this book, the reference version that I create only uses the material and concepts that have been covered up to this point. As this chapter is the first programming-related chapter in the book, there is not much so the game is necessarily primitive. The game is rather ugly due to the lack of any CSS, and since we have not covered JavaScript yet, we are very restricted with what we can accomplish. Just using links is surprisingly powerful, but as you add more states to a game the number of pages needed to be created blows up very quickly. Still, creating a game with only HTML is possible.


NIM is an older game that is often used in math class to teach some logic skills. There are many variants of the game but for this version, your goal is to get the treasure chest. Each turn you must take at least 1 item but can take up to 3. The computer then gets its turn to do likewise. The winner is the player to grab the chest.

Play the game