straight line floodfill

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

Fill all tiles reachable by repeatedly walking in straight lines from the first '.' tile. You may only turn when hitting a '#' tile.

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

#######
#   # #
##    #
#.    #
##   ##
#     #
#######

Sample output:

#######
#   #.#
##   .#
#.....#
##   ##
#     #
#######

Sample input:_

####################
#  ##   #    #     #
###          ##   ##
# # #  #  .#      ##
# #  # ## #    # # #
##  ## # #      #  #
##             #   #
##      #    #     #
#   #  # # #    #  #
####################

Sample output:

####################
#  ##   #....#.....#
###..........##  .##
# #.#  #...#......##
# #. # ## # . .# #.#
## .## # #  . . # .#
## .        . .#  .#
## .    #   .#.....#
#...#  # # #....#..#
####################

Sample input:_

##############################
#  #       #    # #       # ##
###        # #   #      ## ###
# # #  # #  #       #        #
#    #   ####       #   # # ##
#       #        # #        ##
#             ####          ##
#  # ##  #      #        #   #
#               #   ##  ##   #
#   #      #      #    ##. # #
#  #     #   # # #   # #     #
#               # ## ##      #
#   #     ##                ##
#   #     # # ##   #  # #    #
#        #    ##     ###     #
#   #          #      #      #
# # #  #            #       ##
#        # #           ##   ##
#       # ###   #     #  #   #
##############################

Sample output:

##############################
#  #       #....# #.......# ##
###        #.#...# . .  ## ###
#.# #  # #  # . .  .#........#
#.   #   #### . ....#.  # #.##
#.      #........# #........##
#............ ####  .   . ..##
#. # ## .#  .   #........#...#
#.      .   .   #.  ##  ##. .#
#.  #   .  #......#    ##..#.#
#. #    .#  .# # #   # #.....#
#.      .   .   # ## ## .  ..#
#.  #   . ##................##
#.  #   . # # ##   #  # # .. #
#.      .#    ##     ###  .. #
#.  #   .      #      #   .. #
#.# #  #.           #     ..##
#........# #           ## ..##
#.......# ###   #     #  #...#
##############################

Ranking

Perl _

RankUserSizeTimeDateStatistics
1tails1570.04432011/11/14 21:56:280B / 72B / 82B

Python _

RankUserSizeTimeDateStatistics
1niisaka1840.06382011/11/09 02:36:300B / 87B / 84B

Scheme _

RankUserSizeTimeDateStatistics
1kaki2490.15152011/11/01 12:39:100B / 97B / 121B
2kaki2440.13092013/03/25 06:18:080B / 91B / 127B

J _

RankUserSizeTimeDateStatistics
1I., S.1160.09672011/11/07 06:16:450B / 28B / 77B

Language Ranking_

RankLangUserSizeScore
1JI., S.11610000
2Perltails1577388
3Pythonniisaka1846304
4Schemekaki2444754

return top