View Full Version : Minesweeper algorithm
Know when you click on a tile that is blank in minesweeper? How it uncovers all the blank tiles and one layer of numbered tiles beyond that? Anyone know how?
OneSadCookie
2005.07.28, 08:41 PM
uncovertile(tile)
{
flip(tile)
return unless i'm a 0
for each neighbor_tile
{
if neighbor_tile ain't already flipped
{
uncovertile(neighbor_tile)
}
}
}
Cochrane
2005.07.29, 05:39 AM
You might want to look at ttp://en.wikipedia.org/wiki/Seed_fill. The code I am using is similar to the second algorithm, but much more bloated and doesn't work correctly, so I think I'm gonna use one of the ones shown there.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.