Common Lisp, 488 420416
(lambda(z)(dotimes(r 3)(map()(lambda(c)(do((i 0(+ 17 i))n)((or(and(> i 918901)(setf n 146))(=(char-code c)(ldb(byte 8 9)(setf n(ldb(byte 17 i)#36R1G82YLCJU3YUURSA2A36SXGDRXAQCX0WCXKXEBGT5GCMKUH3SUIICNXBQXJV9PUCN61AEE2O0VKPHU88EXAHSEW0P3V2H3Q6OYZ1Y18QMZPNG8ZSK6ORMIYWVG5E65YRLPAV2G4XEETBGYXLJ2RGXICOG2TPNALXEH84W6SFZZD0KHS0Z6#36RIL884OIVFXJY4DCQ0O8DPH8MOMR2DSLPP3O4ESYHS234A9HEQYSV8IBDBZI6Z3C3MCVR77OYD3QN5G6CX2UQWGL4UY5R9PKYI1JQ5Y6DC27MQQGUZSCGI8Q9JCYP9N1L4YYKRWM1ZNMSVTSB4792UUWV6Z3906VSP981WCCBMDNJ02)))))(loop for v from(* 3 r)for d across"!_!"do(format t"~:[ ~;~A~]"(logbitp v n)d)))))z)(terpri)))
Example
With "abcdefg'hijKlnopqrstuz""abcdefg'hijklnopqrstuz"
, prints:
_ _ _ _ _ ! _ _ _ _ _
!_!!_ _ _!!_ !_ ! _ !_ ! ! _ ! _ _ !_!!_! _ !_ !_ _!
! !!_!!_ !_!!_ ! !_! _ ! ! !!_! _ !_ ! !!_!! !! _!!_ !_!!_
Remarks
Characters and their representations are encoded in this number in base 36:
#36R1G82YLCJU3YUURSA2A36SXGDRXAQCX0WCXKXEBGT5GCMKUH3SUIICNXBQXJV9PUCN61AEE2O0VKPHU88EXAHSEW0P3V2H3Q6OYZ1Y18QMZPNG8ZSK6ORMIYWVG5E65YRLPAV2G4XEETBGYXLJ2RGXICOG2TPNALXEH84W6SFZZD0KHS0Z6IL884OIVFXJY4DCQ0O8DPH8MOMR2DSLPP3O4ESYHS234A9HEQYSV8IBDBZI6Z3C3MCVR77OYD3QN5G6CX2UQWGL4UY5R9PKYI1JQ5Y6DC27MQQGUZSCGI8Q9JCYP9N1L4YYKRWM1ZNMSVTSB4792UUWV6Z3906VSP981WCCBMDNJ02
The binary representation of this digit is divided in groups of 17 bits.
For example, the last group of 17 bits is 110000111101010
, which is decomposed here in two parts:
110000
, the char-code of character0
111101010
, an encoding of the drawing, best represented as follows:010 (bits 0-2) _ 101 (bits 3-5) => ! ! 111 (bits 6-8) !_!
Bits in first and last "column" are for
!
characters, the ones in the middle column for the_
character. When necessary, both uppercase and downcase versions of a character are stored.
The function iterates three times over the input string, one for each line of output, searches for a matching character in the table (or defaults to 146, a.k.a. three bars), and prints the representation at current row.