Reflections in Water Take a string as input. This string can be as long as you'd like, however, it may only include letters and spaces––no numbers, punctuation, etc. When a word is passed into your function, an image will be made out of it. This image is the input word written out using only these characters: –, /, \, and |. You do not need to use all of these characters, but you may not use any others. Only words are inputed; no numbers or any other characters.

Here are a couple examples:

Input : "String"

Return : 

 –––    –––    –––   –––  |\    |   –––
|        |    |   |   |   | \   |  |
 –––     |    |–––    |   |  \  |  | ––
    |    |    |   \   |   |   \ |  |   |
 –––     |    |    \ –––  |    \|   –––     //uppercase string written out
––––––––––––––––––––––––––––––––––––––––    //bar
                                            //line break
 –––     |    |    / –––  |    /|   –––
    |    |    |   /   |   |   / |  |   |
 –––     |    |–––    |   |  /  |  | ––
|        |    |   |   |   | /   |  |
 –––    –––    –––   –––  |/    |   –––     //uppercase string written upside-down (reflected)


After the all caps string written out, there is a bar and then a line break. After that, there is the same string, just mirrored/upside-down. The bar under the word spelled out should be the length of the written out string. The upside down word––the reflection––goes one line beneath the line break.

Here is another example:

Input : "hi"

Return : 

|  |  –––
|  |   |
|––|   |
|  |   |
|  |  –––
–––––––––

|  |  –––
|  |   |
|––|   |
|  |   |
|  |  -––


A bonus challenge/addition:

Add a ripple effect. Have something like a random indent between 0 and 3 spaces before each line in the reflection. Here's an example of what it could look like:

Input : "hi"

Return : 

|  |  –––
|  |   |
|––|   |
|  |   |
|  |  –––
–––––––––

 |  |  –––
 |  |   |
  |––|   |
 |  |   |
  |  |  -––


Your code should be in the following form:

function createAwesomeness(string) -&gt; string {
    let s = //your code that creates the 'image'
    return s
}

print createAwesomeness("string")
print createAwesomeness("bananas")


A couple notes:


Every language is valid
Suggestion: Do not copy the font-set as a dictionary or array because that adds a lot to your code's size. Both as a challenge and to lower your code's size, try to use a function of sorts to create the letters
Along with your code, have:


The size in bytes of your function
The number of characters of your function
The two examples

Shortest, working code wins
There is currently no deadline


If any further explanation is needed, please tell me in the comments!

Any response is welcome and greatly appreciated!
JavaScript (ECMAScript 6) (580 characters/bytes)

Probably not the best/shortest way to do this, but here's my two cents' worth:


a=x=&gt;{l=["#####","#   #","#","  #","    #","# #","#  ##","####",""],g=[0,1,1],t=[8,8,8,8,8,0,1,...g,7,1,0,1,7,0,2,2,2,0,7,1,1,1,7,0,2,0,2,0,0,2,0,2,2,0,2,0,1,...g,...g,0,3,3,3,0,0,4,4,4,...g,5,5,1,2,2,2,2,0,0,...g,1,1,1,1,6,1,...g,1,0,0,1,0,2,2,...g,6,0,0,1,0,5,1,0,2,0,4,0,0,3,3,3,3,1,1,1,1,...g,1,1,3,1,1,1,0,...g,3,1,1,1,1,0,3,3,0,4,0,2,0],s=(n,r)=&gt;l[t[5*n+r]].padRight(8),y=Array(10).fill("");for(r=-1,z=0;++r&lt;5&amp;z&lt;x.length;r==4&amp;&amp;++z?r=-1:0){c=x[z].charCodeAt()&amp;31;y[r]+=s(c,r),y[9-r]+=s(c,r)}return`${y.slice(0,5).join`
`}
${"-".repeat(y[0].length-3)}

${y.slice(5).join`
`}`}
console.log(a("string"))
console.log(a("bananas"))


Note that although this is standard ES6, this strictly requires sloppy mode (heh, get it?) which hasn't landed in all of the JS engines/transpilers yet; it'll probably be ready this winter. If anyone knows a way to run this code in a sloppy environment as of today, feel free to edit.

Well, since people still need to reproduce my output, I'll just give you the strict version that only differs in the way that it uses "let" to declare variables instead of making them globals by omitting it. Feel free to verify that I only added "let" in four places and changed nothing further. Here's the strict version that you can run today already using babel:

let a=x=&gt;{let l=["#####","#   #","#","  #","    #","# #","#  ##","####",""],g=[0,1,1],t=[8,8,8,8,8,0,1,...g,7,1,0,1,7,0,2,2,2,0,7,1,1,1,7,0,2,0,2,0,0,2,0,2,2,0,2,0,1,...g,...g,0,3,3,3,0,0,4,4,4,...g,5,5,1,2,2,2,2,0,0,...g,1,1,1,1,6,1,...g,1,0,0,1,0,2,2,...g,6,0,0,1,0,5,1,0,2,0,4,0,0,3,3,3,3,1,1,1,1,...g,1,1,3,1,1,1,0,...g,3,1,1,1,1,0,3,3,0,4,0,2,0],s=(n,r)=&gt;l[t[5*n+r]].rpad(8),y=Array(10).fill("");for(let r=-1,z=0;++r&lt;5&amp;z&lt;x.length;r==4&amp;&amp;++z?r=-1:0){let c=x[z].charCodeAt()&amp;31;y[r]+=s(c,r),y[9-r]+=s(c,r)}return`${y.slice(0,5).join`
`}
${"-".repeat(y[0].length-3)}

${y.slice(5).join`
`}`}
console.log(a("string"))
console.log(a("bananas"))


