What to use it for: filling up an area in a map, example:
*****************************************************************###########################*********###########################*#*************************#*********#*************************#*#*************************##########**************************#*#*************************************************************#*#*************************************************************#*#*************************************************************#*#*****############********************************************#*#*****#**********#********###########*************************#*#*****#*#########*********#*********#*************************#*#*****#*#*****************#*********#*************************#*#*****#*#*****************#*********#*************************#*#*****#*#*****************#*********#*************************#*#*****#*#*****************#*********#*************************#*#*****#*#*****************#*********#*************************#*#*****#*#*****************#*********#*************************#*#*****#*#*****************#*********#*************************#*#*****#*#********#########**********#*************************#*#*****#*#********#******************#*************************#*#*****#*#********#******************#*************************#*#*****#*#********#******************#*************************#*#*****#*#********#******************#*************************#*#*****#*#********#******************#*************************#*######**#########*******************##########################*
What not to use it for: filling up a map which is not limited by walls
Why you should use it: because it's very compact and quick; can also be optimalised very effectively using the stack in combination with in-line assembly
Problems with using it: none
How to use:
void fill(unsigned int x, unsigned int y){ if(map[x][y] == '*'){ map[x][y] = '#'; fill(x-1,y); fill(x+1,y); fill(x,y-1); fill(x,y+1); }}
For a how-it-works and more information, see:
http://www.gamedev.net/community/forums/topic.asp?topic_id=291495
Bas