18
\$\begingroup\$

The following is an unfolded milk carton:

+-----+-\|/-+-----+-\|/-+-+
|     | / \ |     | / \ | |
+-----+/---\+-----+/---\+-+
|     |     |     |     | |
|     |     |     |     | |
|     |     |     |     | |
+-----+-----+-----+-----+-+
 \   / \   / \   / \   /   
  \_/   \_/   \_/   \_/    

This is a challenge. Your task is to output the above ASCII-art milk carton.

Your output may have any whitespace that does not affect the appearance of the image.

\$\endgroup\$

11 Answers 11

7
\$\begingroup\$

Charcoal, 49 bytes

F⁷B⁻⁹&²ι⁻⁷&⁴ιP“↗⎇≦∨⎚üUP@>⁼γa”C⁶¦⁰M⁹→P^³M←\|/C¹²¦⁰

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

F⁷B⁻⁹&²ι⁻⁷&⁴ι

Draw the front and what will become the overlap.

P“↗⎇≦∨⎚üUP@>⁼γa”

Draw one of the flaps at the bottom.

C⁶¦⁰

Copy the front to the side.

M⁹→P^³M←\|/

Draw the folds on the side.

C¹²¦⁰

Copy to the back and other side.

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

Python, 133 bytes

for x in b"WwwWB7WQ&ff&6F&!WwwSwtWQ&ff&!&ff&!&ff&!WwwWQdfcfafH6fa".hex().translate(9*"_,|/\+ -").split(","):print((3*x[:-3]+x)[-27:])

Attempt This Online!

Python, 137 bytes

print(b"YWB7YWB7WQ(&6F(&6F&!YSwtYSwtWQ((((&!((((&!((((&!YYYYWQdfcdfcdfcdfca````".hex().translate(9*[*"|/\+ -",5*" ",5*"-"," \_/ ","\n"]))

Attempt This Online!

Could probably save a few more bytes allowing nonprintables.

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

Vim, 100 99 97 bytes

4i+-----<Esc>a+-+<Esc>yyppO<Esc>4i|     <Esc>a| |<Esc>yyPPkPk8lqqR\|/<Esc>jr\jlr\4hr/klr/qk12l@qGo<Esc>4a \   /<Esc>o<Esc>4a   \_/<Esc>0x­⁡​‎‎

Where <Esc> is escape key.

Try it online?

This is probably my first vim answer. Any help is welcome in the comments.

-1 byte by changing 3h3xr+ to a+-+<Esc>

-2 bytes by changing qqr\jr/jhr/4lr\khr\kr/hr|q11l@q to qqR\|/<Esc>jr\jlr\4hr/klr/qk12l@q

Explanation:

The explanation is separated into 5 smaller sections.

1

4i+-----<Esc>a+-+<Esc>­⁡​‎‎­⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏⁠‎⁡⁠⁣‏⁠‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏⁠‎⁡⁠⁣⁡‏⁠‎⁡⁠⁣⁢‏⁠‎⁡⁠⁣⁣‏⁠‎⁡⁠⁣⁤‏⁠‎⁡⁠⁤⁡‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁤⁢‏⁠‎⁡⁠⁤⁣‏⁠‎⁡⁠⁤⁤‏⁠‎⁡⁠⁢⁡⁡‏⁠‎⁡⁠⁢⁡⁢‏⁠‎⁡⁠⁢⁡⁣‏⁠‎⁡⁠⁢⁡⁤‏⁠‎⁡⁠⁢⁢⁡‏⁠‎⁡⁠⁢⁢⁢‏‏​⁡⁠⁡‌­
4i+-----<Esc>                # ‎⁡insert "+-----" 4 times
             a+-+<Esc>       # ‎⁢put "+-+" in the end of line

2