Output

The first console.log yields STRING:

#####   #####   #####   #####   #   #   #####   
#         #     #   #     #     #   #   #       
#####     #     #####     #     #   #   #####   
    #     #     # #       #     #  ##   #   #   
#####     #     #   #   #####   #   #   #####   
---------------------------------------------

#####     #     #   #   #####   #   #   #####   
    #     #     # #       #     #  ##   #   #   
#####     #     #####     #     #   #   #####   
#         #     #   #     #     #   #   #       
#####   #####   #####   #####   #   #   #####   


and the second console.log yields BANANAS:

####    #####   #   #   #####   #   #   #####   #####   
#   #   #   #   #   #   #   #   #   #   #   #   #       
#####   #####   #   #   #####   #   #   #####   #####   
#   #   #   #   #  ##   #   #   #  ##   #   #       #   
####    #   #   #   #   #   #   #   #   #   #   #####   
-----------------------------------------------------

####    #   #   #   #   #   #   #   #   #   #   #####   
#   #   #   #   #  ##   #   #   #  ##   #   #       #   
#####   #####   #   #   #####   #   #   #####   #####   
#   #   #   #   #   #   #   #   #   #   #   #   #       
####    #####   #   #   #####   #   #   #####   #####   


How it works:

My idea was to generate the the alphabet by compressing letters with respect to similar lines. Thus, every letter in the alphabet can be represented as a 5-dimensional vector of numbers that correspond to a string that again corresponds to a row in a letter.

This approach is made a lot easier when every letter has the same width, as this enables us to re-use some string patterns more effectively. With this idea in mind, I then designed a font that is optimized for similar-looking lines in letters, so that it compresses well:

#####
#   #
#####
#   #
#   #

#### 
#   #
#####
#   #
#### 

#####
#    
#    
#    
#####

#### 
#   #
#   #
#   #
#### 

#####
#    
#####
#    
#####

#####
#    
#####
#    
#    

#####
#    
#####
#   #
#####

#   #
#   #
#####
#   #
#   #

#####
  #  
  #  
  #  
#####

#####
    #
    #
    #
#####

#   #
#   #
# #  
# #  
#   #

#    
#    
#    
#    
#####

#####
#####
#   #
#   #
#   #

#   #
#   #
#   #
#  ##
#   #

#####
#   #
#   #
#   #
#####

#####
#   #
#####
#    
#    

#####
#   #
#   #
#  ##
#####

#####
#   #
#####
# #  
#   #

#####
#    
#####
    #
#####

#####
  #  
  #  
  #  
  #  

#   #
#   #
#   #
#   #
#####

#   #
#   #
#   #
#   #
  #  

#   #
#   #
#   #
#####
#####

#   #
#   #
  #  
#   #
#   #

#   #
#   #
#####
  #  
  #  

#####
    #
#####
#    
#####


=========================================

0: #####
1: #   #
2: #
3:   #
4:     #
5: # #
6: #  ##
7: ####
8: 

A = [0, 1, 0, 1, 1]
B = [7, 1, 0, 1, 7]
C = [0, 2, 2, 2, 0]
D = [7, 1, 1, 1, 7]
E = [0, 2, 0, 2 ,0]
F = [0, 2, 0, 2, 2]
G = [0, 2, 0, 1, 0]
H = [1, 1, 0, 1, 1]
I = [0, 3, 3, 3, 0]
J = [0, 4, 4, 4, 0]
K = [1, 1, 5, 5, 1]
L = [2, 2, 2, 2, 0]
M = [0, 0, 1, 1, 1]
N = [1, 1, 1, 6, 1]
O = [0, 1, 1, 1, 0]
P = [0, 1, 0, 2, 2]
Q = [0, 1, 1, 6, 0]
R = [0, 1, 0, 5, 1]
S = [0, 2, 0, 4, 0]
T = [0, 3, 3, 3, 3]
U = [1, 1, 1, 1, 0]
V = [1, 1, 1, 1, 3]
W = [1, 1, 1, 0, 0]
X = [1, 1, 3, 1, 1]
Y = [1, 1, 0, 3, 3]
Z = [0, 4, 0, 2, 0]


To further assist compression, I decided to only use number signs (#) to form letters, resulting in better compression. Another great thing about this approach is that it allows me to do a very simple reflection logic, since I'm not required to transform "\" to "/". The resulting font is exceptionally ugly, but as long as it compresses well, I really don't mind about its looks.

In the end, I managed to represent every single letter of the alphabet by using eight different patterns in total (plus one additional dummy pattern for spaces). It was in my best interest to use no more than 10 different patterns (or else I'd have to pay the price of requiring two characters to write down some numbers in the code). I then serialized all letter information in an array, added a little bit of letter selection/concatenation logic, and voilà.