65
\$\begingroup\$

In this challenge, you must take multiline ASCII art as input, such as:

 OOOOOO  OOOOOO  OOOOOO  OOOOOOO      OOOOOO   OOOOOO  OO      OOOOOOO 
OO      OO    OO OO   OO OO          OO       OO    OO OO      OO      
OO      OO    OO OO   OO OOOOO       OO   OOO OO    OO OO      OOOOO   
OO      OO    OO OO   OO OO          OO    OO OO    OO OO      OO      
 OOOOOO  OOOOOO  OOOOOO  OOOOOOO      OOOOOO   OOOOOO  OOOOOOO OO      

And you will also take an integer as input. You must output the ASCII art enlarged by the amount specified with the integer. For example, if you used a second argument of 3, the output would be

   OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOOOOO                  OOOOOOOOOOOOOOOOOO         OOOOOOOOOOOOOOOOOO      OOOOOO                  OOOOOOOOOOOOOOOOOOOOO
   OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOOOOO                  OOOOOOOOOOOOOOOOOO         OOOOOOOOOOOOOOOOOO      OOOOOO                  OOOOOOOOOOOOOOOOOOOOO
   OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOOOOO                  OOOOOOOOOOOOOOOOOO         OOOOOOOOOOOOOOOOOO      OOOOOO                  OOOOOOOOOOOOOOOOOOOOO
OOOOOO                  OOOOOO            OOOOOO   OOOOOO         OOOOOO   OOOOOO                              OOOOOO                     OOOOOO            OOOOOO   OOOOOO                  OOOOOO
OOOOOO                  OOOOOO            OOOOOO   OOOOOO         OOOOOO   OOOOOO                              OOOOOO                     OOOOOO            OOOOOO   OOOOOO                  OOOOOO
OOOOOO                  OOOOOO            OOOOOO   OOOOOO         OOOOOO   OOOOOO                              OOOOOO                     OOOOOO            OOOOOO   OOOOOO                  OOOOOO
OOOOOO                  OOOOOO            OOOOOO   OOOOOO         OOOOOO   OOOOOOOOOOOOOOO                     OOOOOO         OOOOOOOOO   OOOOOO            OOOOOO   OOOOOO                  OOOOOOOOOOOOOOO
OOOOOO                  OOOOOO            OOOOOO   OOOOOO         OOOOOO   OOOOOOOOOOOOOOO                     OOOOOO         OOOOOOOOO   OOOOOO            OOOOOO   OOOOOO                  OOOOOOOOOOOOOOO
OOOOOO                  OOOOOO            OOOOOO   OOOOOO         OOOOOO   OOOOOOOOOOOOOOO                     OOOOOO         OOOOOOOOO   OOOOOO            OOOOOO   OOOOOO                  OOOOOOOOOOOOOOO
OOOOOO                  OOOOOO            OOOOOO   OOOOOO         OOOOOO   OOOOOO                              OOOOOO            OOOOOO   OOOOOO            OOOOOO   OOOOOO                  OOOOOO
OOOOOO                  OOOOOO            OOOOOO   OOOOOO         OOOOOO   OOOOOO                              OOOOOO            OOOOOO   OOOOOO            OOOOOO   OOOOOO                  OOOOOO
OOOOOO                  OOOOOO            OOOOOO   OOOOOO         OOOOOO   OOOOOO                              OOOOOO            OOOOOO   OOOOOO            OOOOOO   OOOOOO                  OOOOOO
   OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOOOOO                  OOOOOOOOOOOOOOOOOO         OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOOOOO   OOOOOO
   OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOOOOO                  OOOOOOOOOOOOOOOOOO         OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOOOOO   OOOOOO
   OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOOOOO                  OOOOOOOOOOOOOOOOOO         OOOOOOOOOOOOOOOOOO      OOOOOOOOOOOOOOOOOOOOO   OOOOOO

Specifically, each character must turn into an n by n box of that character, where n is the integer argument. For example, an input of

ab
cd

and 3 will result in

aaabbb
aaabbb
aaabbb
cccddd
cccddd
cccddd

This is , so the shortest code in bytes wins.

\$\endgroup\$
  • \$\begingroup\$ ascii art looks interesting on the questions list \$\endgroup\$ – Justin Jan 27 '14 at 16:49
  • 6
    \$\begingroup\$ I think you should make a secondary/bonus round for a method that introduces proper aliasing into the enlarged art. Your giant code golf art is looking pretty blocky. \$\endgroup\$ – AmeliaBR Jan 28 '14 at 1:58
  • 5
    \$\begingroup\$ @AmeliaBR See here. \$\endgroup\$ – Howard Jan 28 '14 at 14:22

36 Answers 36

0
\$\begingroup\$

C (gcc), 113 bytes

i,j;f(s,n)char*s;{char*p;for(;*s;s=*p?++p:p)for(i=n;i--;puts(""))for(p=s;*p&&*p^10;p++)for(j=n;j--;)putchar(*p);}

Try it online!

\$\endgroup\$
  • \$\begingroup\$ Suggest for(char*p;*s;s=p+!!*p instead of char*p;for(;*s;s=*p?++p:p \$\endgroup\$ – ceilingcat Sep 10 '18 at 17:01
0
\$\begingroup\$

Japt, 11 bytes

yW=_mpVÃmWR

Try it online!

Unpacked & How it works

UyW=Z{ZmpV} mWR

Input: U = 2D string, V = magnification

Uy               map over columns of U...
    Z{ZmpV}        a function that repeats each char V times
  W=               assign this function to W
            m    and map again...
              R    over rows...
             W     the function W

JS's Assign-Anywhere™ trick in action.

\$\endgroup\$
0
\$\begingroup\$

K (ngn/k), 17 bytes

{,/+x#,+,/+x#,+y}

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Japt -R, 10 bytes

·ËVÆDmpV÷

Try it online

\$\endgroup\$
0
\$\begingroup\$

05AB1E, 12 bytes

U|εSX×JXи}˜»

Try it online.

Explanation:

U               # Take the integer input, and store it in variable `X`
                #  i.e. 3
 |              # Take the rest of the input-lines as list
                #  i.e. ["ab","cd"]
  ε      }      # Map each line to:
   S            #  Convert the line to a list of characters
                #   i.e. "ab" → ["a","b"]
    X×          #  And repeat each character `X` amount of times
                #   i.e. ["a","b"] and 3 → ["aaa","bbb"]
      J         #  Join the line back together
                #   i.e. ["aaa","bbb"] → "aaabbb"
       Xи       #  And repeat that line `X` amount of times
                #   i.e. "aaabbb" and 3 → ["aaabbb","aaabbb","aaabbb"]
          ˜     # Flatten the list of lists
                #  i.e. [["aaabbb","aaabbb","aaabbb"],["cccddd","cccddd","cccddd"]]
                #   → ["aaabbb","aaabbb","aaabbb","cccddd","cccddd","cccddd"]
           »    # And join by newline (which we implicitly output)
                #  i.e. ["aaabbb","aaabbb","aaabbb","cccddd","cccddd","cccddd"]
                #   → "aaabbb\naaabbb\naaabbb\ncccddd\ncccddd\ncccddd"
\$\endgroup\$
0
\$\begingroup\$

PHP, 115 bytes

function f($s,$l){foreach(explode("
",$s)as$a)for($i=$l;$i--;)echo preg_replace('/./',str_repeat('$0',$l),$a)."
";}

Try it online!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.