You must construct ASCII Pylons!

24

2

Cross posted from my anagolf post (note: may contain spoilers, post mortem).

Output the following text exactly.

  • You may have additional trailing whitespace on each line, and trailing newlines as well.
  • Shortest code, in bytes, wins.
                                                
                                              !"!
                                             "#$#"
                                            #$%&%$#
                                           $%&'('&%$
                                          %&'()*)('&%
                                         &'()*+,+*)('&
                                        '()*+,-.-,+*)('
                                       ()*+,-./0/.-,+*)(
                                      )*+,-./01210/.-,+*)
                                     *+,-./012343210/.-,+*
                                    +,-./0123456543210/.-,+
                                   ,-./01234567876543210/.-,
                                  -./0123456789:9876543210/.-
                                 ./0123456789:;<;:9876543210/.
                                /0123456789:;<=>=<;:9876543210/
                               0123456789:;<=>?@?>=<;:9876543210
                              123456789:;<=>?@ABA@?>=<;:987654321
                             23456789:;<=>?@ABCDCBA@?>=<;:98765432
                            3456789:;<=>?@ABCDEFEDCBA@?>=<;:9876543
                           456789:;<=>?@ABCDEFGHGFEDCBA@?>=<;:987654
                          56789:;<=>?@ABCDEFGHIJIHGFEDCBA@?>=<;:98765
                         6789:;<=>?@ABCDEFGHIJKLKJIHGFEDCBA@?>=<;:9876
                        789:;<=>?@ABCDEFGHIJKLMNMLKJIHGFEDCBA@?>=<;:987
                       89:;<=>?@ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA@?>=<;:98
                      9:;<=>?@ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA@?>=<;:9
                     :;<=>?@ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA@?>=<;:
                    ;<=>?@ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA@?>=<;
                   <=>?@ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA@?>=<
                  =>?@ABCDEFGHIJKLMNOPQRSTUVWXYZYXWVUTSRQPONMLKJIHGFEDCBA@?>=
                 >?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>
                ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?
               @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@
              ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`aba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA
             BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCB
            CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDC
           DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFED
          EFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFE
         FGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGF
        GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHG
       HIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnoponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIH
      IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJI
     JKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJ
    KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLK
   LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONML
  MNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONM
 NOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPON
OPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPO

Conor O'Brien

Posted 2018-04-26T13:37:40.790

Reputation: 36 228

3Is there an intentional first whitespace-only line? – AdmBorkBork – 2018-04-26T13:42:44.627

9@AdmBorkBork that's a space because that's the first ASCII char lol – HyperNeutrino – 2018-04-26T13:43:56.487

@HyperNeutrino Oh, durr. lol – AdmBorkBork – 2018-04-26T13:46:20.650

(note: may contain spoilers, post mortem). then don't click where the submissions are. :P – Erik the Outgolfer – 2018-04-26T14:39:53.957

Plus points for the `_^ emoji. – Tamás Sengel – 2018-04-26T14:44:45.240

2@the4kman and the <=>=< fish. – pizzapants184 – 2018-04-26T14:53:06.713

Is an additional leading newline permitted? Can we output an array of lines? How about an array of character arrays? – Shaggy – 2018-04-26T16:22:51.513

Are leading spaces allowed? (equal amount of spaces on each line) – user41805 – 2018-04-26T16:23:42.920

@Cowsquack Nope. – Conor O'Brien – 2018-04-26T17:01:39.423

What about the additional leading newline I asked about? – Shaggy – 2018-04-26T22:30:33.113

@Shaggy I'm going to have to say no, I think. – Conor O'Brien – 2018-04-27T00:03:52.857

4Is there a reason this isn't titled "You Must Construct ASCII Pylons!"? – mattdm – 2018-04-27T16:20:28.837

1@mattdm I can change it, that's better haha – Conor O'Brien – 2018-04-27T17:10:52.217

