I’m trying to make a vista minesweeper clone. Right now my uncover algorithm is the cascade algorithm. It kind of looks like a square that gets bigger and bigger. I noticed in vista mnesweeper, when its gameover, it iterates through the game in a circular manner to uncover the mines. Does anyone know what this algorithm is called? Thanks
Share
The closest official name I could find for the algorithm you describe is the “Rectangular Spiral Search”, which is an algorithm that output the path to follow to fully scan a grid in an spiral manner.
A simple algorithm for a clockwise scan of a square grid of size (2N + 1)^2, N > 0 would look like this:
(Assuming the coordinate (0,0) of the grid to be at the bottom left corner of the grid)
For (2N)^2 sized and non-square grids, you must adjust the first 3 steps.
An implementation for square grids is available for Perl in the Spiral object of the Array-Tour module.