Skip to main content
Notice removed Reward existing answer by Bubbler
Bounty Ended with emanresu A's answer chosen by Bubbler
Notice added Reward existing answer by Bubbler
Bounty Started worth 100 reputation by Bubbler
Notice removed Reward existing answer by Razetime
Bounty Ended with emanresu A's answer chosen by Razetime
Notice added Reward existing answer by Razetime
Bounty Started worth 100 reputation by Razetime
Notice removed Canonical answer required by zoomlogo
Bounty Ended with Razetime's answer chosen by zoomlogo
Notice added Canonical answer required by zoomlogo
Bounty Started worth 50 reputation by zoomlogo
Tweeted twitter.com/StackCodeGolf/status/1421259333099261958
added 76 characters in body
Source Link
emanresu A
  • 44.2k
  • 5
  • 100
  • 240

\:

You may take input as a list of lines, a matrix of characters, whatever.

\:

You may take input as a list of lines, a matrix of characters, whatever.

Became Hot Network Question
Source Link
emanresu A
  • 44.2k
  • 5
  • 100
  • 240

Enlarge ASCII art, Mark II

Related

Given a piece of ascii art and a factor to enlarge it by, which will always be an odd number >1, replace each character with the corresponding ascii-art, resized to fit on a grid the size of the input number:

\:

Character What to do
\
\  
\
\
A line of \ to the length of the enlarging factor, padded to form a line.
/
  /
/
/
A line of / to the length of the enlarging factor, padded to form a line.
|
 | 
|
|
A line of | to the length of the enlarging factor, centred horizontally.
-
   
---
A line of - to the length of the enlarging factor, centered vertically.
_
   

___
A line of _ to the length of the enlarging factor, at the bottom of the square it's in.

And of course, a space should be resized to a n-by-n grid of spaces. The input will only contain these six characters, plus newlines.

This is a bit confusing, so here's an example:

-\
 /, 3 =>
   \  
--- \ 
     \
     /
    / 
   /  

Because each character is enlarged to size 3.

Any trailing whitespace is allowed.

Scoring

This is , shortest wins!

Testcases

\, 3 =>
\
 \
  \

---, 3 =>
         
---------
         

|
|
|, 3 =>
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 

|\_/|
|   |
 \_/ , 3 =>
 | \       / | 
 |  \     /  | 
 |   \___/   | 
 |           | 
 |           | 
 |           | 
   \       /   
    \     /    
     \___/     

_____
\   /
/   \
\___/, 3 => 
               
               
_______________
\             /
 \           / 
  \         /  
  /         \  
 /           \ 
/             \
\             /
 \           / 
  \_________/  

  /\  
 /  \ 
/____\
  ||  
  ||  
_/__\_, 3 => 
        /\        
       /  \       
      /    \      
     /      \     
    /        \    
   /          \   
  /            \  
 /              \ 
/  ____________  \
       |  |       
       |  |       
       |  |       
       |  |       
       |  |       
       |  |       
     /      \     
    /        \    
___/  ______  \___

\/
\/, 5 =>
\        /
 \      / 
  \    /  
   \  /   
    \/    
\        /
 \      / 
  \    /  
   \  /   
    \/    

/-/
\-\, 7 => 
      /             /
     /             / 
    /             /  
   /   -------   /   
  /             /    
 /             /     
/             /      
\             \      
 \             \     
  \             \    
   \   -------   \   
    \             \  
     \             \ 
      \             \

 _   _ 
/ \_/ \
| | | |
|_| |_|, 11 => 
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
           ___________                                 ___________           
          /           \                               /           \          
         /             \                             /             \         
        /               \                           /               \        
       /                 \                         /                 \       
      /                   \                       /                   \      
     /                     \                     /                     \     
    /                       \                   /                       \    
   /                         \                 /                         \   
  /                           \               /                           \  
 /                             \             /                             \ 
/                               \___________/                               \
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |                     |                     |                     |     
     |     ___________     |                     |     ___________     |     

                       __    __   __             __  ___
  /\  /\    |  |\  |  |     /    |  |     /\    |     | 
 /  \/  \   |  | \ |  |--  |     |--\    /__\   |--   | 
/        \  |  |  \|  |__   \__  |   \  /    \  |     | , 5 =>
                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                        
                                                                                                                   __________                    __________               __________                                                                 __________          _______________
              /\                  /\                          |              |  \                |              |                               /                      |              |                               /\                          |                             |       
             /  \                /  \                         |              |   \               |              |                              /                       |              |                              /  \                         |                             |       
            /    \              /    \                        |              |    \              |              |                             /                        |              |                             /    \                        |                             |       
           /      \            /      \                       |              |     \             |              |                            /                         |              |                            /      \                       |                             |       
          /        \          /        \                      |              |      \            |              |                           /                          |              |                           /        \                      |                             |       
         /          \        /          \                     |              |       \           |              |                        |                             |            \                            /          \                     |                             |       
        /            \      /            \                    |              |        \          |              |                        |                             |             \                          /            \                    |                             |       
       /              \    /              \                   |              |         \         |              |  ----------            |                             |  ----------  \                        /              \                   |  ----------                 |       
      /                \  /                \                  |              |          \        |              |                        |                             |               \                      /                \                  |                             |       
     /                  \/                  \                 |              |           \       |              |                        |                             |                \                    /    __________    \                 |                             |       
    /                                        \                |              |            \      |              |                           \                          |                 \                  /                    \                |                             |       
   /                                          \               |              |             \     |              |                            \                         |                  \                /                      \               |                             |       
  /                                            \              |              |              \    |              |                             \                        |                   \              /                        \              |                             |       
 /                                              \             |              |               \   |              |                              \                       |                    \            /                          \             |                             |       
/                                                \            |              |                \  |              |  __________                   \__________            |                     \          /                            \            |                             |       

Reference implementation