Minesweeper algorithm

Member
Posts: 102
Joined: 2005.01
Post: #1
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?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
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)
        }
    }
}
Quote this message in a reply
Member
Posts: 114
Joined: 2005.03
Post: #3
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.
Quote this message in a reply
Member
Posts: 102
Joined: 2005.01
Post: #4
Thanks both of you.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Requesting Help: Smooth keyframe interpolation algorithm whogben 4 4,567 Jan 5, 2009 11:15 PM
Last Post: whogben
  Depth Sorting algorithm Leroy 1 4,452 Jul 2, 2007 01:47 AM
Last Post: aegidian
  Algorithm for moving between two points on a plane... WhatMeWorry 4 4,604 Aug 23, 2005 11:36 AM
Last Post: unknown