DEV Community

Add00
Add00

Posted on • Edited on

Minesweeper Progress

Greetings,

Last time, I was working on my plans for developing a Minesweeper clone for the litcanvas engine. Like any plan for a programming project it had to be modified along the way as their was many unique technical challenges I did not think about when originally planning it.

For example one problem I didn't realize I had to face was the fact that the engine did not have away to detect right clicks on the mouse. Since I needed to inputs one for revealing mines and another for placing flags. My solution was to track how long the user was clicking for and if it was a long press a flag would be placed otherwise it was a short press and the square could be revealed.

Another issue that I had to find a solution for was how to reveal all tiles which had zero mines as a neighbor. Originally, I wanted to develop a loop based approach for finding all of the neighboring squares. However, if there is a loop based approach I could not get it to work, so I switched to a recursive algorithm which would check each square and each of that squares' neighboring until it found one boarding a mine.

With the fundamental parts of the game complete I now need to work on a way of displaying the game in a visually interesting way and to communicate actions between different parts of the program.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free