yyppO<Esc>4i|     <Esc>a| |<Esc>­⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏⁠‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁣‏⁠‎⁡⁠⁤‏⁠‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏⁠‎⁡⁠⁣⁡‏⁠‎⁡⁠⁣⁢‏⁠‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁣⁣‏⁠‎⁡⁠⁣⁤‏⁠‎⁡⁠⁤⁡‏⁠‎⁡⁠⁤⁢‏⁠‎⁡⁠⁤⁣‏⁠‎⁡⁠⁤⁤‏⁠‎⁡⁠⁢⁡⁡‏⁠‎⁡⁠⁢⁡⁢‏⁠‎⁡⁠⁢⁡⁣‏⁠‎⁡⁠⁢⁡⁤‏⁠‎⁡⁠⁢⁢⁡‏⁠‎⁡⁠⁢⁢⁢‏⁠‎⁡⁠⁢⁢⁣‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁢⁢⁤‏⁠‎⁡⁠⁢⁣⁡‏⁠‎⁡⁠⁢⁣⁢‏⁠‎⁡⁠⁢⁣⁣‏⁠‎⁡⁠⁢⁣⁤‏⁠‎⁡⁠⁢⁤⁡‏⁠‎⁡⁠⁢⁤⁢‏⁠‎⁡⁠⁢⁤⁣‏⁠‎⁡⁠⁢⁤⁤‏‏​⁡⁠⁡‌­
yy                                # ‎⁡‎⁤copy the entire line (not sure why Y doesn't work for me)
  pp                              # ‎⁢paste 2 times
    O<Esc>                        # ‎⁣make a new line above the current line
          4i|     <Esc>           # ‎⁤insert "|     " 4 times
                       a| |<Esc>  # ‎⁢⁡‎⁢⁤put the "| |" in end of line

3

yyPPkPk8l­⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁣‏⁠‎⁡⁠⁤‏⁠‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁢⁡‏⁠‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁢⁢‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁢⁣‏⁠⁠‏​⁡⁠⁡‌⁢⁢​‎‎⁡⁠⁢⁤‏⁠‎⁡⁠⁣⁡‏‏​⁡⁠⁡‌­
yy         # ‎⁡copy the entire line
  PP       # ‎⁢paste two times (above the current line)
    k      # ‎⁣move up
     P     # ‎⁤paste above of the line
      k    # ‎⁢⁡‎⁤⁡move up
       8l  # ‎⁢⁢move right 8 cells

4

qqR\|/<Esc>jr\jlr\4hr/klr/qk12l@q­⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁣‏⁠‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏⁠‎⁡⁠⁣⁡‏⁠‎⁡⁠⁣⁢‏⁠‎⁡⁠⁣⁣‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁣⁤‏⁠‎⁡⁠⁤⁡‏⁠‎⁡⁠⁤⁢‏‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁤⁣‏⁠‎⁡⁠⁤⁤‏⁠‎⁡⁠⁢⁡⁡‏⁠‎⁡⁠⁢⁡⁢‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁢⁡⁣‏⁠‎⁡⁠⁢⁡⁤‏‏​⁡⁠⁡‌⁢⁢​‎‎⁡⁠⁢⁢⁡‏⁠‎⁡⁠⁢⁢⁢‏‏​⁡⁠⁡‌⁢⁣​‎‎⁡⁠⁢⁢⁣‏⁠‎⁡⁠⁢⁢⁤‏⁠‎⁡⁠⁢⁣⁡‏⁠‎⁡⁠⁢⁣⁢‏‏​⁡⁠⁡‌⁢⁤​‎‎⁡⁠⁢⁣⁣‏⁠⁠⁠‏​⁡⁠⁡‌⁣⁡​‎‎⁡⁠⁢⁣⁤‏⁠⁠⁠‏​⁡⁠⁡‌⁣⁢​‎‎⁡⁠⁢⁤⁡‏⁠‎⁡⁠⁢⁤⁢‏⁠‎⁡⁠⁢⁤⁣‏‏​⁡⁠⁡‌⁣⁣​‎‎⁡⁠⁢⁤⁤‏⁠‎⁡⁠⁣⁡⁡‏‏​⁡⁠⁡‌­
qq                                 # ‎⁡record in the register q
  R\|/<Esc>                        # ‎⁢replace the actual cell with '\', then the next cell '|', then the next cell '/'.
           jr\                     # ‎⁣move down, replace the actual cell with '\'
              jlr\                 # ‎⁤move down, then right, then replace the actual cell with '\'
                  4h               # ‎⁢⁡move left 4 times
                    r/             # ‎⁢⁢replace the actual cell with '/'
                      klr/         # ‎⁢⁣move up, then right, then replace the actual cell with '/'
                          q        # ‎⁢⁤stop recording
                           k       # ‎⁣⁡move up
                            12l    # ‎⁣⁢move right 12 times
                               @q  # ‎⁣⁣playback register 'q'

