Given the topology of land in ASCII picture format, figure out where lakes would go and fill them in. Assume an infinite amount of rain.
example
input
#
##
# ####
# #########
## ###########
## ############# ####
## ############## #####
################# #######
#########################
#########################
output
#
##
#@####
#@@@@#########
##@@###########
##@#############@@@####
##@##############@@#####
#################@#######
#########################
#########################
The input will contain only spaces and # marks. Each line will be the same length. The output should be the identical # pattern with spaces where water would accumulate filled in with @ marks.
The bottom input row will always be all # marks. There will be no holes or overhangs in the land. Shortest code wins.
@that were filled in. – mellamokb May 12 '11 at 20:53([char[]]"$a"-eq'@').Counthere. Not that much too add. Agreed on this being a little too easy, though. Doesn't fall into the realm of what I'd downvote, though. – Joey May 12 '11 at 20:55