Alexander Bass

Rust Minesweeper WebAssembly

To learn the Rust programming language, I recreated the classic video game Minesweeper in it. Before diving into the technical details, you can play minesweeper below.

Play in fullscreen

At the time of writing, most of my programming has been done in JavaScript. I enjoy using JS but I wanted to broaden my skills. Since it’s compiled and thus promises better performance, I decided to learn the Rust Programming Language. I’m still at the point where I’m trying to shoehorn my JavaScript ideas into my Rust programs nonetheless, Rust has been a joy to use. I followed a few tutorials, but could only get so far with those, so I set out to remake a familiar game. Minesweeper was an obvious choice as I had partially remade it before in TypeScript.

I started out by recreating the game in the command line where you couldn’t click tiles, but instead had to manually type in the coordinates that you wanted to flag or reveal.

Example of the CLI version of Minesweeper I made

Entering commands to play minesweeper was cumbersome, so after finishing Command Line Minesweeper I started working on a GUI version. I settled on using Macroquad to handle the graphics and input. After a bit of finagling, I was able to adapt my CLI code to work for with a GUI version. I’m no artist, so both the English and Japanese tile sprites were made by a friend of mine.

I’ve been enjoying using Rust, and though at times it can be cumbersome I look forward to using it more in the future.

source code