5

Go<Esc>4a \   /<Esc>o<Esc>4a   \_/<Esc>0x­⁡​‎‎­⁡​‎‎⁡⁠⁡‏‏​⁡⁠⁡‌⁢​‎⁠‎⁡⁠⁢‏⁠‎⁡⁠⁣‏⁠‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁣⁡‏⁠‎⁡⁠⁣⁢‏⁠‎⁡⁠⁣⁣‏⁠‎⁡⁠⁣⁤‏⁠‎⁡⁠⁤⁡‏⁠‎⁡⁠⁤⁢‏⁠‎⁡⁠⁤⁣‏⁠‎⁡⁠⁤⁤‏⁠‎⁡⁠⁢⁡⁡‏⁠‎⁡⁠⁢⁡⁢‏⁠‎⁡⁠⁢⁡⁣‏⁠‎⁡⁠⁢⁡⁤‏‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁢⁢⁡‏⁠‎⁡⁠⁢⁢⁢‏⁠‎⁡⁠⁢⁢⁣‏⁠‎⁡⁠⁢⁢⁤‏⁠‎⁡⁠⁢⁣⁡‏⁠‎⁡⁠⁢⁣⁢‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁢⁣⁣‏⁠‎⁡⁠⁢⁣⁤‏⁠‎⁡⁠⁢⁤⁡‏⁠‎⁡⁠⁢⁤⁢‏⁠‎⁡⁠⁢⁤⁣‏⁠‎⁡⁠⁢⁤⁤‏⁠‎⁡⁠⁣⁡⁡‏⁠‎⁡⁠⁣⁡⁢‏⁠‎⁡⁠⁣⁡⁣‏⁠‎⁡⁠⁣⁡⁤‏⁠‎⁡⁠⁣⁢⁡‏⁠‎⁡⁠⁣⁢⁢‏⁠‎⁡⁠⁣⁢⁣‏‏​⁡⁠⁡‌⁢⁢​‎‎⁡⁠⁣⁢⁤‏⁠‎⁡⁠⁣⁣⁡‏⁠⁠⁠‏​⁡⁠⁡‌­
G                                               # ‎⁡go to the last line
 o<Esc>                                         # ‎⁢‎⁢⁤⁢make a new line.
        a \   /<Esc>                            # ‎⁣‎⁢⁤⁣insert " \   /" 4 times
                    o<Esc>                      # ‎⁤‎⁢⁤⁤make a new line below the line
                          4a   \_/<Esc>         # ‎⁢⁡insert "   \_/" 4 times
                                       0x       # ‎⁢⁢delete the first character of the line
💎

Every section is created with the help of Luminespire.

\$\endgroup\$
4
  • \$\begingroup\$ FYI, the diamond left by Luminespire is for statistics reasons. \$\endgroup\$
    – noodle man
    Dec 7, 2023 at 0:44
  • \$\begingroup\$ @noodleman, So, should I put the diamond in all sections, or should I remove the diamond? \$\endgroup\$
    – Fmbalbuena
    Dec 7, 2023 at 16:35
  • \$\begingroup\$ Do what you want, it might be better to have the diamond but you probably don't need it more than once per answer. \$\endgroup\$
    – noodle man
    Dec 7, 2023 at 16:46
  • \$\begingroup\$ Using Y instead of yy works fine for me; I think you should be fine to mark this as 95 bytes. \$\endgroup\$ Dec 8, 2023 at 23:55
