Finish folding the transparent paper according to the instructions. The manual says the code is always eight capital letters. The letters ABCDEFGHJKLOPRSUZ
are represented in the following way:
.##. ###. .##. ###. #### #### .##. #..# ..## #..# #... .##. ###. ###. .### #..# ####
#..# #..# #..# #..# #... #... #..# #..# ...# #.#. #... #..# #..# #..# #... #..# ...#
#..# ###. #... #..# ###. ###. #... #### ...# ##.. #... #..# #..# #..# #... #..# ..#.
#### #..# #... #..# #... #... #.## #..# ...# #.#. #... #..# ###. ###. .##. #..# .#..
#..# #..# #..# #..# #... #... #..# #..# #..# #.#. #... #..# #... #.#. ...# #..# #...
#..# ###. .##. ###. #### #... .### #..# .##. #..# #### .##. #... #..# ###. .##. ####
Two letters are always separated with a column that only consists of dots (.
).
What code do you use to activate the infrared thermal imaging camera system? Determine this in the following way:
Write a function dots
that takes the pathname (String
) of a text file containing a list of dots on a transparent paper, an empty line and a list of fold instructions. The function must return the code of eight capital letters (String
) that activates the infrared thermal imaging camera system.
The return value should be wrapped in the IO monad if needed.
In this interactive session we assume the text file paper.txt
1 is located in the current directory.
> dots ("paper.txt")
"RPCKFBLR"
After all fold instructions have been applied, this transparant paper looks like:
###..###...##..#..#.####.###..#....###.
#..#.#..#.#..#.#.#..#....#..#.#....#..#
#..#.#..#.#....##...###..###..#....#..#
###..###..#....#.#..#....#..#.#....###.
#.#..#....#..#.#.#..#....#..#.#....#.#.
#..#.#.....##..#..#.#....###..####.#..#