88
\$\begingroup\$

Write a program or function that prints or outputs this exact text (consisting of 142 characters):

()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|

Your program must take no input (except in languages where this is impossible, such as sed), and produce the above text (and only the above text) as output. A trailing newline is acceptable.

This is , so the shortest answer (in bytes) wins.

\$\endgroup\$
6
  • 11
    \$\begingroup\$ @RohanJhunjhunwala For proof that this can be compressed, Luis Mendo did it. \$\endgroup\$ Commented Sep 17, 2016 at 13:42
  • 1
    \$\begingroup\$ Lol, I have been proven wrong (and I am glad!) very impressive \$\endgroup\$ Commented Sep 17, 2016 at 15:40
  • 2
    \$\begingroup\$ You cold have made them take an integer input N to output a slice whose number of () at the top is N. It would be very complex tho. \$\endgroup\$ Commented Sep 17, 2016 at 17:02
  • 6
    \$\begingroup\$ Just so you know, you need 43 decimal places of π. \$\endgroup\$ Commented Sep 17, 2016 at 18:36
  • 6
    \$\begingroup\$ So close to the meaning of life.... \$\endgroup\$ Commented Sep 20, 2016 at 4:04

28 Answers 28

97
\$\begingroup\$

MATL, 70 68 67 bytes

'()'12:)l10:&<toYP43Y$51hb(!10Xy'\::\'FFhZ++'|'3$Yc'||\'3:(95'Zd'o(

Try it online!

Explanation

What a mess. But hey, there's a convolution!

The explanation will be clearer if you can inspect the stack contents after a given statement. To do it, just insert X#0$% at that point. (This means: X# show stack contents, 0$ don't implicitly display anything else, % comment out rest of the code). For example, see the stack right after the convolution.

'()'       % Push this string
12:        % Range [1 2 ... 12]
)          % Index into string (modular, 1-based): gives '()()()()()()'
l          % Push 1 (will be used later)
10:        % Range [1 2 ... 10]
&<         % All pairwise "less than" comparisons. Gives matrix with "true"
           % below the main diagonal, and the remining entries equal to "false"
