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.
For my version of the game, I started with 21 items, which results in the creation of a lot of different pages. A smaller starting number such as 10, 14, 18 would probably be advisable as my 21 items was a bit too ambitious.
As this is a course on programming, not on artwork, feel free to use third-party artwork but do try to come up with a theme. My theme was gold coins and treasure chests. If you want, feel free to use my theme. My treasure chest was from https://publicdomainvectors.org/en/free-clipart/Treasure-chest-clip-art/56364.html while my coin artwork was a scaled down version of an image by Edurs34 found at https://pixabay.com/illustrations/gold-coin-currency-dobl%C3%B3n-4844191/.
My solution to this assignment is in the next section, but some hints:
The cheat sheet for this chapter.
A brief history of HTML
What makes up a HTML file
How tags are used to create HTML elements
How to display things such as <, >, &, 😀
Linking to other pages, other sites, and within the page
Adding images and image maps to your page.
Ordered and unordered lists and nesting lists.
Tables with spanning rows and columns.
The game of NIM is the project for this chapter.
How my solution to the NIM game was put together
Solving Nim.