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.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more