4
\$\begingroup\$

Vyxal 3, 65 bytes

81ᶴ|+y81ᶴ -y3YJṅ"ᶜgṢṆĊ“"|- \/"y⁻'-4«+JD2ΘṅWfT“" \   /  \_/ "½ddJ”

Try it Online!

Explanation:

81ᶴ|+y81ᶴ -y3YJṅ"ᶜgṢṆĊ“"|- \/"y⁻'-4«+JD2ΘṅWfT“" \   /  \_/ "½ddJ”­⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏⁠⁠⁠⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏⁠‎⁡⁠⁣⁤‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏⁠‎⁡⁠⁣⁢‏⁠‎⁡⁠⁣⁣‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁤⁡‏⁠‎⁡⁠⁤⁢‏⁠‎⁡⁠⁤⁣‏⁠‎⁡⁠⁤⁤‏‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁢⁡⁡‏⁠‎⁡⁠⁢⁡⁢‏⁠‎⁡⁠⁢⁡⁣‏⁠‎⁡⁠⁢⁡⁤‏⁠‎⁡⁠⁢⁢⁡‏⁠‎⁡⁠⁢⁢⁢‏⁠‎⁡⁠⁢⁢⁣‏⁠‎⁡⁠⁢⁢⁤‏⁠‎⁡⁠⁢⁣⁡‏⁠‎⁡⁠⁢⁣⁢‏⁠‎⁡⁠⁢⁣⁣‏⁠‎⁡⁠⁢⁣⁤‏⁠‎⁡⁠⁢⁤⁡‏⁠‎⁡⁠⁢⁤⁢‏⁠‎⁡⁠⁢⁤⁣‏⁠‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁢⁤⁤‏⁠‏​⁡⁠⁡‌⁢⁢​‎⁠⁠‎⁡⁠⁣⁡⁡‏⁠‎⁡⁠⁣⁡⁢‏⁠‎⁡⁠⁣⁡⁣‏⁠‎⁡⁠⁣⁡⁤‏⁠‎⁡⁠⁣⁢⁡‏⁠‎⁡⁠⁣⁢⁢‏‏​⁡⁠⁡‌⁢⁣​‎‎⁡⁠⁣⁢⁤‏⁠‎⁡⁠⁣⁣⁡‏⁠‎⁡⁠⁣⁣⁢‏‏​⁡⁠⁡‌⁢⁤​‎‎⁡⁠⁣⁢⁣‏⁠‎⁡⁠⁣⁣⁣‏⁠‎⁡⁠⁣⁣⁤‏⁠‎⁡⁠⁣⁤⁡‏⁠‎⁡⁠⁣⁤⁢‏⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠‏​⁡⁠⁡‌⁣⁡​‎⁠⁠⁠⁠‎⁡⁠⁣⁤⁣‏⁠‎⁡⁠⁣⁤⁤‏⁠‎⁡⁠⁤⁡⁡‏⁠‎⁡⁠⁤⁡⁢‏⁠‎⁡⁠⁤⁡⁣‏⁠‎⁡⁠⁤⁡⁤‏⁠‎⁡⁠⁤⁢⁡‏⁠‎⁡⁠⁤⁢⁢‏⁠‎⁡⁠⁤⁢⁣‏⁠‎⁡⁠⁤⁢⁤‏⁠‎⁡⁠⁤⁣⁡‏⁠‎⁡⁠⁤⁣⁢‏⁠‎⁡⁠⁤⁣⁣‏⁠‎⁡⁠⁤⁣⁤‏‏​⁡⁠⁡‌⁣⁢​‎‎⁡⁠⁤⁤⁤‏⁠‎⁡⁠⁢⁡⁡⁡‏‏​⁡⁠⁡‌­
81   y81   y                                                       # ‎⁡Base decompress 81 twice with chars ...
   |+     -                                                        # ‎⁢... "|+" and " -" (push "+|+|||+", "- -   -")
            3YJṅ                                                   # ‎⁣Repeat latter three times, join and palindromise
                "ᶜgṢṆĊ“"|- \/"y                                    # ‎⁤Base decompress "ᶜgṢṆĊ“ (9709170788) with chars "|- \/" (push "- /\/-| -/\-- \")
                               ⁻                                   # ‎⁢⁡Split into chunks of length 3
                                '-4«+J                             # ‎⁢⁢Append "-" and 3 spaces to each item, merge lists
                                       2Θṅ                         # ‎⁢⁣Palindromise first two elements
                                      D   WfT“                     # ‎⁢⁤Insert result between two copies of the list, transpose
                                              " \   /  \_/ "       # ‎⁣⁡Halve string, quadruple each half
                                                               J”  # ‎⁣⁢Join with transposed list and format
💎

Created with the help of Luminespire.

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

///, 147 141 bytes

/l/\/\///a/|     lb/-----lc/aaaa| |
lf/ d   elg/  d_e lh/a| e d li/b+lj/+ie---dlk/+i-d|e-ld/\\\\le/\\\lkk+-+
hh| |
jj+-+
ccc+iiii-+
ffff
gggg

Try it online!

I'm not going to explain this one.

-6 bytes thanks to @Philippos

\$\endgroup\$
2
  • \$\begingroup\$ Why not 141 bytes \$\endgroup\$
    – Philippos
    Dec 8, 2023 at 12:42
  • \$\begingroup\$ @Philippos Done! \$\endgroup\$
    – Fmbalbuena
    Dec 8, 2023 at 16:34
2
\$\begingroup\$

05AB1E, 71 bytes

"+---
|".B4и¨D1è4ǝ… \ Ćª„\_2úª.ºD"+-\|
| /
+/--".B.º2Ýǝ€¦øJεD¦y2£R'\KJ,

Try it online.

Explanation:

Try it online with step-by-step debug lines.

"+---
|"           # Push string "+---\n|"
  .B         # Box it to ["+---","|   "]
    4и       # Repeat it 4 times
      ¨      # Remove the last item
       D     # Duplicate it
        1è   # Pop the copy and get the 0-based 1st item
          4ǝ # Insert it at the 0-based 4th index
… \          # Push string " \ "
    Ć        # Enclose it; append its own head: " \  "
     ª       # Append it to the list
„\_          # Push string "\_"
   2ú        # Pad 2 leading spaces: "  \_"
     ª       # Append it to the list as well
.º           # Mirror each inner string with overlap
D            # Duplicate this list
 "+-\|
| /
+/--"        # Push string "+-\|\n| /\n+/--"
     .B      # Box it to ["+-\|","| / ","+/--"]
       .º    # Mirror each inner string with overlap
         2Ý  # Push list [0,1,2]
           ǝ # Replace the strings at those three indices with this triplet-string
 €¦          # Remove the first character of each inner string
   øJ        # Join the lines in the two lists together
ε            # Map over each line (used as foreach):
 D           #  Duplicate the line
  ¦          #  Remove the first character of the copy
   y         #  Push the current line yet again
    2£       #  Only leave its first two characters
      R      #  Reverse it
       '\K  '# Remove a potential "\" from this string
          J  # Join all three strings on the stack together
           , # Pop and output it with trailing newline
\$\endgroup\$
2
\$\begingroup\$

Retina, 108 105 102 bytes


2*$(a+-\|/-)h2*$(b| / \ )| |¶2*$(a+/---\)h3*$(4*b| |¶)4*ah4*$( \   /)¶4*$(  \_/ 
a
+5*-
b
|5* 
h
+-+¶

Attempt This Online!

This is my first time using Retina so this can probably be improved on. This program uses Retina's repetition operator * extensively.

I'm hoping to reduce the repeated part of 2*$(a+-\|/-)h2*$(b| / \ )| |¶2*$(a+/---\)h (the 2*$(a+something)h bit). Any ideas?

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

sed, 151 bytes

s_^_+-----+-\\|/-_
s/.*/&&+-+/
h
p
y_/\\-|+_\\/  |_
p
x
s_..|.._/---\\_gp
x
y_/\\_  _
p
p
p
x
y_/\\_--_
p
s_.*_ \\   /_
s__&&&&_p
sx\\   x  \\_xg
s_ __

Try it online!

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

JavaScript (ES11), 143 bytes

A mix of maths and hardcoded XOR patterns.

f=(y=9,x)=>~y?` |-+/\\_
`[X=--x%6,x?y<2?x<3|X+~y?X+y-5?X|y?0:6:4:5:["70006","0504","0637"][y-6]?.[x%12-4]^648>>y&2|X==3|x<2:7]+f(y-!x,x||28):""

Attempt This Online!

For comparison, using RegPack gives 170 bytes.

Method

We iterate from \$y=8\$ at the top to \$y=0\$ at the bottom, and from \$x=27\$ on the left to \$x=0\$ on the right. We also use \$X=x\bmod 6\$. Note that we have \$X=0\$ when we're at the middle of a bottom notch.

  2       1         0
  7654321098765432109876543210 <-- x
8 +-----+-\|/-+-----+-\|/-+-+\n
7 |     | / \ |     | / \ | |\n
6 +-----+/---\+-----+/---\+-+\n
5 |     |     |     |     | |\n
4 |     |     |     |     | |\n
3 |     |     |     |     | |\n
2 +-----+-----+-----+-----+-+\n
1  \   / \   / \   / \   /   \n
0   \_/   \_/   \_/   \_/    \n
  3210543210543210543210543210 <-- X

The 8 distinct characters used in the ASCII art are encoded as follows:

0 1 2 3 4 5 6 7
  | - + / \ _ \n

The following algorithm is used to select the correct character code:

x ?                // if this is not the end of line:
  y < 2 ?          //   if this is the bottom part:
    x < 3 |        //     if this is the rightmost part
    X + ~y ?       //     or X - y is not equal to 1:
      X + y - 5 ?  //       if X + y is not equal to 5:
        X | y ?    //         if X != 0 or y != 0:
          0        //           insert a space
        :          //         else:
          6        //           insert "_"
      :            //       else:
        4          //         insert "/"
    :              //     else:
      5            //       insert "\"
  :                //   else:
    [ "70006",     //     these are the XOR patterns
      "0504",      //     to apply for the most
      "0637" ]     //     complicated cuts at the top
    [y - 6]        //     i.e for 6 <= y <= 8
    ?.[x % 12 - 4] //     they are applied modulo 12
    ^              //
    648 >> y & 2 | //     this gives 2 for y in [2, 6, 8]
    X == 3 |       //     standard vertical lines
    x < 2          //     rightmost vertical line
:                  // else:
  7                //   insert a linefeed
\$\endgroup\$
1
\$\begingroup\$

PowerShell, 139

$m='-----+';"$("+$m-\|/-"*2)+-+
|$('     | / \ |'*2) |
$("+$m/---\"*2)+-+"
,"$('|     '*4)| |"*3
"+$($m*4)-+
 $(,'\   /'*4)
 $(,' \_/ '*4)"

Not very golfed right now, but it's late

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

Perl 5 + -M5.10.0, 133 bytes

$;="+-----";say"$;+-\\|/-"x2,$e="+-+
",'|     | / \ 'x2,$d="| |
","$;+/---\\"x2,$e,("|     "x4,$d)x3,$;x4,$e,' \   /'x4,$/,'  \_/ 'x4

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.