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?
Code:
uncovertile(tile)
{
flip(tile)
return unless i'm a 0
for each neighbor_tile
{
if neighbor_tile ain't already flipped
{
uncovertile(neighbor_tile)
}
}
}
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.
Thanks both of you.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Requesting Help: Smooth keyframe interpolation algorithm | whogben | 4 | 4,048 |
Jan 5, 2009 11:15 PM Last Post: whogben |
|
| Depth Sorting algorithm | Leroy | 1 | 3,997 |
Jul 2, 2007 01:47 AM Last Post: aegidian |
|
| Algorithm for moving between two points on a plane... | WhatMeWorry | 4 | 3,882 |
Aug 23, 2005 11:36 AM Last Post: unknown |
|