3@mattdm I only came here from the HNQ list to upvote this because of its title. Nicely done. – Todd Wilcox – 2018-04-27T19:43:06.497

I don't understand the title... – Esolanging Fruit – 2018-04-30T18:53:29.433

@EsolangingFruit It's a variation of a starcraft meme: You must construction additional pylons!

– Conor O'Brien – 2018-04-30T19:05:21.753

Answers

4

Canvas, 15 14 bytes

0c[C²[j}¹m]/││

Try it here!

Note that while making this I added a couple built-ins ( & ) as Canvas somehow didn't have any built-ins for ASCII/unicode before...

Explanation (some characters have been replaced to look monospace):

0c              push the charcode of "0" - 48
  {       ]     map over 1..48
   C              push the ASCII characters
    ²[ ]          repeat by the counter (0-indexed)
      j             remove the last character
        ¹m        mold to the length of the counter
           /    pad each line with spaces so it looks like a diagonal
            ││  palindromize the whole thing horizontally

dzaima

Posted 2018-04-26T13:37:40.790

Reputation: 19 048

16

PowerShell, 73 bytes

' '*48;46..0|%{" "*$_+-join[char[]](($x=79-$_)..($y=$x+$j++)+(++$y)..$x)}

Try it online!

Outputs the first whitespace-only line, then loops from 46 to 0. Each iteration, outputs the corresponding number of spaces and then a -joined together char-array of the appropriate symbols, via some calculations.

AdmBorkBork

Posted 2018-04-26T13:37:40.790

Reputation: 41 581

1Can you save some calculations by treating the first line as 47 spaces followed by a space character? – Riking – 2018-04-27T23:35:01.193

@Riking To do so, you'd need to special case how the char-array is created to only create one item instead of 3 or more. As a result, it's shorter to special case the spaces-only line completely separately. – AdmBorkBork – 2018-04-30T12:49:08.967

11

Charcoal, 13 bytes

E⁴⁸⮌✂γι⊕⊗ι‖O←

Try it online! Link is to verbose version of code. Explanation:

 ⁴⁸             Literal 48
E               Map over implicit range
      ι  ι      Current index
        ⊗       Doubled
       ⊕        Incremented
     γ          Printable ASCII
    ✂           Slice
   ⮌            Reverse
                Implicitly print each slice on separate lines
          ‖O←   Reflect with overlap

Neil

Posted 2018-04-26T13:37:40.790

Reputation: 95 035

5The output seems wrong to me. – Mr. Xcoder – 2018-04-26T14:01:26.567

1@Mr.Xcoder Ugh, classic off-by-1 error... – Neil – 2018-04-26T14:40:32.013

8

Python 2, 73 bytes

i=48
while i:i-=1;r=range(79-i,127-i*2);print' '*i+bytearray(r+r[-2::-1])

Try it online! Crossposted from anarchy golf (see my submission).

Quick post-mortem analysis: xnor and dianne discovered the exact same solution. ebicochneal submitted a 71 byte solution which mitchs improved to 70 bytes. They avoid dealing with bytearray (which is long) or ''.join(map(chr,…)) (which is even longer) entirely, by keeping a "current line" variable and cleverly updating it.

Lynn

Posted 2018-04-26T13:37:40.790

Reputation: 55 648

4

SOGL V0.12, 16 15 bytes

'½{ ~Δf⌡kFm}⁰¼╥

Try it Here!

dzaima

Posted 2018-04-26T13:37:40.790

Reputation: 19 048

4

Jelly, 17 bytes

48ḶḤr$z0ZUŒB+32ỌY

Try it online!

Dennis

Posted 2018-04-26T13:37:40.790

Reputation: 196 637

4

05AB1E, 16 bytes

48FžQNÝûN+èJ}).C

Try it online!

Emigna

Posted 2018-04-26T13:37:40.790

Reputation: 50 798

Ahhh... žQ was way better than žw79ŸvyžwN2*+ŸûçJ}).C – Magic Octopus Urn – 2018-04-27T20:31:11.447

