48
5
Hodor is a slow-minded but endearing character on the show Game of Thrones (he's in the books as well of course). The only word he ever says is 'hodor'.
Surprisingly, despite not having much of a vocabulary, Hodor always speaks in complete sentences with correct capitalization and punctuation, and does in fact convey meaning.
Hodor is capable of expressing all 128 ASCII characters, though it takes him an entire sentence to say each one. Each character has a single, exact representation as a sentence. An ASCII string is Hodorized by translating all the characters in the string to their Hodor sentence equivalents, then joining all the sentences. Since all characters map to exact sentences, all ASCII strings have a single, unique Hodorized representation.
Hodorizing Characters
Hodor divides his 128 expressible characters into 4 sets of 32 by using 4 different types of punctuation for the sentences that represent characters.
The sentence ends with...
.
if the ASCII character code mod 4 is 0..[newline][newline]
(for a new paragraph) if the code mod 4 is 1.?
if the code mod 4 is 2.!
if the code mod 4 is 3.
For example, the ASCII character code for b
is 98, and 98 mod 4 is 2, so Hodor's sentence for b
is sure to end in ?
.
The content of the sentence is one of 32 distinct strings only containing the word 'hodor'. Each of the 32 characters of a particular punctuation type map to a different sentence content string. So with 32 sentence content strings and 4 punctuation types, all 128 ASCII character can be represented as distinct Hodor sentences.
To determine the sentence content for a character with ASCII code C, compute (floor(C / 4) + 16) mod 32
; everything after the colon on that line in this list is the sentence content:
0:Hodor
1:HODOR
2:Hodor hodor
3:Hodor, hodor
4:Hodor hodor hodor
5:Hodor, hodor hodor
6:Hodor hodor hodor hodor
7:Hodor hodor, hodor hodor
8:Hodor hodor hodor hodor hodor
9:Hodor hodor, hodor hodor hodor
10:Hodor hodor hodor hodor hodor hodor
11:Hodor hodor hodor, hodor hodor hodor
12:Hodor hodor hodor hodor hodor hodor hodor
13:Hodor hodor hodor, hodor hodor hodor hodor
14:Hodor hodor hodor hodor hodor hodor hodor hodor
15:Hodor hodor hodor hodor, hodor hodor hodor hodor
16:Hodor hodor hodor hodor hodor hodor hodor hodor hodor
17:Hodor hodor hodor hodor, hodor hodor hodor hodor hodor
18:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor
19:Hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor
20:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor
21:Hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor
22:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor
23:Hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor
24:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor
25:Hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor
26:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor
27:Hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor
28:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor
29:Hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor hodor
30:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor
31:Hodor hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor hodor
It can be seen that, apart from the HODOR
special case, these strings are generated by joining more and more hodor
's, and every other string has a comma halfway between all the words (with the "larger half" right of the comma for an odd number of words).
Joining sentence content with punctuation, we can form the Hodor sentences for all 128 characters (the number on the left is the character code):
0:Hodor hodor hodor hodor hodor hodor hodor hodor hodor.
1:Hodor hodor hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
2:Hodor hodor hodor hodor hodor hodor hodor hodor hodor?
3:Hodor hodor hodor hodor hodor hodor hodor hodor hodor!
4:Hodor hodor hodor hodor, hodor hodor hodor hodor hodor.
5:Hodor hodor hodor hodor, hodor hodor hodor hodor hodor.[newline][newline]
6:Hodor hodor hodor hodor, hodor hodor hodor hodor hodor?
7:Hodor hodor hodor hodor, hodor hodor hodor hodor hodor!
8:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.
9:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
10:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor?
11:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor!
12:Hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor.
13:Hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor.[newline][newline]
14:Hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor?
15:Hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor!
16:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.
17:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
18:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor?
19:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor!
20:Hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor.
21:Hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor.[newline][newline]
22:Hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor?
23:Hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor!
24:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.
25:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
26:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor?
27:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor!
28:Hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor.
29:Hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor.[newline][newline]
30:Hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor?
31:Hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor!
32:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.
33:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
34:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor?
35:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor!
36:Hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor.
37:Hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
38:Hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor?
39:Hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor!
40:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.
41:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
42:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor?
43:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor!
44:Hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor.
45:Hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
46:Hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor?
47:Hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor!
48:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.
49:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
50:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor?
51:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor!
52:Hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor hodor.
53:Hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
54:Hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor hodor?
55:Hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor hodor!
56:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.
57:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
58:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor?
59:Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor!
60:Hodor hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor hodor.
61:Hodor hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
62:Hodor hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor hodor?
63:Hodor hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor hodor!
64:Hodor.
65:Hodor.[newline][newline]
66:Hodor?
67:Hodor!
68:HODOR.
69:HODOR.[newline][newline]
70:HODOR?
71:HODOR!
72:Hodor hodor.
73:Hodor hodor.[newline][newline]
74:Hodor hodor?
75:Hodor hodor!
76:Hodor, hodor.
77:Hodor, hodor.[newline][newline]
78:Hodor, hodor?
79:Hodor, hodor!
80:Hodor hodor hodor.
81:Hodor hodor hodor.[newline][newline]
82:Hodor hodor hodor?
83:Hodor hodor hodor!
84:Hodor, hodor hodor.
85:Hodor, hodor hodor.[newline][newline]
86:Hodor, hodor hodor?
87:Hodor, hodor hodor!
88:Hodor hodor hodor hodor.
89:Hodor hodor hodor hodor.[newline][newline]
90:Hodor hodor hodor hodor?
91:Hodor hodor hodor hodor!
92:Hodor hodor, hodor hodor.
93:Hodor hodor, hodor hodor.[newline][newline]
94:Hodor hodor, hodor hodor?
95:Hodor hodor, hodor hodor!
96:Hodor hodor hodor hodor hodor.
97:Hodor hodor hodor hodor hodor.[newline][newline]
98:Hodor hodor hodor hodor hodor?
99:Hodor hodor hodor hodor hodor!
100:Hodor hodor, hodor hodor hodor.
101:Hodor hodor, hodor hodor hodor.[newline][newline]
102:Hodor hodor, hodor hodor hodor?
103:Hodor hodor, hodor hodor hodor!
104:Hodor hodor hodor hodor hodor hodor.
105:Hodor hodor hodor hodor hodor hodor.[newline][newline]
106:Hodor hodor hodor hodor hodor hodor?
107:Hodor hodor hodor hodor hodor hodor!
108:Hodor hodor hodor, hodor hodor hodor.
109:Hodor hodor hodor, hodor hodor hodor.[newline][newline]
110:Hodor hodor hodor, hodor hodor hodor?
111:Hodor hodor hodor, hodor hodor hodor!
112:Hodor hodor hodor hodor hodor hodor hodor.
113:Hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
114:Hodor hodor hodor hodor hodor hodor hodor?
115:Hodor hodor hodor hodor hodor hodor hodor!
116:Hodor hodor hodor, hodor hodor hodor hodor.
117:Hodor hodor hodor, hodor hodor hodor hodor.[newline][newline]
118:Hodor hodor hodor, hodor hodor hodor hodor?
119:Hodor hodor hodor, hodor hodor hodor hodor!
120:Hodor hodor hodor hodor hodor hodor hodor hodor.
121:Hodor hodor hodor hodor hodor hodor hodor hodor.[newline][newline]
122:Hodor hodor hodor hodor hodor hodor hodor hodor?
123:Hodor hodor hodor hodor hodor hodor hodor hodor!
124:Hodor hodor hodor hodor, hodor hodor hodor hodor.
125:Hodor hodor hodor hodor, hodor hodor hodor hodor.[newline][newline]
126:Hodor hodor hodor hodor, hodor hodor hodor hodor?
127:Hodor hodor hodor hodor, hodor hodor hodor hodor!
([newline]
's are to be replaced with actual newlines.)
Hodorizing Strings
Hodorizing a string really just involves concatenating all the character sentences of the string's characters together. There are only a couple caveats:
- A space is inserted after every sentence except for the
.[newline][newline]
punctuated ones and the very last sentence. - If the last sentence is punctuated with
.[newline][newline]
, the punctuation becomes...
so there is no trailing whitespace.
Examples
The string F0
is Hodorized as
HODOR? Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor.
F
has ASCII code 70. 70 mod 4 is 2, so the first sentence ends in?
.(floor(70 / 4) + 16) mod 32
is 1 so the content isHODOR
.0
has ASCII code 48. 48 mod 4 is 0, so the second sentence ends in.
.(floor(48 / 4) + 16) mod 32
is 28 so the content is 15hodor
's strung together with no comma.- Notice that there is no trailing space.
The string CEE
is Hodorized as
Hodor! HODOR.
HODOR...
- Notice that there is no space before the last sentence.
- Notice that the the last sentence punctuation was changed to
...
.
The string
Hodor's real name is Walder.
Did you know?
is Hodorized as
Hodor hodor. Hodor hodor hodor, hodor hodor hodor! Hodor hodor, hodor hodor hodor. Hodor hodor hodor, hodor hodor hodor! Hodor hodor hodor hodor hodor hodor hodor? Hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor! Hodor hodor hodor hodor hodor hodor hodor! Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor. Hodor hodor hodor hodor hodor hodor hodor? Hodor hodor, hodor hodor hodor.
Hodor hodor hodor hodor hodor.
Hodor hodor hodor, hodor hodor hodor. Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor. Hodor hodor hodor, hodor hodor hodor? Hodor hodor hodor hodor hodor.
Hodor hodor hodor, hodor hodor hodor.
Hodor hodor, hodor hodor hodor.
Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor. Hodor hodor hodor hodor hodor hodor.
Hodor hodor hodor hodor hodor hodor hodor! Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor. Hodor, hodor hodor! Hodor hodor hodor hodor hodor.
Hodor hodor hodor, hodor hodor hodor. Hodor hodor, hodor hodor hodor. Hodor hodor, hodor hodor hodor.
Hodor hodor hodor hodor hodor hodor hodor? Hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor? Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor? HODOR. Hodor hodor hodor hodor hodor hodor.
Hodor hodor, hodor hodor hodor. Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor. Hodor hodor hodor hodor hodor hodor hodor hodor.
Hodor hodor hodor, hodor hodor hodor! Hodor hodor hodor, hodor hodor hodor hodor.
Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor. Hodor hodor hodor hodor hodor hodor! Hodor hodor hodor, hodor hodor hodor? Hodor hodor hodor, hodor hodor hodor! Hodor hodor hodor, hodor hodor hodor hodor! Hodor hodor hodor hodor hodor hodor hodor hodor, hodor hodor hodor hodor hodor hodor hodor hodor!
(assuming the newline is a single \n
)
Challenge
Write a program or function that takes in an ASCII string and Hodorizes it, printing or returning the resulting string. Take input in any standard way (from text file, command line, stdin, function arg).
The solution with the fewest bytes wins. Tiebreaker is earlier post. (Handy byte counter.)
1This challenge makes me want to re-watch seasons 1-4 and discover what he's really saying. :D – mbomb007 – 2015-04-16T16:22:28.503
24
Great, we found the next version of Ook.
– ASCIIThenANSI – 2015-04-16T17:56:10.9978Hodor hodor. Hodor hodor hodor, hodor hodor hodor! Hodor hodor, hodor hodor hodor. Hodor hodor hodor, hodor hodor hodor! Hodor hodor hodor hodor hodor hodor hodor? Hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor hodor... – Adam Davis – 2015-04-16T20:40:21.863
1@AdamDavis Hodorception! – Martin Ender – 2015-04-16T21:11:51.730
1
I would answer this question with HODOR but I think I may crash SE.
– caird coinheringaahing – 2017-04-05T17:48:27.313