to         % Duplicate. Convert to numbers (true becomes 1, false becomes 0)
YP43Y$     % Compute pi with 43 significant digits (42 decimals). Gives a string
51h        % Append last decimal, '3' (ASCII 51). This is needed to avoid rounding
b          % Bubble up the true-false matrix, to be used as logical index
(          % Fill the chars from the pi string into the 0-1 matrix, at the positions
           % indicated by the true-false matrix. Thus each 1 is replaced by a char
           % from the pi string. Entries that were 0 remain as 0. This is done in
           % columm-major order...
!          % ...so transpose to make it row-major
10Xy       % Identity matrix of size 10
'\::\'     % Push this string...
FFh        % ...and append two zeros
Z+         % 2D convolution keeping size. The identity matrix convolved with the
           % above string gives the diagonal bands with chars '\'  and ':'
+          % Add to the matrix containing the digits of pi. At each entry, only one
           % of the two matrices is nonzero
'|'        % Push this string
3$Yc       % Three-input string concatenation. This prepends the 1 (which was pushed
           % a while ago) and appends '|' to each row of the matrix. This converts
           % the matrix to char. Note that char 1 will be displayed as a space. We
           % used char 1 and not char 0 (which would be displayed as a space too)
           % because function `Yc` (`strcat`) strips  off trailing space from the
           % inputs, counting char 0 as space, but not char 1
'||\'      % Push this string
3:(        % Assign it to the first 3 entries of the matrix (column-major), that is, 
           % to the top of the first column
95         % Push ASCII for '_'
'Zd'o      % Push string 'Zd' and convert to numbers: gives [90 100]. These are the
           % (column-major) indices where the '_' char should appear in the last row
(          % Fill those chars
           % Implicitly display. (Chars 0 and 1 are displayed as space)
\$\endgroup\$
9
  • 14
    \$\begingroup\$ Luis Mendo, this is impressive. I would upvote twice if I could. I thought this would be an incompressible kolmogorov challenge. Thank you for proving me wrong! \$\endgroup\$ Commented Sep 17, 2016 at 15:42
  • 3
    \$\begingroup\$ @Rohan Thanks for your kind words! \$\endgroup\$
    – Luis Mendo
    Commented Sep 17, 2016 at 16:59
  • 1
    \$\begingroup\$ :D No problem! :D \$\endgroup\$ Commented Sep 17, 2016 at 17:16
  • 3
    \$\begingroup\$ +1 for the :) that appears in your code. \$\endgroup\$ Commented Sep 18, 2016 at 9:03
  • 2
    \$\begingroup\$ @Neil See the bright side of life... \$\endgroup\$ Commented Sep 19, 2016 at 12:03
39
\$\begingroup\$

Perl, 93 bytes

$_=bpi$=;printf'()'x6x!$`.'
%12s',F.ee x!$\--^substr"\32::\\$&|",-12while/.{$\}/g

Requires the command line option -l71Mbignum=bpi, counted as 14. The \32 should be replaced by a literal character 26.

Sample Usage

$ perl -l71Mbignum=bpi pi-slice.pl
()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|

Perl, 111 bytes

$_=bpi$_*($l=($.=$_)-3);printf'()'x($./2)x!$`."
%$.s",F.ee x!$l--^substr"\32::\\$&|",-$.while/.{$l}/g

Parameterized version. Requires the command line option -nMbignum=bpi, counted as 12.

Sample Usage

$ echo 10 | perl -nMbignum=bpi pi-slice.pl
()()()()()
|\3.14159|
|:\265358|
\::\97932|
 \::\3846|
  \::\264|
   \::\33|
    \::\8|
     \__\|

$ echo 20 | perl -nMbignum=bpi pi-slice.pl
()()()()()()()()()()
|\3.141592653589793|
|:\2384626433832795|
\::\028841971693993|
 \::\75105820974944|
  \::\5923078164062|
   \::\862089986280|
    \::\34825342117|
     \::\0679821480|
      \::\865132823|
       \::\06647093|
        \::\8446095|
         \::\505822|
          \::\31725|
           \::\3594|
            \::\081|
             \::\28|
              \::\4|
               \__\|
\$\endgroup\$
24
\$\begingroup\$

JavaScript (ES6), 187 174 bytes

This is 1 byte shorter than just displaying the plain text.

for(y=n=0,s=`()()()()()()
`;y<10;y++,s+=`|
`)for(x=-2;x++<9;)s+=x>y?(Math.PI+'2384626433832795028841971693')[n++]:`\\${y>8?'__':x+1|y>2?'::':'||'}\\`[y-x]||' ';console.log(s)

\$\endgroup\$
10
  • 2
    \$\begingroup\$ Isn´t it one byte shorter than console.log("") + 12*11 characters + 18 backslashes + 10 linebreaks? \$\endgroup\$
    – Titus
    Commented Sep 17, 2016 at 14:28
  • \$\begingroup\$ @Titus - You're right. I forgot to count backslash escaping. Thanks! \$\endgroup\$
    – Arnauld
    Commented Sep 17, 2016 at 15:03
  • 18
    \$\begingroup\$ Mildly interesting, but 2384626433832795028841971693 happens to be prime. \$\endgroup\$
    – ElementW
    Commented Sep 17, 2016 at 17:18
  • 1
    \$\begingroup\$ @ElementW - Funny that you mentioned it, because I did check that too. :) \$\endgroup\$
    – Arnauld
    Commented Sep 17, 2016 at 17:18
  • \$\begingroup\$ Would writing the number as hex and converting it to a string save any bytes? \$\endgroup\$
    – anon
    Commented Sep 19, 2016 at 18:20
17
\$\begingroup\$

///, 129 127 bytes

/-/\\\\//&/--::--//%/  //#/|
%//!/()()/!!!
|-3.1415926|
|:-53589793|
&2384626|
 &433832#&79502# &8841#%&971#% &69#%%&3#%% -__-|

Try it online!

\$\endgroup\$
5
  • \$\begingroup\$ -2 bytes if you do /!/()()/!!! instead of ()()()()()() and replace /#/|\n%%/ with /#/|\n%/ and adjust the rest of the code to make it work with that. \$\endgroup\$
    – acrolith
    Commented Sep 17, 2016 at 18:10
  • \$\begingroup\$ @daHugLenny Oh thanks, I didn't know 4 * 3 was a valid candidate for replacement. For your second suggestion, I think it will be longer. \$\endgroup\$ Commented Sep 17, 2016 at 18:25
  • \$\begingroup\$ @daHugLenny ^^ I can confirm that your second suggestion is indeed longer. \$\endgroup\$ Commented Sep 17, 2016 at 18:33
  • 1
    \$\begingroup\$ It isn't, I got 127 bytes with it. \$\endgroup\$
    – acrolith
    Commented Sep 17, 2016 at 18:36
  • \$\begingroup\$ @DestructibleWatermelon I did it intentionally. There are also other faces: -:, :-, :- and -__-. \$\endgroup\$ Commented Sep 18, 2016 at 8:49
17
\$\begingroup\$

Python 2, 131 bytes

print'()'*6+'\n|\\3.1415926|\n|:\\53589793|'
for n in 2384626,433832,79502,8841,971,69,3,'':print'%11s|'%('\%s'*2%('_:'[n<'']*2,n))

Joint effort between Sp3000 and Lynn. Copper saved a byte, too! Ideone link.

\$\endgroup\$
2
  • \$\begingroup\$ That's elegant +1 \$\endgroup\$
    – ElPedro
    Commented Sep 18, 2016 at 12:43
  • \$\begingroup\$ You should be able to save 1 byte by removing the brackets in the for loop. \$\endgroup\$
    – Copper
    Commented Sep 18, 2016 at 12:51
12
\$\begingroup\$

Bash, 153 bytes

cat << _
()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|
_
\$\endgroup\$
7
  • 9
    \$\begingroup\$ Considering how many of the other answers fell into the trap of producing code longer than printing the literal pie, I think this is a smart answer indeed. Also, it’s only 153 bytes by my count. \$\endgroup\$
    – lynn
    Commented Sep 18, 2016 at 12:39
  • 3
    \$\begingroup\$ @Lynn However, it is just dumping the example to the output with no attempt of golfing, and so is discouraged. At least the other answers made an effort... \$\endgroup\$
    – Beta Decay
    Commented Sep 18, 2016 at 12:58
  • \$\begingroup\$ You can remove the spaces before and after the <<. And your bytecount is of 153 bytes. \$\endgroup\$ Commented Sep 18, 2016 at 13:12
  • 1
    \$\begingroup\$ Isn't echo '()()()()()()...\__\|' 4 bytes shorter? \$\endgroup\$
    – Neil
    Commented Sep 19, 2016 at 8:49
  • \$\begingroup\$ @Lynn I'm glad I didn't have that problem; Batch requires 100 bytes of overhead to simply print the pie. \$\endgroup\$
    – Neil
    Commented Sep 19, 2016 at 8:53
9
\$\begingroup\$

Batch, 195 bytes

@echo ()()()()()()
@echo ^|\3.1415926^|
@echo ^|:\53589793^|
@set i=\
@for %%d in (2384626 433832 79502 8841 971 69 3)do @call:l %%d
@echo %i%__\^|
@exit/b
:l
@set i= %i%
@echo%i%::\%1^|
\$\endgroup\$
5
\$\begingroup\$

Fourier, 196 190 bytes

New feature alert!

Code

|SaCaaSa|f|~Y0~jY(32aj^~j)|w6(40a41ai^~i)10a~N124a~W92a~S3o46a1415926oWaNaWa58a~CSa53589793oWaNaf2384626oWaNa1wf433832oWaNa2wf79502oWaNa3wf8841oWaNa4wf971oWaNa5wf69oWaNa6wf3oWaNa7wSa95aaSaWa

Explanation

This program is my first demonstration of functions in Fourier:

Functions are defined like so:

|code goes here|f

The first pipe starts the function declaration. You then put the code in between the pipes. The last pipe ends the function declaration. Finally, the f is the variable in which the function is stored. This can be any character, as long as it isn't a reserved function.

For example, in my code, one of the function s is:

|SaCaaSa|f

Where the variable S stores the number 92 and C stores the number 58.

When called, the function outputs the following:

\::\

Since it is the most repeated thing in the pie.

Similarly, to golf down the output, I have used a loop:

6(40a41ai^~i)

Which repeats the code 40a41a 6 times. 40a41a on its own outputs:

()

So repeating the code six times outputs:

()()()()()()

Thereby outputting the crust of the pie.

Try it on FourIDE!

Because I haven't implemented functions in the Python interpreter, this program will not work on http://tryitonline.net

\$\endgroup\$
5
\$\begingroup\$

Turtlèd, 135 129 bytes

(the interpreter isn't really slightly buggèd (anymore :]), but it does not affect this program)

By restructuring and rewriting my program, I golfed... six bytes

And now I have to make new explanation...

Still could be shorter probs though


At least the best solution in this lang isn't just writing in the raw data ¯\(ツ)


#3.141592653589793238462643383279502884197169#")()()()()()">10:[)'|l]:[)d'\l]d"(||"2uuu[|;"::"uuu];>"__"[|r'\d]dl[ l[|.+l][\r]ul]

Try it online Explanation

Honestly, this doesn't describe the actual program very well, but it does give hints about the commands, so you might understand a little better

#3.141592653589793238462643383279502884197169# Some pi. Set the string to thing between #s
                                               the last digit was same as first, and the
                                               string wraps, so digit could be removed
")()()()()()"  Write this string, by writing char 1 to current cell, moving right, char 2...

>              turn right

10             set register to ten

:[)'|l]:       move right by amount in register, while current cell isn't ), write |
               and move left. move right by amount in register

[)d'\l]        while cell is not (, move down, write \, move left

d"(||"         move down and string-write "(||"

2              set register to 2

uuu[|;"::"uuu] Move up three, and while the cell is not |, move down by
               register (2), string-write "::", move up three

               Just remember the turtle is currently pointing right, so up is right.

;>"__"         move down by amount in register, turn right, string-write "__"

[|r'\d]dl      while cell is not |{ move right, write \, move down}, move down, left

COMPLEX THING: NESTED LOOPS

[ l[|.+l][\r]ul]

While the current cell is not space {move left, execute loop:(While cell not |, write current char of string variable (remember that pi?), increment string pointer, move left), execute loop:(while cell not \, move right), move up, left}

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

Pyth, 89 bytes

J_2K+.n0."09\07´\C2\84J\01£\07Nl:?í"*"()"6Vr9Zp*dJp?!Z\|?qZ9"|:""\::"p\\p:KZ+ZN\|=+ZN=hJ)p*dJ"\__\|"

Try it online!

Replace \xx (hexadecimal) with the corresponding ASCII character if you copy/paste the code from this answer; it contains unprintable characters in the packed string which SE filters out.

Explanation

J_2        Sets J to -2
  .n0      Pi; returns 3.141592653589793
  ."(...)" Packed string; returns "2384626433832795028841971693"
 +         Concatenation; returns "3.1415926535897932384626433832795028841971693"
K          Sets K to that string
*"()"6     Repetition; returns "()()()()()()", which is implicitly printed with a newline
 r9Z       Range; returns [9, 8, 7, 6, 5, 4, 3, 2, 1] (Z is initialized to 0)
V          Loop through r9Z, using N as the loop variable
  *dJ      Repetition; d is initialized to " " (returns an empty string if J <= 0)
 p         Print without a newline
  ?!Z      Ternary; if not Z
   \|      then return "|"
   ?qZ9    else, ternary; if Z == 9
    "|:"   then return "|:"
    "\::"  else, return "\::"
 p         Print without a newline
  \\       One-character string; returns "\"
 p         Print without a newline
  :KZ+ZN   Slice; returns K[Z:Z+N], not including K[Z+N]
 p         Print without a newline
 \|        One-character string; returns "|", which is implicitly printed with a newline.
 =+ZN      Adds N to Z
 =hJ       Increments J by 1
)          Ends loop
 *dJ       Repetition; d is initialized to " "
