This is my final project (Project 9) for the nand2tetris course! It's a Minesweeper game written in the Jack language.
nand2tetris is one of the most rewarding computer science courses I've taken. The course challenges us to build a full application (in this case, Minesweeper) using a high level language (the Jack language) compiled using a compiler we wrote ourselves, with an operating system we write ourselves, running on a hardware platform (the Hack machine) we designed ourselves, powered by a CPU we wired together ourselves. There is nothing left to "magic" and everything is built by the students down to the transistors!
I'm Bill Mei, the author of Painless CSS, and professional software developer. Hire me.
Download the nand2tetris software suite and run the script tools/VMEmulator.sh
(on Unix machines) or tools/VMEmulator.bat
(on Windows machines).
In the VMEmulator Java Applet, click on the folder icon to open a project, and then navigate to the nand2minesweeper
directory.
Click on the nand2minesweeper
folder and then click "Load Program" to load it.
Click "Yes" when it says "No implementation was found for some functions which are called in the VM code".
Set the "Animate" dropdown option to "No animation".
Finally, click on the fast forward button to run the game!
I pre-compiled the .vm
files for you in the in the nand2minesweeper
directory so you can run the game without compiling. If you would like to compile the .vm
files yourself, then use your nand2tetris software suite to run the JackCompiler to compile all the .jack
files in the nand2minesweeper
folder into .vm
files.
Use the arrow keys ←↑↓→ to move the cursor around the grid.
Press space to reveal a cell under your cursor. If you reveal a mine, it explodes, and the game is over! If you reveal a cell and it is not a mine, then a number will be shown on that cell. This number indicates the number of mines that are adjacent to that cell, in all 8 directions (horizontally, vertically, and diagonally).
Press f to plant a flag over a cell you suspect is a mine. This way, you can remind yourself which cells to avoid. Press f again to remove the flag.
Press r to restart the game at any time.
Press q to quit the game and halt execution.
MIT License