4

Common Lisp, 110 bytes

(dotimes(i 48)(dotimes(j 96)(princ(if(>(abs(- j 48))i)" "(code-char(+(-(* i 2)(abs(- j 48)))32)))))(princ"
"))

Try it online!

Explanation

(dotimes(i 48)                   ;; for i from 0 up to 47
    (dotimes(j 96)               ;; for j from 0 up to 95
        (princ                   ;; print
            (if(>(abs(- j 48))i) ;; if abs(j - 48) > i
                " "              ;; print " "
                (code-char(+(-(* i 2)(abs(- j 48)))32)) ;; else print appropriate character
            )
        )
    )(princ"
") ;; print newline
)

ASCII-only

Posted 2018-04-26T13:37:40.790

Reputation: 4 687

3

VBA, 71 bytes

An anonymous VBE immediate window function that takes no input and outputs to the console.

For i=0To 47:?Spc(47-i);:For j=-i To i:?Chr(32-Abs(j)+2*i);:Next:?:Next

Taylor Scott

Posted 2018-04-26T13:37:40.790

Reputation: 6 709

3

Ruby, 70 bytes

s=[*?\s..?~]*'';48.times{|i|puts s[i,i+1].rjust(48)+s.reverse[-2*i,i]}

Try it online!

Constructs the full printable ASCII string and then prints the required number of forward (padded with spaces) + backward slices of it.

Kirill L.

Posted 2018-04-26T13:37:40.790

Reputation: 6 693

2

Jelly, 24 bytes

48RrḤ’$$ịØṖŒBṭ"48RU⁶ẋ$¤Y

Try it online!

HyperNeutrino

Posted 2018-04-26T13:37:40.790

Reputation: 26 575

2

C (gcc), 117 bytes

c;i;main(){for(i=0;i<48;++i){for(c=2*i-15;c<32+2*i;++c)putchar(c>31+i?c:32);for(;c>31+i;--c)putchar(c);putchar(10);}}

Try it online!

Ungolfed:

int ch;
int row;
int main(void) {
    for (row = 0; row < 48; ++row) {
        for (ch = 2*row-15; ch < 32 + 2*row; ++ch) {
            // The first character in the row is 2*row - 15 (row is zero-indexed)
            if (ch > 31+row)
                putchar(ch);
            else
                // If the current character is not in the pyramid, mask it with a space
                putchar(' ');
        }
        for (; ch > 31+row; --ch) {
            // Finish the other side of the pyramid
            putchar(ch);
        }
        putchar('\n');
    }
}

pizzapants184

Posted 2018-04-26T13:37:40.790

Reputation: 3 174

108 bytes – ceilingcat – 2018-12-22T18:48:46.780

2

Perl 6, 55 53 bytes

say ' 'x 47-$_,chrs 32+2*$_ X-(-$_..$_)>>.abs for ^48

Try it online!

nwellnhof

Posted 2018-04-26T13:37:40.790

Reputation: 10 037

2

Perl 5, 77 75 69 bytes

map{say$"x(47-$_),(@a=map chr$_+32,$_..$_*2),reverse@a[0..@a-2]}0..47

Try it online!

Xcali

Posted 2018-04-26T13:37:40.790

Reputation: 7 671

2

C (gcc), 114 113 107 bytes

#define _(_)for(k=32;k<j;)putchar(j+_++);
f(j,k){for(j=31;++j<80;){printf("\n%*c",80-j,j);_(-31+k)_(j+~k)}}

Try it online!

101 bytes are possible using a compiler flag.

Jonathan Frech

Posted 2018-04-26T13:37:40.790

Reputation: 6 681

2

Japt -R, 18 15 bytes

14 bytes if an additional leading newline is allowed.

#0õ_odH+ZÉ ¬êÃû

Test it


Explanation

#0                  :48
  õ                 :Range [1,48]
   _         Ã      :Pass each Z through a function
    o               :  Range [0,Z)
      H+ZÉ          :    To each add 32+Z-1
     d              :    Get the character at that codepoint
           ¬        :  Join to a string
            ê       :  Palinrdomise
              û     :Centre pad each element to the length of the longest element
                    :Implicitly join with newlines and output

Shaggy

Posted 2018-04-26T13:37:40.790

Reputation: 24 623

2

J, 47 44 bytes

(,.~}:@|."1)(1+i.48)([|.@{.}.)"0 1 u:31+i.96

Try it online!

Thanks to Conor O'Brien for the template! Thanks to FrownyFrog for indicating the invalid solution.

Galen Ivanov

Posted 2018-04-26T13:37:40.790

Reputation: 13 815

1

Perhaps this is more easily modifiable: Try it online!

– Conor O'Brien – 2018-04-26T19:10:36.097

@Conor O'Brien - Thank you for the template, I've updated the link. – Galen Ivanov – 2018-04-27T06:13:22.480

Prints an extra line at the top. – FrownyFrog – 2018-04-27T06:48:26.720

@FrownyFrog Oh, it's only now that I see that only trailing newlines are permitted, not leading. I'll try to fix it. – Galen Ivanov – 2018-04-27T06:57:41.117

@FrownyFrog - Fixed and slightly golfed. – Galen Ivanov – 2018-04-27T07:17:41.557

2

T-SQL, 153 bytes

DECLARE @ INT=33,@t CHAR(95)=''a:PRINT @t;
SET @t=LEFT(STUFF(STUFF(@t,63-@/2,2,''),46,0,CHAR(@-1)+CHAR(@)+CHAR(@+1)+CHAR(@)),33+@/2)
SET @+=2IF @<128GOTO a

Returns are for display only.

I tried several ideas, including a loop to preconstruct the full string (163 characters), and a nested loop to build it on the fly (168 characters), but this ended up being the shortest.

Basically, each loop I'm cramming 4 new characters into the center of the string, then trimming off the extras from both ends, using the SQL STUFF() function.

Formatted and explained:

DECLARE @ INT=33,                      --Using a single counter for both rows and CHAR
        @t CHAR(95)=''                 --a non-null CHAR field will pre-fill with spaces
a:                                     --GOTO loop, shorter than a WHILE
    PRINT @t                           --duh
    SET @t = LEFT(                     --lops off the character at the end
            STUFF(                     --crams 4 new characters in the middle
            STUFF(@t, 63-@/2, 2, '')   --snips out a space and the leading character
                 ,46, 0, CHAR(@-1) + CHAR(@) + CHAR(@+1) + CHAR(@))
                 ,33 + @/2)            --rest of the LEFT()
    SET @+=2
IF @<128 GOTO a

BradC

Posted 2018-04-26T13:37:40.790

Reputation: 6 099

2

J,  40 37 32 bytes

40 expression u:30+2>.(+:@i.@(2&+)(-*(>+:))"0 _|@i:)47 thanks to +Galen Ivanov & +Conor O'Brien for the ideas in their solutions

37 included echo echo u:32+|.(~.(>:*+:@[-])"0 _])|i:47

echo u:32+|.(~.(>:*[+-)"{])|i:47

incorporating @FrownyFrog tips from comments

TIO

jayprich

Posted 2018-04-26T13:37:40.790

Reputation: 391

I don't think expressions are valid submissions. – LyricLy – 2018-04-26T23:59:46.433

@LyricLy , opinion seems to vary as I do see another J answer in this form .. anyway thanks for prodding me to shave another 8 bytes .. now I have room to add "echo " : hope you're happy : ) – jayprich – 2018-04-27T13:46:50.207

"0 _ → "{ – FrownyFrog – 2018-04-27T22:22:13.843

+:@[-][+- – FrownyFrog – 2018-04-27T22:38:26.323

beautiful .. thanks for these tips @FrownyFrog – jayprich – 2018-04-28T15:12:25.393

2

Ruby, 59 bytes

48.times{|i|-47.upto(i){|c|putc~c<i ?32-c.abs+2*i:32};puts}

Cross-posted from my answer on anagol.

histocrat

Posted 2018-04-26T13:37:40.790

Reputation: 20 600

1

Python 2, 98 88 bytes

-1 byte thanks to @Mr.Xcoder

i=32
exec"print''.join(chr(i+i-32-abs(j))for j in range(32-i,i-31)).center(95);i+=1;"*48

Try it online!

Dead Possum

Posted 2018-04-26T13:37:40.790

Reputation: 3 256

-i+32 => 32-i and you might use ' '*(79-i) instead of .center(95) to save bytes. – Mr. Xcoder – 2018-04-26T14:19:43.233

@Mr.Xcoder thanks! ' '*(79-i)+ doesn't really save bytes :D – Dead Possum – 2018-04-26T14:28:10.583

1

Ruby, 78 bytes

s=*32;48.times{puts (s.map(&:chr)*'').center 95;c=*s[0]+1;s=c+s.map{|x|x+2}+c}

Try it online!

Full program. Ungolfed:

s=*32;                              # s is an array of integers
48.times{                           # Repeat 48 times:
  puts (s.map(&:chr)*'').center 95; # Turn each int to a char, join, center, and print
  c = *s[0] + 1;                    # c is a singleton array. It will bookend the next line
  s = c + s.map{|x|x+2} + c         # Add 2 to each element of s before adding the bookends
}

benj2240

Posted 2018-04-26T13:37:40.790

Reputation: 801

1

Yabasic, 80 bytes

An anonymous function that takes no input and outputs to the console

For i=0To 47
For j=i To 47?" ";Next
For j=-i To i?Chr$(32-Abs(j)+2*i);Next
?Next

Try it online!

Taylor Scott

Posted 2018-04-26T13:37:40.790

Reputation: 6 709

1

uBASIC, 95 bytes

0ForI=0To47
1ForJ=ITo47:?" ";:NextJ
2ForK=-1*IToI:?Left$(Chr$(32-Abs(K)+2*I),1);:NextK
3?:NextI

Try it online!

Taylor Scott

Posted 2018-04-26T13:37:40.790

Reputation: 6 709

1

MY-BASIC, 97 bytes

An anonymous MY-BASIC response that takes no input and outputs to the Console

For i=0 To 47
For j=i To 47
Print" "
Next
For j=-i To i
Print Chr(32-Abs(j)+2*i)
Next
Print;
Next

Try it online!

-1 byte thanks to Jonathan Frech

Taylor Scott

Posted 2018-04-26T13:37:40.790

Reputation: 6 709

1Print " " -> Print" ". – Jonathan Frech – 2018-04-26T19:53:06.287

@JonathanFrech - whoops sorry I mispelled your name – Taylor Scott – 2018-04-30T22:37:39.793

1

C (gcc) 199 bytes

#include<stdio.h>
int i,j=32,k=32,l=49;int main(){while(k<127){for(i=0;i<l;++i)printf(" ");for(i=j;i<k;++i)printf("%c",i);printf("%c",k);for(i=k-1;i>=j;--i)printf("%c",i);printf("\n");j++;k+=2;l--;}}

Try it online!

Thanks to Picard and PunPun1000 for all of the help

Jonathan Landrum

Posted 2018-04-26T13:37:40.790

Reputation: 111

@Picard I removed the spaces. I could further minify with a global iterator variable. – Jonathan Landrum – 2018-04-27T00:59:33.923

@Picard I edited it on my phone; didn't realize I'd left a blank line. – Jonathan Landrum – 2018-04-27T16:59:49.610

1

There's unnecessary spaces in the printf calls after the commas, and the variable names can be shortened down to one letter. Also it would be nice if you could include a TIO link and the actual byte count. Here's the link for your current code TIO

– PunPun1000 – 2018-04-27T19:55:20.023

ok, i've squeezed it a bit more, i think i'd have to change the algorithm to shrink it further – Jonathan Landrum – 2018-04-27T20:05:32.310

1

MATL, 18 bytes

48:"@@Zv30++Xhc3Zu

Try it online!

Luis Mendo

Posted 2018-04-26T13:37:40.790

Reputation: 87 464

1

Java 8, 115 114 110 bytes

()->{for(int m=0,c;m<48;m++)for(c=-48;++c<m+2;)System.out.print(c<-m?' ':c>m?'\n':(char)(32-(c<0?-c:c)+2*m));}
  • (c<0?-c:c) saves 1 byte over Math.abs(c)
  • I used ?: to print spaces before the pylon and a newline after it to save multiple System.out.print calls.

rgettman

Posted 2018-04-26T13:37:40.790

Reputation: 121

Is omitting the class declaration permitted? :) – Trejkaz – 2018-04-27T03:06:06.430

1

@Trejkaz It is allowed to submit a full program or a function.

– ovs – 2018-04-27T08:12:31.847

for(c=-47;c<m+2;c++){...} -> for(c=-48;++c<m+2;).... – Jonathan Frech – 2018-04-28T16:46:59.253

@JonathanFrech Done. Thanks. – rgettman – 2018-04-30T16:03:04.963

@rgettman You can most likely also get rid of the brackets. – Jonathan Frech – 2018-04-30T16:34:38.190

1

Tcl, 129 122 118 117 bytes

time {incr i;set j -48;set a {};time {set a $a[format %c [expr abs([incr j])>=$i?32:$i*2-abs($j)+30]]} 96;puts $a} 48

Try it online!

Explanation

time { # for i from 0 up to 47
    incr i
    set j -48
    set a {}
    time { # for j from -48 up to 47
        # add next character to a
        set a $a[format %c [expr abs([incr j])>$i?32:$i*2-abs($j)+32]]
    } 96
    puts $a # print a
} 48

ASCII-only

Posted 2018-04-26T13:37:40.790

Reputation: 4 687

1

Gol><>, 29 bytes

`0FaLssLF:P|LF:M|`/L-R` lRo|;

Try it online!

How it works

`0FaLssLF:P|LF:M|`/L-R` lRo|;

`0F                        |;  Repeat the following 48 times and halt...
   a                           Push 10 (\n)
    Lss                        Push L(loop counter) + 32
       LF:P|                   Repeat "Clone the top and increment" L times
            LF:M|              Repeat "Clone the top and decrement" L times
                 `/L-R`        Push 32 (space) 47-L times (space is significant)
                        lRo    Print everything as char, from the top,
                               until the stack is empty

Bubbler

Posted 2018-04-26T13:37:40.790

Reputation: 16 616

1

Haskell, 102 bytes

main=putStr$do
i<-[48,47..0]
let l=replicate i 32++[79-i..126-i*2]
map toEnum$l++tail(reverse l)++[10]

Things I have tried that were not shorter:

  • Expressing everything in terms of character literals and succ or pred to save the map toEnum.
  • Writing a downward range instead of using reverse.

Kevin Reid

Posted 2018-04-26T13:37:40.790

Reputation: 1 693

1

PHP, 94 bytes

for(;49>$k=++$i;printf("%47s%s
",$s,substr(strrev($s),1)))for($s="";$k--;)$s.=chr(30+$i*2-$k);

Run with -nr or try it online.

Titus

Posted 2018-04-26T13:37:40.790

Reputation: 13 814

0

JavaScript (Node.js), 95 bytes

f=(x=y=0)=>y<48?[`
`[x]]+Buffer([x<48-y|x>48+y?32:x<48?x+y*2-16:80-x+y*2])+f(++x%96?x:+!++y):''

Try it online!

Arnauld

Posted 2018-04-26T13:37:40.790

Reputation: 111 334