p          Print without a newline
"\__\|"    Returns "\__\|", which is implicitly printed with a newline
\$\endgroup\$
4
\$\begingroup\$

Jelly, 83 bytes

surely still quite golfabale

7Ḷ⁶ẋ;€“\::\”“|:\”ṭṙ7
⁾()ẋ6⁷⁾|\8ØPæp”|⁷8RUR€µ“⁾ḅ|Za"~ṅỵþȷ^ṇ⁷Ċ’Dṁ;€”|ż@¢Y⁷ø⁶ẋ7“\__\|”

TryItOnline

How?

7Ḷ⁶ẋ;€“\::\”“|:\”ṭṙ7 - Link 1, left side padding and filling
7Ḷ                   - lowered range of 7 ([0,1,2,3,4,5,6])
      “\::\”         - filling ("\::\")
  ⁶ẋ;€               - space character repeated that many times and concatenate for each
            “|:\”    - top crust edge filling ("|:\")
                 ṭ   - tack (append to the end)
                  ṙ7 - rotate to the left by 7 (move top crust filling to the top)

⁾()ẋ6⁷⁾|\8ØPæp”|⁷8RUR€µ - Main Link (divided into two for formatting)
⁾()ẋ6⁷                  - "()" repeated 6 times and a line feed
      ⁾|\               - "|\"
          ØP            - pi
         8  æp          - round to 8 significant figures (top edge of the glaze)
              ”|⁷       - "|" and a line feed
                 8R     - range of 8 ([1,2,3,4,5,6,7,8])
                   U    - reverse ([8,7,6,5,4,3,2,1])
                    R€  - range for each ([[1,2,..8],[1,2,..7],...,[1,2],[1]])
                      µ - monadic chain separation

“⁾ḅ|Za"~ṅỵþȷ^ṇ⁷Ċ’Dṁ;€”|ż@¢Y⁷ø⁶ẋ7“\__\|” - Main link (continued)
“⁾ḅ|Za"~ṅỵþȷ^ṇ⁷Ċ’                       - base 250 representation of the rest of the digits
                 D                      - decimalise (makes it a list)
                  ṁ                     - mould (into the shape of the array formed above)
                     ”|                 - "|"
                   ;€                   - concatenate for each
                         ¢              - call last link (1) as a nilad
                       ż@               - zip (with reversed operands)
                          Y⁷            - join with line feeds, and another line feed
                            ø           - niladic chain separation
                             ⁶ẋ7        - space character repeated 7 times
                                “\__\|” - "\__\|" the very bottom of the pie wedge
\$\endgroup\$
2
  • 3
    \$\begingroup\$ Wow, that's the longest Jelly program I've ever seen :o \$\endgroup\$
    – Beta Decay
    Commented Sep 22, 2016 at 6:34
  • \$\begingroup\$ @BetaDecay no doubt it can be done in 11 bytes... \$\endgroup\$ Commented Sep 22, 2016 at 7:20
4
\$\begingroup\$

PowerShell, 105 bytes

'()'*6
'|\3.1415926|
|:\53589793|'
2384626,433832,79502,8841,971,69,3|%{" "*$i+++"\::\$_|"}
' '*7+'\__\|'

Try it online!

Not sure how I never answered this challenge ... I upvoted it and several of the other answers. Oh well, better late than never?

This puts six balanced parens as a string on the pipeline, then a literal string (saves two bytes) of the next two rows. Then, we loop through the rest of the numbers, each iteration incrementing the number of prepended spaces ($i) concatenated with \::<number>|. Finally, we create a string of the tip of the pie. Those strings are all left on the pipeline, and an implicit Write-Output sticks a newline between.

This is 39 bytes shorter than just printing the pie.

\$\endgroup\$
3
\$\begingroup\$

Python 2, 193 176 bytes

P="3.1415926 53589793 2384626 433832 79502 8841 971 69 3".split()
f="()"*6+"\n|\%s|\n|:\%s|\n"%(P[0],P[1])
for s in range(7):f+=" "*s+"\::\\"+P[s+2]+"|\n"
print f+" "*7+"\__\|"

Or a shorter, more boring answer:

print r"""()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|"""
\$\endgroup\$
2
  • 4
    \$\begingroup\$ Are you aware that print r'''(the pie)''' is 38 bytes shorter? :) \$\endgroup\$
    – lynn
    Commented Sep 18, 2016 at 12:19
  • \$\begingroup\$ +1 for your second effort but using single quotes makes it shorter to look at. Pixel count is better :) \$\endgroup\$
    – ElPedro
    Commented Sep 19, 2016 at 17:44
