I don't actually know the rules for minesweeper, so I'm having trouble constructing an answer for you.
I also haven't written Java in many years. So, I hope you understand what I write below.
For your recursion, you need one main function that calls a helper recursive function. In the end you should be getting a list of objects that will help you detonate tiles over time.
void detonateHelper(int x, int y, SomeList<> detonationList)
TilePosition tpos(x, y);
// here we can check if there are any particular reasons to not detonate this area (i don't know what this function is supposed to do)
// here we can check whether the position (x, y) is out of range, for example via a isValid() function in tpos:
if (tpos.isValid() == false) return;
// if we can't add this particular position to our detonation list, we exit
if (detonationList.contains(tpos)) return;
// try all the different directions we can detonate in
detonateHelper(x+1, y, detonationList);
detonateHelper(x-1, y, detonationList);
detonateHelper(x, y+1, detonationList);
detonateHelper(x, y-1, detonationList);
SomeList<TilePosition> detonate(int x, int y)
SomeList<TilePosition> detonationList = new JavaBS;
detonateHelper(x, y, detonationList);
Using the detonationList you can now create a cool detonation animation that happens over time.
Note that the detonation will happen in a very specific order, which you can change by adding a depth-value to the object you store in your list.
You can then sort your list by depth, so that the explosion could happen outwards.
Alternatively you can create your list as a tree, by having each helper function return a list. Then as your helpers find subtrees, you will eventually have a full grown tree that you can explode outwards in any tree-iterative fashion you want. Pretty nifty.
Edited by Kaptein, 12 May 2014 - 07:59 PM.