407159: GYM102697 130 Minecraft Biome Finder
Description
You're playing Minecraft, and having fun exploring your world in Creative mode. Your world consists of Desert, Forest, and Taiga biomes.
You've explored some of the world, but not all of it. Thus, for some places, you know their biome, and for others, you don't. The world is given as a 2D top-down view, with some spaces ("chunks") unknown, and others with a known biome.
You especially like Taiga biomes. You've already explored at least one space that is a taiga biome, and you know that your world has exactly one taiga biome. Given this information, your task is to figure out the maximum amount of spaces (chunks) on the 2D world map that can be part of a taiga biome, and which spaces could potentially be part of the taiga biome.
Two spaces are considered part of the same biome if you can travel on the 2D grid from one space to the other, traveling on only spaces of the given biome. For example, if two spaces are both in Taiga biomes, but to travel from one to the other you are forced to cross a desert, they are not part of the same biome.
InputThe input consists of 20 lines, each containing 20 characters: the 20 by 20 world map.
If a given space is part of a Taiga biome, it will be represented by a "T" in the input file.
If a given space is part of a Desert biome, it will be represented by a "D" in the input file.
If a given space is part of a Forest biome, it will be represented by an "F" in the input file.
If you haven't explored a certain space, it will be representing as a single dot (".") in the input file.
OutputOutput 20 lines: the given input, except if any unexplored spaces (chunks) could potentially be part of a Taiga biome, change their character to a "T".
ExamplesInput.................... .................... .................... .........T.......... .................... .................... .................... .................... .................... FFFFFF.F............ ......F.F....FFFFFFF .........F.......... ..........FF........ .....DDDD....DDDD... ........DDDDDD...DDD DDDDDDDD............ .................... .................... .................... ....................Output
TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT FFFFFFTFTTTTTTTTTTTT TTTTTTFTFTTTTFFFFFFF TTTTTTTTTFTTTTTTTTTT TTTTTTTTTTFFTTTTTTTT TTTTTDDDDTTTTDDDDTTT TTTTTTTTDDDDDD...DDD DDDDDDDD............ .................... .................... .................... ....................Input
.................... .................... .................... .........T.......... .................... .................... .................... .................... .................... FFFFFF.F............ ......F.F....FFFFFFF .........F..F....... ..........FF........ .....DDDD....DDDD... ........DDDDDD...DDD DDDDDDDD............ .................... .................... .................... ....................Output
TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTT FFFFFFTFTTTTTTTTTTTT ......F.FTTTTFFFFFFF .........FTTF....... ..........FF........ .....DDDD....DDDD... ........DDDDDD...DDD DDDDDDDD............ .................... .................... .................... ....................Input
.................... .................... .........DDDD....... ........DTD...D..... ........DDDDD....... .................... .................... .................... .................... FFFFFF.F............ ......F.F....FFFFFFF .........F.......... ..........FF........ .....DDDD....DDDD... ........DDDDDD...DDD DDDDDDDD............ .................... .................... .................... ....................Output
.................... .................... .........DDDD....... ........DTD...D..... ........DDDDD....... .................... .................... .................... .................... FFFFFF.F............ ......F.F....FFFFFFF .........F.......... ..........FF........ .....DDDD....DDDD... ........DDDDDD...DDD DDDDDDDD............ .................... .................... .................... ....................