3
\$\begingroup\$

C# 220 213 209 208 202 201 (171*) Bytes

*I find this to be unoriginal and cheating

void F()=>Console.Write(@"()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|");

201 Bytes:

void f(){var s="()()()()()()\n";for(int i=0;i<9;)s+=(i<1?"|":i<2?"|:":"\\::".PadLeft(i+1))+$"\\{new[]{3.1415926,53589793,2384626,433832,79502,8841,971,69,3}[i++]}|\n";Console.Write(s+@"       \__\|");}

220 bytes:

I'm sure that there is something to be golfed here

void f(){string s="()()()()()()\n",x="       ";for(int i=9,j=0;i>0;j+=i--)s+=(i>7?"|"+(i<9?":":"")+"\\":x.Substring(i)+@"\::\")+$"{Math.PI}32384626433832795028841971693".Substring(j,i)+"|\n";Console.Write(s+x+@"\__\|");}
\$\endgroup\$
6
  • \$\begingroup\$ Thanks for the answer! You can save a least one byte by removing the extra space in .Substring(j, i). \$\endgroup\$
    – Copper
    Commented Sep 18, 2016 at 10:55
  • \$\begingroup\$ That was an oversight from auto-formatting in VS, but I saved a bunch a different way anyhow =) \$\endgroup\$ Commented Sep 18, 2016 at 11:06
  • \$\begingroup\$ An anonymous function returning the pie verbatim is >25% shorter: ()=>@"(pie)" is 149 bytes. \$\endgroup\$
    – lynn
    Commented Sep 18, 2016 at 17:17
  • \$\begingroup\$ It's also boring and feels like cheating. Rules say to print, not return \$\endgroup\$ Commented Sep 18, 2016 at 17:22
  • \$\begingroup\$ @pinkfloydx33 Printing and returning are both allowed by default according to community consensus. \$\endgroup\$
    – mbomb007
    Commented Sep 19, 2016 at 18:39
3
\$\begingroup\$

Ruby, 140 138 137 bytes

My solution to this problem in ruby, this is my first code golf answer :D

[0,2384626,433832,79502,8841,971,69,3,1].map{|n|puts n<1?"()"*6+"\n|\\3.1415926|\n|:\\53589793|":"\\#{n>1?"::\\#{n}":"__\\"}|".rjust(12)}

Readable version and explanation:

for n in [-1,2384626,433832,79502,8841,971,69,3,0]
  if n < 0 # n == -1
    puts "()"*6+"\n|\\3.1415926|\n|:\\53589793|"
  else
    if n > 0 # digits of pi
      puts "\\::\\#{n}|".rjust(12)
    else # edge of pie
      puts "\\__\\|".rjust(12) 
    end
  end
end

Nothing really clever, just using some simple loops :)

Output:

()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|
\$\endgroup\$
1
  • 2
    \$\begingroup\$ Welcome to PPCG! Nice first post! \$\endgroup\$
    – Riker
    Commented Sep 21, 2016 at 10:51
3
\$\begingroup\$

Charcoal, 31 bytes

×⁶()↙↓¹⁰↖↖¹⁰↓↓²↘⁸M↑__↖←¤:↗¤UGPi

Try it online!

You may be wondering: what is this sorcery? How can you fill with UGPi? Well, Charcoal is starting to get Wolfram Language support, in the hope that one day it can be competitive in more challenges!

Previous, 71 bytes

×⁶()↙↓¹⁰↖↖¹⁰↓↓²↘⁸M↑__↖←¤:↗¤3.141592653589793238462643383279502884197169

Try it online!

Verbose

Print(Multiply(6, "()"));
Move(:DownLeft)
Print(:Down, 10)
Move(:UpLeft)
Print(:UpLeft, 10)
Move(:Down)
Print(:Down, 2)
Print(:DownRight, 8)
Move(:Up)
Print("__")
Move(:UpLeft)
Move(:Left)
Fill(":")
Move(:UpRight)
Fill("3.141592653589793238462643383279502884197169")

Note that this is different as the deverbosifier automatically compresses strings and does not remove redundant commands.

With compressed strings, 52 bytes

×⁶¦()↙↓¹⁰↖↖¹⁰↓↓²↘⁸↑__↖←¤:M↗¤”i¶∧²uτ¶R›    §Q´⌈#_⮌POÞ”

xxd output

0000000: aab6 ba28 291f 14b1 b01c 1cb1 b014 14b2  ...()...........
0000010: 1eb8 125f 5f1c 11ef 3acd 1def 0469 0a01  ...__...:....i..
0000020: b275 f40a 52be 0999 9fa4 d1e0 1a23 5f86  .u..R........#_.
0000030: d04f de04                                .O..

Try it online!

\$\endgroup\$
2
\$\begingroup\$

PHP, 170 bytes

no arbritrary precision Pi in PHP? Calculating takes much more space than Copy&Paste. Doesn´t matter that the last digit here is cut, not rounded; but in 64 bit Pi the last digit gets rounded up.

for(;$i<11;)echo str_pad($i?["\\__\\","|\\","|:\\","\\::\\"][$i>9?0:min(3,$i)].[3.1415926,53589793,2384626,433832,79502,8841,971,69,3][$i-1]."|
":"
",13,$i++?" ":"()",0);

Run with php -r '<code>'

uncommented breakdown

for(;$i<11;)
    echo str_pad($i?
         ["\\__\\","|\\","|:\\","\\::\\"][$i>9?0:min(3,$i)]
        .[3.1415926,53589793,2384626,433832,79502,8841,971,69,3][$i-1]
        ."|\n"
    :"\n"
    ,13,$i++?" ":"()",0);
\$\endgroup\$
3
  • \$\begingroup\$ The output is missing 1 space (which you can fix by changing that 13 with a 14). And, for some bizarre reason, You are missing the closing parenthesis at the top. Making the change fixes the output. \$\endgroup\$ Commented Sep 18, 2016 at 12:12
  • \$\begingroup\$ PHP answers need a <?php tag, otherwise they just produce constant output. PHP Hello, World! actually depends on this. However, speaking of constant output, a PHP answer that just contains the literal cake and no <?php tag at all would beat yours by a big margin… \$\endgroup\$
    – lynn
    Commented Sep 18, 2016 at 12:28
  • \$\begingroup\$ @Lynn: PHP does not need the <?php tag when you run it with -r. \$\endgroup\$
    – Titus
    Commented Sep 18, 2016 at 12:39
2
\$\begingroup\$

Python 2, 183 171 bytes

p,d=[2384626,433832,79502,8841,971,69,3],"|\n"
c=("()"*6)+d[1]+"|\\"+`3.1415926`+d+"|:\\"+`53589793`+d
for x in range(7):c+=" "*x+"\\::\\"+`p[x]`+d
print c+" "*7+"\\__\\|"

Does't really do anything clever. Just builds up a big string then prints it out.

EDIT

Reduced to 171 after reading @Lynn's answer and learning. Sorry if it is wrong to (shamelessly) steal some bytes from you without you suggesting it. Please tell me if so and I will roll back the change.

Output

python pi.pie.py

()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|
\$\endgroup\$
6
  • \$\begingroup\$ Are you aware that print r'''(the pie)''' is 28 bytes shorter? :) \$\endgroup\$
    – lynn
    Commented Sep 18, 2016 at 12:18
  • \$\begingroup\$ @Lynn Is that not cheating? ;-) \$\endgroup\$
    – ElPedro
    Commented Sep 18, 2016 at 12:21
  • \$\begingroup\$ It's not cheating, just not very interesting (and we don't need that answer for every language, IMO. The bash answer is sufficient). More like something you'd want to mention when posting an answer like this, to acknowledge that your golfing attempt ended up being a loss. Maybe still worth posting in case someone else sees a way to take your golfing idea and improve on it, maybe beating the naive approach. \$\endgroup\$ Commented Sep 19, 2016 at 16:48
  • \$\begingroup\$ I take your comments on board @Peter. i was not trying to be disrespectful hence the smiley. Anyone can just print out an ASCII art challenge like this. I'm pretty new to this and am here to learn. If it means anything I did put a comment and a +1 on Lynn's answer when I saw that it was not just a print statement but addressed the issue in a way that totally outclassed my effort. I have learned... \$\endgroup\$
    – ElPedro
    Commented Sep 19, 2016 at 17:09
  • \$\begingroup\$ As long as your answer still has a different approach, it's fine to get ideas from other answers (in the same language or not). The only thing that would be not ok is if your answer ended up with exactly the same code as Lynn's. Usually if you see a small improvement to someone else's answer, you'd suggest that in a comment. But if you have multiple new ideas after seeing someone else's answer, you can even post your improved version as a new answer. I'm not totally sure about the etiquette of this, but I think it's fine as long as your answer is significantly different. \$\endgroup\$ Commented Sep 19, 2016 at 17:46
