35
6
Inspired by Golf me an ASCII Alphabet, of which this challenge is (almost) a direct inverse.
Task:
Take a string of ASCII-art text and output the content of the text as regular ASCII text.
Input:
String of ASCII-art text.
Input will only contain instances of ASCII character #
, spaces and 4 or 5 newlines (a trailing newline is optional). All lines have the same length. (That is, the last ASCII-art letter is padded with trailing spaces.) You can use some other printable ASCII character instead of #
in the input if you wish.
The input will contain ASCII-art letters A-Z
and ASCII-art spaces (a 5x5 block of whitespace). No punctuation. There is only one line of ASCII-art text (5 actual lines). There will be no trailing or leading ASCII-art spaces, nor will there be adjacent ASCII-art spaces.
Letter size is 5x5 characters. There is a 1x5 space between each letter. Space between words is a 5x5 block of whitespace (+ 1x5 space on each side, because it is just another letter). There will be no 1x5 space at the end or at the beginning, only between ASCII-art letters.
Output:
String containing the text as ASCII characters A-Z
+ spaces. The output can be in lowercase also, if that is somehow easier for your solution. Mixed case is also allowed.
The ASCII-art letters:
### #### ### #### ##### ##### ### # # ##### ##### # # # # #
# # # # # # # # # # # # # # # # # # ## ##
##### #### # # # #### #### # ## ##### # # ### # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # #### ### #### ##### # ### # # ##### ### # # ##### # #
# # ### #### ### #### ### ##### # # # # # # # # # # #####
## # # # # # # # # # # # # # # # # # # # # # #
# # # # # #### # # #### ### # # # # # # # # # # #
# ## # # # # # # # # # # # # # ## ## # # # #
# # ### # ## # # # ### # ### # # # # # # #####
The space:
|
| A 5x5 square of spaces.
| (Padded with |s to make it appear in this post.)
|
|
Examples:
Input:
# # ##### # # ### # # ### #### # ####
# # # # # # # # # # # # # # # #
##### #### # # # # # # # # # #### # # #
# # # # # # # ## ## # # # # # # #
# # ##### ##### ##### ### # # ### # # ##### ####
Output: HELLO WORLD
Input:
### ### ### ##### #####
# # # # # # #
##### ### # # #
# # # # # # #
# # ### ### ##### #####
Output: ASCII
Input:
#### #### ### ###
# # # # # # #
#### #### # # ##
# # # # # #
# # ### ###
Output: PPCG
This is code-golf, so the shortest answer in bytes wins.
10I'm thinking the solution to this might involve some sort of hash function... – Neil – 2017-04-07T12:20:46.073
6Bounty from me if you do this by converting the input to an image and solves this using image processing! (The solution must be golfed too of course) – Stewie Griffin – 2017-04-07T12:34:10.050
3If it's of help to anyone: either the second row, the fourth row, or the middle column of the letters can be dropped without losing relevant information. – Martin Ender – 2017-04-07T12:57:25.937
Can we take
0
instead of a space? – JungHwan Min – 2017-04-07T16:56:27.8271
@JungHwanMin Hmm. I think not, because that would not be very human-readable ASCII-art text.
– Steadybox – 2017-04-07T17:04:39.133You mention that the result may be lowercase, how about mixed case? – Jonathan Allan – 2017-04-07T19:21:17.200
Related – Digital Trauma – 2017-04-07T20:31:02.817
Is it ok to require \n for newlines instead of the newline character? – agtoever – 2017-04-07T20:31:06.120
1@JonathanAllan I guess that would be ok, too. – Steadybox – 2017-04-07T21:00:30.707
@agtoever I'd say no, because that wouldn't be very readable ASCII-art text.
– Steadybox – 2017-04-07T21:02:49.033@agtoever To be more precise about this, yes, including '\n' in a string literal in the code would be fine, as in a C string literal "line 1\nline 2", but a string including '\' and 'n' as separate characters would not be okay. – Steadybox – 2017-04-08T21:12:41.800
@agtoever If this is what you meant all along, then I misunderstood your question, sorry. – Steadybox – 2017-04-08T21:14:58.630
Do newlines have to be handled? – Magic Octopus Urn – 2017-04-11T13:35:35.620
1
@carusocomputing Like this? No.
– Steadybox – 2017-04-11T13:48:25.107