2
\$\begingroup\$

Stax, 63 bytes

ü?½Pi<Θ*q}ü¿▒5Ç>cdƒ±<Gw►,─ô╟▒g•iâÑ♠514Φ⌂!Ñεùáèè♂ÑD╔«dÿ47¡ô#UV•╧

Run and debug online!

Shorter than the accepted MATL answer. It would definitely be shorter if more digits were stored as the constant pi in Stax.

(What is that Pi<0 in the code?)

Explanation

Uses the ASCII equivalent to explain, which is

.()6*PVP$2ME.|\a+"|:\"a+"!RNyb2L$-!mV=223w+&O-"!{"\::\"s$+mELr"\__\"]+|>m'|+

Expalantion:

.()6*PVP$2ME.|\a+"|:\"a+
.()                           "()"
   6*P                        Print 6 times
      VP$                     First two lines of pi in the output
         2ME                  Push the two lines separately on the stack
            .|\a+             Prepend the first line with "|\"
                 "|:\"a+      Prepend the second line with "|:\"

"..."!{"\::\"s$+mELr"\__\"]+|>m'|+
"..."!                                [2384626,433832,79502,8841,971,69,3]
      {"\::\"s$+m                     Convert each element to a string and prepend "\::\"
                 ELr                  Prepend the first two lines to array
                    "\__\"]+          Append "\__\" to the converted array
                            |>        Right align text
                              m'|+    Append "|" to each array element and print
\$\endgroup\$
1
\$\begingroup\$

Java 7, 260 236 191 bytes

String d(){return"()()()()()()\n|\\3.1415926|\n|:\\53589793|\n\\::\\2384626|\n \\::\\433832|\n  \\::\\79502|\n   \\::\\8841|\n    \\::\\971|\n     \\::\\69|\n      \\::\\3|\n       \\__\\|";}

Sigh, simply outputting the pie is shorter, even with all the escaped backslashes.. >.>
Here is previous answer with a tiny bit of afford, although still not very generic or fancy (236 bytes):

String c(){String n="\n",p="|",q=p+n,x="\\::\\",s=" ",z=s;return"()()()()()()"+n+p+"\\"+3.1415926+q+p+":\\53589793"+q+x+2384626+q+s+x+433832+q+(z+=s)+x+79502+q+(z+=s)+x+8841+q+(z+=s)+x+971+q+(z+=s)+x+69+q+(z+=s)+x+3+q+(z+=s)+"\\__\\|";}

A pretty boring answer, since simply outputting the result without too much fancy things is shorter in Java than a generic approach.

Ungolfed & test code:

Try it here.

class M{
  static String c(){
    String n = "\n",
           p = "|",
           q = p + n,
           x = "\\::\\",
           s = " ",
           z = s;
    return "()()()()()()" + n + p + "\\" + 3.1415926 + q + p + ":\\53589793" + q + x + 2384626 + q + s
            + x + 433832 + q + (z += s) + x + 79502 + q + (z += s) + x + 8841 + q 
            + (z += s) + x + 971 + q + (z += s) + x + 69 + q + (z += s) + x + 3 + q
            + (z += s) + "\\__\\|";
  }

  public static void main(String[] a){
    System.out.println(c());
  }
}

Output:

()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|
\$\endgroup\$
1
\$\begingroup\$

Qbasic, 175 bytes

?"()()()()()()":?"|\3.1415926|":?"|:\53589793|":?"\::\2384626|":?" \::\433832|":?"  \::\79502|":?"   \::\8841|":?"    \::\971|":?"     \::\69|":?"      \::\3|":?"       \__\|"
\$\endgroup\$
1
\$\begingroup\$

Lua, 152 Bytes

print[[()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|]]

Try as I might I could not compress this pi.

Lua is just too verbose to do it, maybe a pi of greater size, but not this one.

Another solution, 186 Bytes.

s="()()()()()()\n|\\3.1415926|\n|:\\53589793|\n"i=0 for z in('2384626|433832|79502|8841|971|69|3|'):gmatch'.-|'do s=s..(' '):rep(i)..'\\::\\'..z.."\n"i=i+1 end print(s..'       \\__\\|')

Annoyingly Lua's pi isn't accurate enough to even fill the pi. :(

\$\endgroup\$
1
\$\begingroup\$

Javascript, 172 bytes

Paste into your console to run.

for(y=n=0,s=`()()()()()()
`;y<10;y++,s+=`|
`)for(x=-2;x++<9;)s+=x>y(Math.PI+'2384626433832795028841971693'[n++]:`\\${y>8?'__':x+1|y>1?'::':'||'}\\`[y-x]||' ';console.log(s)
\$\endgroup\$
2
  • \$\begingroup\$ Welcome to PPCG! Just so you know, you can format your code with four spaces (see my edit). Also, put the amount of bytes in your program at the top of your answer (e.g. Javascript: 100 bytes). \$\endgroup\$
    – clismique
    Commented Sep 21, 2016 at 10:31
  • \$\begingroup\$ Seems to have weird syntax errors, can you fix those? \$\endgroup\$
    – user58826
    Commented Apr 19, 2017 at 17:58
1
\$\begingroup\$

Deadfish~, 871 bytes

{iiii}cicdcicdcicdcicdcicdcic{ddd}dc{{i}}{i}iiiic{ddd}ddc{dddd}dcdddddciiiciiicdddciiiiciiiic{d}iiiciiiic{{i}ddd}c{{d}}{d}ddddc{{i}}{i}iiiic{dddddd}ddddddc{iii}iiiic{dddd}icddciiciiicicddciicddddddc{{i}ddd}iiic{{d}}{d}ddddc{{i}dd}iic{ddd}ddddcc{iii}iiiic{dddd}ddciciiiiicddddciicddddciiiic{{i}ddd}c{{d}}{d}ddddc{ii}iic{iiiiii}c{ddd}ddddcc{iii}iiiic{dddd}cdcciiiiicdddddcdc{{i}ddd}iiiic{{d}}{d}ddddc{ii}iicc{iiiiii}c{ddd}ddddcc{iii}iiiic{dddd}iiiciicddddcdddddciic{{i}ddd}iiiic{{d}}{d}ddddc{ii}iiccc{iiiiii}c{ddd}ddddcc{iii}iiiic{ddd}ddddddccddddcdddc{{i}ddd}iiiiic{{d}}{d}ddddc{ii}iicccc{iiiiii}c{ddd}ddddcc{iii}iiiic{ddd}dddddcddcddddddc{{i}ddd}iiiiic{{d}}{d}ddddc{ii}iiccccc{iiiiii}c{ddd}ddddcc{iii}iiiic{dddd}iiciiic{{i}ddd}dddc{{d}}{d}ddddc{ii}iicccccc{iiiiii}c{ddd}ddddcc{iii}iiiic{dddd}dc{{i}ddd}iiic{{d}}{d}ddddc{ii}iiccccccc{iiiiii}ciiiccdddc{iii}iic{{d}}{d}ddddc

Try it online!

Just because.

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

JavaScript (ES6), 170 bytes 165 bytes

is a bit "cheated", since if run on the console, the return value would be displayed

v=0;("()()()()()()\n|9|:87654321".replace(/\d/g,(o)=>"\\"+(Math.PI+'2384626433832795028841971693').substr(v,o,v-=-o)+"|\n"+(o<9?" ".repeat(8-o)+(o>1?"\\::":"\\__\\|"):""))

After some teaking, the function looks like this(function must be called with parameter with the value 0):

v=>`()()()()()()
 |9 |:87654321\\__\\|`.replace(/\d/g,o=>`\\${(Math.PI+"2384626433832795028841971693").substr(v,o,v-=-o)}|
${" ".repeat(9-o)+(o<9&o>1?"\\::":"")}`)

If you want to call the function 167 bytes:

z=v=>`()()()()()()
 |9 |:87654321\\__\\|`.replace(/\d/g,o=>`\\${(Math.PI+"2384626433832795028841971693").substr(v,o,v-=-o)}|
${" ".repeat(9-o)+(o<9&o>1?"\\::":"")}`)


/*could be run like this or directly in the console*/
console.info("\n"+z(0));

\$\endgroup\$
6
  • \$\begingroup\$ 1: Needs extra closing paren. 2: replace "|\n" with |<newline> where <newline> is a literal newline. 3: Add y=> to the beginning and it won't be cheating. 4: Welcome to the site! \$\endgroup\$
    – user58826
    Commented Apr 19, 2017 at 17:55
  • 1
    \$\begingroup\$ @programmer5000 thanks for your input, I used it on my latest tweak. :-D \$\endgroup\$ Commented Apr 20, 2017 at 11:40
  • \$\begingroup\$ Save 2 bytes by removing the () enclosing the v parameter. Your output seems to have an extra space in front of the 2nd & 3rd lines. Also, you don't need to pass 0 as an argument, your function will work fine without it and it's also not permitted by the challenge. \$\endgroup\$
    – Shaggy
    Commented Apr 20, 2017 at 11:54
  • \$\begingroup\$ yes thank you, I had before default value. :-D \$\endgroup\$ Commented Apr 20, 2017 at 12:23
  • \$\begingroup\$ This is longer than the string itself. \$\endgroup\$
    – emanresu A
    Commented May 28, 2022 at 8:51
0
\$\begingroup\$

PHP, 142 bytes

Sneaky-sneaky :) php just prints everything out without trying to interpret them as PHP code if it does not see any <?php ?> pairs.

()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|
\$\endgroup\$
0
\$\begingroup\$

Husk, 76 bytes

`:+R' 7"¦__¦|":*"()"6§+(mo:'|t↑2)↓2m↓3z+zR¢" "Nmo`:'|+"¦::¦"Cṫ9Γ·::'.ṁs↑54İπ

Try it online!

There's probably some interesing way to shorten this further.

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

Vyxal, 64 bytes

‛()6*15∆Iṅ\.1Ṁ½÷$‛|\p$`|:\\`p"43∆I16ȯ7ɾṘẇvṅ‛\:mvp‛\_mJJ\|vJJ12↳⁋

Try it Online!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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