title: Text compression

text:
# Question
Title: Text compression
With the given text below, there are some words in the text that repeats several times in the text. Use any programming language to write a short code that compresses the text to display it. Or in other words, use the smallest number of bytes to display the text.
The Text is:

```
Peter Piper picked a peck of pickled peppers.
A peck of pickled peppers Peter Piper picked.
If Peter Piper picked a peck of pickled peppers,
Where's the peck of pickled peppers Peter Piper picked?

```

# Answer
# , 106 bytes

```
"["=gsub
cat(1["Peter Piper picked",2[" peck of pickled peppers","1 a2.
A2 1.
If 1 a2,
Where's the2 1?"]])

```

Try it online!
> 10 votes

# Answer
# Jelly,  ~~80 73 72 68 67 61~~  57 bytes

```
“¡ŀṪ]ṃ{yṁ“Ñ3$ṘW5Ḍż⁸¢Hŀ“³ḌM“¡FỊİg“ÑɲʋØƥþƈƘ}“ṣɠ»“Ƙ9~ḷ’ṃFḊ”?

```

**Try it online!**

### How?

```
“...“...“...“...“...“...»“Ƙ9~ḷ’ṃFḊ”? - Main Link: no arguments
“...“...“...“...“...“...»            - list of compressed strings
                                     -   = [" Peter Piper picked",
                                     -      " peck of pickled peppers",
                                     -      ".\nA",
                                     -      ".\nIf",
                                     -      ",\nWhere's the",
                                     -      " a"]
                         “Ƙ9~ḷ’      - base 250 literal X = 2331781969
                               ṃ     - base decompress - i.e. use the list of strings as if
                                     -   they were the digits [1,2,3,4,5,0]
                                     -   X in base 6 is [1,0,2,3,2,1,4,1,0,2,5,2,1], so:
                                     -   [" Peter Piper picked",
                                     -    " a",
                                     -    " peck of pickled peppers",
                                     -    ".\nA"," peck of pickled peppers",
                                     -    " Peter Piper picked",
                                     -    ".\nIf",
                                     -    " Peter Piper picked",
                                     -    " a",
                                     -    " peck of pickled peppers",
                                     -    ",\nWhere's the",
                                     -    " peck of pickled peppers",
                                     -    " Peter Piper picked"]
                                F    - flatten
                                 Ḋ   - dequeue (remove the leading space)
                                  ”? - literal '?' character (causes print of previous)
                                     - implicit print (of the '?' character)

```
> 8 votes

# Answer
# JavaScript (SpiderMonkey), 114 bytes

```
print(`0 a1.
A1 0.
If 0 a1,
Where's the1 0?`.replace(/\d/g,n=>+n?' peck of pickled peppers':'Peter Piper picked'))

```

Try it online!

I would claim this answer is from ovs, anyway, 19 bytes saved.

Thanks Arnauld, saves 3 bytes.
> 5 votes

# Answer
# Bubblegum, ~~73~~ 71 bytes

```
00000000: 0b48 2d49 2d52 08c8 2c00 9205 99c9 d9a9  .H-I-R..,.......
00000010: 290a 890a 05a9 c9d9 0af9 6960 819c d414  ).........i`....
00000020: 20bf 0028 5fac c7e5 884b 4a01 d31c 3d2e   ..(_....KJ...=.
00000030: cf34 0552 8cd7 e10a cf48 2d4a 552f 5628  .4.R.....H-JU/V(
00000040: c948 25c1 227b 00                        .H%."{.

```

Try it online!
> 5 votes

# Answer
# Jelly, ~~64~~ ~~60~~ ~~58~~ 57 bytes

```
“¡ŀṪ]ṃ{yṁ“Ñ3$ṘW5Ḍż⁸¢Hŀ»j⁾ a,Ṛẋ2ż“³ḌM“¡FỊİg“ÑɲʋØƥþƈƘ}»FḊ”?

```

Try it online!
> 4 votes

# Answer
# Python 2, 115 bytes

```
a="Peter Piper picked"
b=" peck of pickled peppers"
print a,"a%s.\nA"%b+b,a+".\nIf",a,"a%s,\nWhere's the"%b+b,a+"?"

```

Try it online!

Prints multiple commas-separated strings to put spaces in between them.

---

# Python 3, 115 bytes

```
print("1 a2.\nA2 1.\nIf 1 a2,\nWhere's the2 1?".translate({49:"Peter Piper picked",50:" peck of pickled peppers"}))

```

Try it online!

Python 3's `translate` does the heavy lifting. Using non-printable characters with single-digit ASCII value should save two bytes.
> 4 votes

# Answer
# Bash, 99

* 4 bytes saved thanks to @manatwork.

```
echo "${P=Peter Piper picked} a${p= peck of pickled peppers}.
A$p $P.
If $P a$p,
Where's the$p $P?"

```

Try it online!
> 3 votes

# Answer
# , ~~99~~ 87 bytes

<sup>-12 bytes: turns out 2 substitutions are shorter which is basically the same as everyone else's solution (except Bubblegum?)</sup>

```
i1 a0.
A0 1.
If 1 a0,
Where's the0 1?Í0/ peck of pickled peppers
Í1/Peter Piper picked

```

Try it online!
> 2 votes

# Answer
# Java (JDK), 123 bytes

```
v->"".format("%s a%s.%nA%2$s %1$s.%nIf %1$s a%2$s,%nWhere's the%2$s %1$s?","Peter Piper picked"," peck of pickled peppers")

```

Try it online!
> 2 votes

# Answer
# Python 3, ~~120~~ ~~117~~ 116 bytes

```
a,b="Peter Piper picked"," peck of pickled peppers"
exit(f"{a} a{b}.\nA{b} {a}.\nIf {a} a{b},\nWhere's the{b} {a}?")

```

Format strings were shorter than addition(129 bytes) and a join(140 bytes).

-3 thanks to Jo King, -1 thanks to Jonathan Allen
> 2 votes

# Answer
# Twig, 105 bytes

This uses a simple replacement to fill in the gaps.

Twig's `replace()` filter allows you to define the values to replace as the keys of an hash. Luckly, it also works with arrays, as they have numerical keys.

```
{{"0a1.
A1 0.
If 0 a1,
Where's the1 0?"|replace(["Peter Piper picked"," peck of pickled peppers"])|raw}}

```

The `|raw` is needed to avoid escaping, which turned `Where's` into `Where's`.

You can try it on https://twigfiddle.com/phqpts

---

Since this is compiled down to PHP, the equivalent for PHP would be:

```
<?php
    $array = array("Peter Piper picked", " peck of pickled peppers");
    $string = "0 a1.
A1 0.
If 0 a1,
Where's the1 0?";

    echo str_replace(array_keys($array), $array, $string);

```

Which can be shortened significatively.
> 2 votes

# Answer
# Ruby, 104 bytes

```
/ a/=~$a="Peter Piper picked a peck of pickled peppers"
puts"#$a.
A#$' #$`.
If #$a,
Where's the#$' #$`?"

```

Try it online!
> 2 votes

# Answer
# sed, ~~101~~ 100 bytes

```
s/^/0 a1.\nA1 0.\nIf 0 a1,\nWhere's the1 0?/
s/0/Peter Piper picked/g
s/1/ peck of pickled peppers/g

```

Try it online!

-1 byte thanks to @DigitalTrauma
> 1 votes

# Answer
# ///, 86 bytes

```
/1/Peter Piper picked//2/ peck of pickled peppers/1 a2.
A2 1.
If 1 a2,
Where's the2 1?

```

Try it online!
> 1 votes

# Answer
# C (gcc), 123 bytes

```
f(){printf("%s a%s.\nA%2$s %1$s.\nIf %1$s a%2$s,\nWhere's the%2$s %1$s?","Peter Piper picked"," peck of pickled peppers");}

```

Try it online!
> 1 votes

# Answer
# Clean, 166 bytes

```
import StdEnv,Text;f="peck of pickled";g="picked";u="peppers";p="Peter Piper";s=join" "[p,g,"a",f,u+".\nA",f,u,p,g+".\nIf",p,g,"a",f,u+",\nWhere's","the",f,u,p,g+"?"]

```

Try it online!
> 1 votes

# Answer
# jq, 110 characters

(106 characters code + 4 characters command line options)

```
"1 a2.
A2 1.
If 1 a2,
Where's the2 1?"|gsub("1";"Peter Piper picked")|gsub("2";" peck of pickled peppers")

```

Sample run:

```
bash-4.4$ jq -nr '"1 a2.
A2 1.
If 1 a2,
Where'"'"'s the2 1?"|gsub("1";"Peter Piper picked")|gsub("2";" peck of pickled peppers")'
Peter Piper picked a peck of pickled peppers.
A peck of pickled peppers Peter Piper picked.
If Peter Piper picked a peck of pickled peppers,
Where's the peck of pickled peppers Peter Piper picked?

```

Try it online!
> 1 votes

# Answer
# SQL Server, 211

```
declare @a char(18)='Peter Piper picked'
declare @b char(24)=' peck of pickled peppers'
declare @c char=char(10)
print @a+' a'+@b+'.'+@c+'A'+@b+' '+@a+'.'+@c+'If '+@a+' a'+@b+','+@c+'Where''s the'+@b+' '+@a+'?'

```

db\<\>fiddle
> 1 votes

# Answer
# T-SQL, 137 bytes

```
SELECT p+a+k+'.
A'+k+' '+p+'.
If '+p+a+k+',
Where''s the'+k+' '+p+'?'
FROM(SELECT'Peter Piper picked'p,' a'a,' peck of pickled peppers'k)b

```

That last return before the `FROM` is for readability only, the rest are part of the string concatenation.

Different method than SeanC's SQL solution.
> 1 votes

# Answer
# Stax, ~~60~~ 56 bytes

```
╣lF╤╨┴+Y╟W╪▄,○F«↑•L°T»`┼◄ü√}x![Ñ$Θ☼²qσQ¼▬ôZ¡▄╙╥⌂å╛►¶▓&╗s

```

Run and debug it
> 1 votes

# Answer
## Windows Batch, 179 bytes

```
4D534346000000009C00000000000000
2C000000000000000301010001000000
000000004200000001000100DF000000
000000000000544DB5682000612E6261
7400E59D45D15200DF00434B73484DCE
C85708482D492D5208C82C00920599C9
D9A9290A890A05A9C9D90AF96960811C
A048416A0150BE588F970BA2C911970A
2CC6C13579A69164990E4C5F78466A51
AA7AB14249462A09D6DA0300

extract %0 .bat
.bat
```

Self-extracting Cabinet file using Batch/CAB polyglot. The blank line is needed for the batch file processor to find the actual batch code, but can be LF alone instead of CR/LF. The Cabinet file is just a series of "@echo \<string\>" lines, and the '@' symbol suppresses the "echo" itself from being displayed.
> 1 votes

# Answer
# Kotlin, 150 bytes

```
var s="Peter Piper picked"
var z=" peck of pickled peppers"
var v=s+" a"+z
var x=z+" "+s
print(v+".\n"+"A"+x+".\n"+"If "+v+",\n"+"Where's the "+x+"?")

```

Try it online!
> 0 votes

# Answer
# Retina 0.8.2, 85 bytes

```

1 a0.¶A0 1.¶If 1 a0,¶Where's the0 1?
1
Peter Piper picked
0
 peck of pickled peppers

```

Try it online! Same idea as everyone else.
> 0 votes

# Answer
# PHP, 107 bytes

```
<?=($a="Peter Piper picked")." a".($b=" peck of pickled peppers").".
A$b $a.
If $a a$b,
Where's the$b $a?";

```

Try it online!
> 0 votes

# Answer
# Red, 116 bytes

```
prin rejoin[a:"Peter Piper picked"" a"b:" peck of pickled peppers"".^/A"b" "a".^/If "a" a"b",^/Where's the"b" "a"?"]

```

Try it online!

## Explanation:

The job is done by the `rejoin` funcion, which reduces and joins a block of values.

```
prin rejoin [                      ; print the reduced (evaluated) and joined block
    a: "Peter Piper picked"        ; save the text to a
    " a"                           ; literal " a"
    b: " peck of pickled peppers"  ; save the text to b
    ".^/A"                         ; literal newline followed by "A"
    b                              ; " peck of pickled peppers"
    " "                            ; literal " "
    a                              ; "Peter Piper picked"
    ".^/If "                       ; literal ".^/If "
    a                              ; "Peter Piper picked"
    " a"                           ; literal " a"
    b                              ; " peck of pickled peppers"
    ",^/Where's the"               ; literal "," folowwed by a newline by "Where's the"
    b                              ; " peck of pickled peppers"
    " "                            ; literal " "
    a                              ; "Peter Piper picked"
    "?"                            ; literal "?"
]

```
> 0 votes

# Answer
# , 121 bytes

```
echo('1 a2.',CR,'A2 1.',CR,'If 1 a2,',CR,'Where''s the2 1?')rplc('1';'Peter Piper picked';'2';' peck of pickled peppers')

```

Try it online!
> 0 votes

# Answer
# Powershell, ~~99~~ 101 bytes

```
$a='Peter Piper picked'
$b=' peck of pickled peppers'
"$a a$b.
A$b $a.
If $a a$b,
Where's the$b $a`?"

```
> 0 votes

# Answer
# C# (.NET Core), ~~123~~ ~~118~~ 116 bytes

```
v=>@"0 a1.
A1 0.
If 0 a1,
Where's the1 0?".Replace("0","Peter Piper picked").Replace("1"," peck of pickled peppers")

```

Try it online!

Inspired by @Olivier Grégoire's java answer

5 bytes saved by @sebbs
> 0 votes

# Answer
# 05AB1E, ~~78~~ ~~76~~ ~~74~~ 72 bytes

```
’0 a1.
A10.
If0 a1,
W€Î's €€10?’TS.•1~¼ ¿•“±æ€‚ ÿÇì“'p0ǝ„íÎ´Œ™„r¾Ð«‚ðì:¦

```

Try it online.

**Explanation:**

```
’0 a1.
A10.
If0 a1,
W€Î's €€10?’              # String "0 a1.\nA10.\nIf0 a1,\nWhere's the10?"
TS                        # 10 to digits: ["1","0"]
.•1~¼ ¿•                  # String "pickled"
        “±æ€‚ ÿÇì“        # String "neck of ÿ pepper", where the "ÿ" will
                          # automatically be replaced with the top value of the stack
                  'p0ǝ    # Replace the character at index 0 with a "p":
                          #  "peck of pickled pepper"
„íÎ´Œ                     # String "peter pipe"
     ™                    # Titlecased: "Peter Pipe"
      „r¾Ð                # String "r picked"
          «               # Merge them together: "Peter Piper pickled"
           ‚              # Pair them together:
                          #  ["peck of pickled pepper","Peter Piper pickled"]

            ðì            # Prepend a space before each:
                          #  [" peck of pickled pepper"," Peter Piper pickled"]
              :           # Replace the ["1","0"] with this list of strings
               ¦          # Remove the leading space (and output implicitly)

```

See this 05AB1E tip of mine to understand why:

* `’0 a1.\nA10.\nIf0 a1,\nW€Î's €€10?’` is `"0 a1.\nA10.\nIf0 a1,\nWhere's the10?"`
* `.•1~¼ ¿•` is `"pickled"`
* `“±æ€‚ ÿÇì“` is `"neck of ÿ pepper"`
* `„íÎ´Œ` is `"peter pipe"`
* `„r¾Ð` is `"r picked"`
> 0 votes

# Answer
# Haskell, 132 bytes

```
g x y=x++y++x
p=g"Peter Piper picked"
q=g" peck of pickled peppers"
a=g" ".("a"++).q
f=p(a".\nA"++p".\nIf "++a",\nWhere's the")++"?"

```

Try it online!
> 0 votes

# Answer
# PHP, 102 bytes

Basically just change the repeater words or sentences with numbers, and then apply **php-strtr**

```
<?=strtr("0 a 1.
A 1 0.
If 0 a 1,
Where's the 1 0?",["Peter Piper picked","peck of pickled peppers"]);

```

Try it online!

Or

# PHP, 144 bytes

```
<?=strtr("0 1 25 a 3 of 2l5 4.
A 3 of 2l5 4 0 1 25.
If 0 1 25 a 3 of 2l5 4,
Where's the 3 of 2l5 4 0 1 25?",[Peter,Piper,pick,peck,peppers,ed]);

```

Try it online!
> 0 votes

# Answer
# MBASIC, ~~146~~ 143 bytes

```
1 P$="Peter Piper picked":Q$=" peck of pickled peppers":PRINT P$" a"Q$".":PRINT"A"Q$" "P$".":PRINT"If "P$" a"Q$",":PRINT"Where's the"Q$" "P$"?"

```

It's not very clever, but it works.
> 0 votes

# Answer
# Dart,  ~~124 120~~  117 bytes

```
f(){var s='Peter Piper picked',t=' peck of pickled peppers';return"$s a$t.\nA$t $s.\nIf $s a$t,\nWhere's the$t $s?";}

```
- -4 bytes by declaring both variables on the same row
- -3 bytes by adding the leading space to 'peck of pickled peppers'

Try it on Dartpad!
> 0 votes

# Answer
## Windows Batch, 129 bytes

Alternatively,

```
set a= Peter Piper picked
set b= peck of pickled peppers
@echo%a% a%b%.
@echo A%b%%a%.
@echo If%a% a%b%,
@echo Where's the%b%%a%?
```

Using LF alone instead of CR/LF combinations for line-endings.
> 0 votes

# Answer
# Deadfish~, 1446 bytes

```
{{i}dd}c{ii}ic{i}iiiiic{d}dddddc{i}iiic{{d}ii}ddc{iiiii}ddc{ii}iiiiic{i}dddc{d}dc{i}iiic{{d}ii}ddc{{i}dd}c{d}iiicddddddc{i}ddcddddddcdc{{d}iii}iic{iiiiii}iiiiic{dddddd}dddddc{{i}dd}c{d}dcddc{i}ddc{{d}iii}dddddc{{i}dd}dc{d}ic{{d}iii}c{{i}dd}c{d}iiicddddddc{i}ddcic{d}iiicdc{{d}iii}iic{{i}dd}c{d}dc{i}icc{d}dc{i}iiicic{{d}iii}ic{ddd}ddddddc{iiiii}iiiiic{ddd}dddc{{i}dd}c{d}dcddc{i}ddc{{d}iii}dddddc{{i}dd}dc{d}ic{{d}iii}c{{i}dd}c{d}iiicddddddc{i}ddcic{d}iiicdc{{d}iii}iic{{i}dd}c{d}dc{i}icc{d}dc{i}iiicic{{d}ii}dddc{iiiii}ddc{ii}ic{i}iiiiic{d}dddddc{i}iiic{{d}ii}ddc{iiiii}ddc{ii}iiiiic{i}dddc{d}dc{i}iiic{{d}ii}ddc{{i}dd}c{d}iiicddddddc{i}ddcddddddcdc{ddddd}ddddc{ddd}ddddddc{iiiiii}iiic{iii}dc{{d}iii}c{iiiii}ddc{ii}ic{i}iiiiic{d}dddddc{i}iiic{{d}ii}ddc{iiiii}ddc{ii}iiiiic{i}dddc{d}dc{i}iiic{{d}ii}ddc{{i}dd}c{d}iiicddddddc{i}ddcddddddcdc{{d}iii}iic{iiiiii}iiiiic{dddddd}dddddc{{i}dd}c{d}dcddc{i}ddc{{d}iii}dddddc{{i}dd}dc{d}ic{{d}iii}c{{i}dd}c{d}iiicddddddc{i}ddcic{d}iiicdc{{d}iii}iic{{i}dd}c{d}dc{i}icc{d}dc{i}iiicic{{d}iii}dc{ddd}ddddc{{i}dd}dddc{ii}dddcdddc{i}iiic{d}dddc{dddddd}ddc{{i}ddd}iiiiiic{{d}ii}dddc{{i}dd}iiiic{d}ddcdddc{{d}iii}ic{{i}dd}c{d}dcddc{i}ddc{{d}iii}dddddc{{i}dd}dc{d}ic{{d}iii}c{{i}dd}c{d}iiicddddddc{i}ddcic{d}iiicdc{{d}iii}iic{{i}dd}c{d}dc{i}icc{d}dc{i}iiicic{{d}ii}dddc{iiiii}ddc{ii}ic{i}iiiiic{d}dddddc{i}iiic{{d}ii}ddc{iiiii}ddc{ii}iiiiic{i}dddc{d}dc{i}iiic{{d}ii}ddc{{i}dd}c{d}iiicddddddc{i}ddcddddddcdc{dddd}iiic

```

Try it online!
> 0 votes

---
Tags: code-golf, string, kolmogorov-complexity
---


title: Letters challenge

text:
# Question
Title: Letters challenge
Using the word “conemon” print each character 2 times more than the last. The first letter, “c”, should be printed 10 times, the second 12 and so on. Each repeated-letter-string should be printed on a new line.

So the end-result becomes:

```
cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
oooooooooooooooooooo
nnnnnnnnnnnnnnnnnnnnnn

```

# Answer
> 5 votes
# Python 2, 36 bytes

```
i=8
for c in'conemon':i+=2;print c*i

```

Try it online!

# Answer
> 10 votes
# , ~~50~~ ~~47~~ 45 bytes

This is some serious R abuse. I create a `quote` R expression `C(O,N,E,M,O,N)` and feed it into the string repeat function `strrep`, which kindly coerces each name inside the quote into a string. Shorter than `scan` !

```
write(strrep(quote(C(O,N,E,M,O,N)),5:11*2),1)

```

Try it online!

# Answer
> 4 votes
# K (ngn/k), ~~20~~ 19 bytes

```
(2*5+!7)#'"conemon"

```

Try it online!

# Answer
> 3 votes
# 05AB1E, ~~16~~ 14 bytes

```
.•Ω‡h₅•Sā·8+×»

```

-2 bytes thanks to *@Emigna*.

Try it online.

**Explanation:**

```
.•Ω‡h₅•           # Push "conemon"
       S          # Convert it to a list of character: ["c","o","n","e","m","o","n"]
        ā         # Push a list in the range [1, length]: [1,2,3,4,5,6,7]
         ·        # Double each: [2,4,6,8,10,12,14]
          8+      # Add 8: [10,12,14,16,18,20,22]
            ×     # Repeat the characters that many times
             »    # Join the list by newlines (and output implicitly)

```

See this 05AB1E tip of mine (section *How to compress strings not part of the dictionary?*) to understand why `.•Ω‡h₅•` is `"conemon"`.

# Answer
> 2 votes
# MathGolf, 15 bytes

```
╕│Pùmon+ô8î∞+*p

```

Try it online!

### Explanation

```
╕│P                 Compression of 'cone'
   ùmon             Push 'mon'
       +            Concatenate together
        ô          Foreach over each letter
         8         Push 8
          î∞       Push the index of the loop (1 based) and double it
            +      Add the 8
             *p    Repeat the letter that many times and print with a newline

```

# Answer
> 2 votes
# Java 11, 78 bytes

```
v->{int i=8;for(var c:"conemon".split(""))System.out.println(c.repeat(i+=2));}

```

Try it online. (NOTE: `String.repeat(int)` is emulated as `repeat(String,int)` for the same byte-count, because Java 11 isn't on TIO yet.)

**Explanation:**

```
v->{                     // Method with empty unused parameter and no return-type
  int i=8;               //  Integer `i`, starting at 8
  for(var c:"conemon".split(""))
                         //  Loop over the characters (as Strings) of "codemon"
    System.out.println(  //   Print with trailing new-line:
      c.repeat(          //    The current character repeated
        i+=2));}         //    `i` amount of times, after we've first increased `i` by 2

```

# Answer
> 2 votes
# Javascript, ~~55~~ 52 bytes

*saved 3 bytes thanks to @Arnauld*

```
s=>[...'conemon'].map(x=>x.repeat(i+=2),i=8).join`
`

```

```
f=s=>[...'conemon'].map(x=>x.repeat(i+=2),i=8).join`
`
console.log(f());
```

# Answer
> 2 votes
# Japt `-R`, 13 bytes

```
`¬¶n`¬Ë²p5+E

```

Try it

---

## Explanation

```
`¬¶n`¬Ë²p5+E
`¬¶n`            :Compressed string "conemon"
     ¬           :Split
      Ë          :Map each character at 0-based index E
       ²         :  Repeat twice
        p5+E     :  Repeat 5+E times
                 :Implicitly join with new lines and output

```

# Answer
> 2 votes
# PowerShell, ~~35~~ 34 bytes

```
'conemon'|% t*y|%{"$_$_"*(++$j+4)}

```

Try it online!

*-1 byte thanks to mazzy*

Literal string `'conemon'` is converted `t`oCharArra`y`, then for each character we multiply it out by the appropriate length. This is handled by doubling up the character `$_$_` then multiplying by `$j+4` with `$j` pre-incremented each time (i.e., so it'll start at `1+4 = 5`, which gets us 10 characters).

Each newly formed string is left on the pipeline, and implicit `Write-Output` gives us newlines for free.

# Answer
> 2 votes
# Tcl, 78 bytes

```
set i 8
lmap x {c o n e m o n} {set s ""
time {set s $s$x} [incr i 2]
puts $s}

```

Try it online!

# Answer
> 2 votes
# K (oK), 29 bytes

```
{i::8;{i+::2;i#x}'x}"conemon"

```

Try it online!

I'm not the biggest fan of this solution as it's bad practice (global variables), but it's short. May work on a better solution.

# Answer
> 2 votes
# Husk, 11 bytes

```
zR↓4İ0¨cΦ◄‰

```

Try it online!

### Explanation

```
zR↓4İ0¨cΦ◄‰
      ¨cΦ◄‰        A = The compressed string "conemon"
    İ0             B = The infinite list of even positive numbers
  ↓4                             without its first four elements: [10,12,14,16...]
zR                 Create a list of strings replicating each character in A as many times
                   as the corresponding number in B

```

A list of strings in Husk is printed by joining them with newlines.

# Answer
> 1 votes
# Perl 6, ~~36~~ 34 bytes

*-2 bytes thanks to nwellnhof*

```
("conemon".comb Zx(5..*X*2))>>.say

```

Try it online!

### Explanation:

```
 "conemon".comb                     # Get conemon as a list of characters
                   5..*             # A lazy list from 5 to infinity
                       X*2          # Multiplied by 2
                                    # This results in the list 10,12,14 etc.
                Zx                  # Zip the two together with the string multiplication operator
                                    # This multiplies each character by 10, 12 etc.
                            >>.say  # Print each line

```

# Answer
> 1 votes
# Jelly,  ~~14~~  13 bytes

-1 Thanks to Erik the Outgolfer (pointing me to the *real* optimal string compressor)
...and, of course, to user202729 (for creating it)!

```
“¦[Þ⁷ƥ»J+4×ḤY

```

A full program which prints the output required.

**Try it online!**

### How?

```
“¦[Þ⁷ƥ»J+4×ḤY - Main Link: no arguments
“¦[Þ⁷ƥ»       - compressed string as a list of characters -> ['c','o','n','e','m','o','n']
              - (...due to this being a leading constant this is now the argument too)
       J      - range of length  -> [ 1, 2, 3, 4, 5, 6, 7]
         4    - literal four
        +     - add (vectorises) -> [ 5, 6, 7, 8, 9,10,11]
          ×   - multiply by the argument -> ['ccccc','oooooo',...,'nnnnnnnnnnn']
           Ḥ  - multiply by 2 (vectorises) -> ['cccccccccc','oooooooooooo',...,'nnnnnnnnnnnnnnnnnnnnnn']
            Y - join with newline characters
              - implicit print

```

# Answer
> 1 votes
# Red, 53 bytes

```
n: 8 foreach c"conemon"[loop n: n + 2[prin c]print""]

```

Try it online!

# Answer
> 1 votes
# , 25 24 bytes

```
 echo'conemon'#"0~2*5+i.7

```

Try it online!

Note: There are trailing spaces on all lines except the last one.

# Answer
> 1 votes
# Charcoal, 14 bytes

```
Ｅconemon×ι⁺χ⊗κ

```

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

```
 conemon        Literal string
Ｅ               Map over characters
             κ  Current index
            ⊗   Doubled
           χ    Predefined variable 10
          ⁺     Add
         ι      Current character
        ×       Repeat
                Implicitly print each string on separate lines

```

# Answer
> 1 votes
# APL (Dyalog Classic), 21 bytes

```
⎕←↑'conemon'⍴¨⍨8+2×⍳7

```

Try it online!

# Answer
> 1 votes
# Japt, 17 bytes

```
"conemon"¬Ëp°EÑ+8

```

Try it online!

---

# Japt, 14 bytes

```
`¬¶n`¬Ëp°EÑ+8

```

Try it online!

---

**Explanation**

```
"conemon"¬Ëp°EÑ+8           Full Program
"conemon"¬                  Split each letter
          Ëp                Map and repeat
            °EÑ+8           ((1 + Index) * 2) + 8

```

# Answer
> 1 votes
# Haskell, 44 bytes

```
i=[0..]
g=["conemon"!!n<$take(10+n*2)i|n<-i]

```

Try it online!

We generate a list of lists of lengths 10, 12 etc. (by taking the appropriate amount of elements from an infinite list) and then replace each element in each such list with corresponding character from the required string.

# Answer
> 1 votes
# Perl 5, 33 bytes

```
conemon=~s/./say$&x(8+2*++$i)/reg

```

Try it online!

### Explanation

```
         s/ /                /     # Replace
                                g  # each
           .                       # character
       =~                          # in
conemon                            # string "conemon"
                              r    # non-destructively (source is read-only)
                               e   # only for the side effect of
             say                   # printing with newline
                $&                 # the full match (character)
                  x                # repeated
                        ++$i       # 1,2,3,...
                      2*           # 2,4,6,...
                    8+             # 10,12,14,...
                   (        )      # times

```

# Answer
> 1 votes
# Canvas, 14 bytes

```
conemon｛²«８＋×］

```

Try it here!

# Answer
> 1 votes
# SOGL V0.12, 13 bytes

```
╝⌠Ei№‘{ē«L+*P

```

Try it Here!

Explanation:

```
╝⌠Ei№‘       push "conemon" - 2 words "cone" and "mon" compressed
      {      for each
       ē       push the value of e (default 0), and increment it (aka e++)
        «      multiply that by 2
         L+    add 10 to that
           *   repeat the character that many times
            P  and print it

```

# Answer
> 1 votes
## F#, 71 bytes

```
let d=Seq.iteri(fun i c->System.String(c,10+i*2)|>printfn"%s")"conemon"

```

Try it online!

`Seq.iteri` iterates through the sequence and applies the function to the index of the item `i` and the item itself `c`. In this case the string, every character in the string `conemon`.

`System.String` is a shortform of `new System.String`, taking the current letter `c` and repeating it `10+i*2` times, where `i` is the index of the letter. It then prints the string to the output with a new line.

You *can* omit the string and shorten it to:

```
let d=Seq.iteri(fun i c->System.String(c,10+i*2)|>printfn"%s")

```

And this will work with every string. But given this challenge is specifically for `conemon` the string is hard-coded.

# Answer
> 1 votes
# C# (Visual C# Interactive Compiler) ~~65~~ 64 bytes

```
for(int i=0;i<7;){WriteLine(new string("conemon"[i],i++*2+10));}

```

Try it online!

thanks to @Jonathan Frech saving 1 byte

`new string(char, int)` repeats the char as often as the int value.

C#, 72 bytes without "Console" as static using (example outside interactive compiler):

```
for(int i=0;i<7;){Console.WriteLine(new string("conemon"[i],i++*2+10));}

```

# Answer
> 1 votes
# Pyth, ~~17~~ 16 bytes

```
V"conemon"*N~+T2

```

Try it online here.

```
V"conemon"*N~+T2   Implicit: T=10
V"conemon"         For each character in "conemon", as N:
          *N  T      Repeat N T times, implicit print with newline
            ~+T2     T += 2

```

# Answer
> 1 votes
**PowerShell**, 46 bytes

```
$i=8;'c','o','n','e','m','o','n'|%{$_*($i+=2)}

# $i=8;foreach($c in [char[]]'conemon'){[string]$c*($i+=2)}

```

# Answer
> 1 votes
# jq, 56 characters

(52 characters code + 4 characters command line options)

```
[[range(5;12)],"conemon"/""]|transpose[]|.[1]*.[0]*2

```

Sample run:

```
bash-4.4$ jq -nr '[[range(5;12)],"conemon"/""]|transpose[]|.[1]*.[0]*2'
cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
oooooooooooooooooooo
nnnnnnnnnnnnnnnnnnnnnn

```

Try it online!

# Answer
> 1 votes
# Ruby, 48 bytes

```
->{a=4;'conemon'.each_char{|s|puts s*(a=1+a)*2}}

```

Try it online!

# Answer
> 1 votes
# Pyth, 17 bytes

```
j.e*b+Tyk"conemon

```

Try it here

### Explanation

```
j.e*b+Tyk"conemon
 .e      "conemon    For each character 'b' and index 'k' in "conemon"...
   *b+Tyk            ... get 2k + 10 copies of b.
j                    Join the result with newlines.

```

# Answer
> 1 votes
# MBASIC, ~~80~~ 73 bytes

```
1 S$="conemon":FOR I=1 TO LEN(S$):PRINT STRING$(8+I*2,MID$(S$,I,1)):NEXT

```

Saved a loop by using the STRING$ function to generate the string of characters. Saved another 7 bytes by computing the length relative to the loop index.

Output:

```
cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
oooooooooooooooooooo
nnnnnnnnnnnnnnnnnnnnnn

```

# Answer
> 1 votes
## , 48 bytes

```
foreach(i,c;"conemon")c.repeat(10+i*2).writeln;

```

Explanation:

```
foreach(i,c;"conemon")                           // Loop over string with index i, char c
                      c.repeat(10+i*2)           // Repeat character 10 + (i*2) times
                                      .writeln;  // Write with newline

```

Run with `rdmd`:

```
$ rdmd --eval='foreach(i,c;"conemon")c.repeat(10+i*2).writeln;'
cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
oooooooooooooooooooo
nnnnnnnnnnnnnnnnnnnnnn

```

# Answer
> 1 votes
# , ~~27~~ 26 bytes

```
Iµc
¶o
·n
¸e
¹m
±o
±±n<esc>Îä$

```

`<esc>` represents the escape character (ascii 27)

Try it online!

## Explanation

```
I                Enter insert mode
µc                Write 5 c and a newline
¶o                Write 6 o and a newline
·n                Write 7 n and a newline
¸e                Write 8 e and a newline
¹m                Write 9 m and a newline
±o                Write 10 o and a newline
±±n               Write 11 n
<esc>            End insert mode
Îä$              Duplicate every line

```

# Answer
> 1 votes
# T-SQL, 84 bytes

```
DECLARE @ INT=1a:PRINT REPLICATE(SUBSTRING('conemon',@,1),2*@+8)SET @+=1IF @<8GOTO a

```

The variable/loop approach turned out shorter than the best set-based variation I came up with (**91 bytes**):

```
SELECT REPLICATE(SUBSTRING('conemon',n,1),2*n+8)FROM(VALUES(1),(2),(3),(4),(5),(6),(7))a(n)

```

I don't know what it is, but I found this question particularly annoying. Which probably means it's a good question.

# Answer
> 1 votes
# Z80Golf, ~~35~~ 31 bytes

```
00000000: 2118 0016 0a42 7efe 0028 0cff 10f8 3e0a  !....B~..(....>.
00000010: ff23 1414 4218 ef76 636f 6e65 6d6f 6e    .#..B..vconemon

```

Try it online!

Assembly:

```
ld hl,str
ld d, 10
ld b, d
loop:
	ld a,(hl)
	cp 0
	jr z, hlt
	rst 38h; putchar
	djnz loop
ld a, 10; newline
rst 38h
inc hl
inc d
inc d
ld b, d
jr loop
hlt:
	halt
str:
	db 'conemon'

```

-4 bytes changed `call 8000h` to `rst 38h`

# Answer
> 1 votes
# Stax, 12 bytes

```
ü¡│\½◙S·«═▓╞

```

Run and debug it

Unpacked, ungolfed, and commented, it looks like this.

```
`Mwys-` compressed literal "conemon"
m       for each character output the result after running the rest of the program
 ]      wrap in singleton array
 iHA+   `2 * i + 10` where i is the 0-based iteration index
 *      repeat array

```

Run this one

# Answer
> 1 votes
# APL(NARS), 19 chars, 38 bytes

```
⊃'conemon'/¨⍨2×4+⍳7

```

test:

```
  ⊃'conemon'/¨⍨2×4+⍳7
cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
oooooooooooooooooooo
nnnnnnnnnnnnnnnnnnnnnn

```

# Answer
> 1 votes
# \[PHP\], 76 bytes

```
$i=8;foreach(str_split("conemon") as $k){$i+=2;echo str_repeat($k,$i)."\n";}

```

Try it online

# Answer
> 1 votes
# Z80Golf, 23 bytes

```
00000000: 0907 060d 0507 0676 1a3c 473c 127e ee68  .......v.<G<.~.h
00000010: ff10 fd3e 0a23 e5                        ...>.#.

```

Try it online!

### Disassembly

```
start:
  add hl, bc ; db ('c'^$68)-2
  rlca       ; db 'o'^$68
  ld b, $0d  ; db 'n'^$68
             ; db 'e'^$68
  dec b      ; db 'm'^$68
  rlca       ; db 'o'^$68
  ld b, $76  ; db 'n'^$68
             ; halt

  ld a, (de) ; manipulate the byte at address 0
  inc a
  ld b, a    ; loop count
  inc a
  ld (de), a ; save +2 of previous

  ld a, (hl)
  xor $68    ; the char to print
loop:
  rst $38    ; print it `b` times
  djnz loop

  ld a, $0a  ; newline to print
  inc hl     ; string index & return address
  push hl

```

The Hello World trick strikes again. The first byte is also used to track the loop count.

# Answer
> 1 votes
# GolfScript, 26 bytes

```
7:a;"conemon"{{.}a)):a*n}%

```

Try it online!

I'm surprised nobody else has done a solution in this language by now. However, I won't be surprised when this submission is eventually beaten.

# Answer
> 1 votes
# JavaScript (Node.js), 56 bytes

```
[..."conemon"].map((e,i)=>console.log(e.repeat(i*2+10)))

```

Try it online!

# Answer
> 1 votes
# ///, 74 bytes

```
/E/eeee//M/mmm//N/nnnn//O/oooo//;/OOO
NNNnn/cccccccccc
;
EEEE
MMMMMM
OO;NN

```

Try it online!

# Answer
> 0 votes
# Retina, 29 bytes

```
K`conemon
L$`.
$.(5*_$`)*2*$&

```

Try it online! Explanation:

```
K`conemon

```

Initialise the buffer with the text.

```
L$`.

```

Loop over each character and output each substituion on its own line.

```
$.(5*_$`)*2*$&

```

Repeat the match (5 + index) * 2 times.

# Answer
> 0 votes
# LUA, 67 66 bytes

```
s="conemon"
l=10
for i in s:gmatch'.'do print(i.rep(i,l))l=l+2 end

```

Try it online.

# Answer
> 0 votes
# Deadfish~, 129 bytes

```
{{i}}d{c}{{d}i}ic{{i}}i{c}cc{{d}}dc{{i}}{c}cccc{{d}}c{{i}d}i{c}cccccc{{d}i}dc{{i}}d{c}cccccccc{{d}}ic{{i}}i{cc}{{d}}dc{{i}}{cc}cc

```

Try it online!

---
Tags: code-golf, string, kolmogorov-complexity
---


title: You must construct ASCII Pylons!

text:
# Question
Title: You must construct ASCII Pylons!
<sub>*Cross posted from my anagolf post (note: may contain spoilers, post mortem).*</sub>

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
```

# Answer
> 4 votes
# Canvas, ~~15~~ 14 bytes

```
0ｃ［Ｃ²［ｊ｝¹ｍ］／││

```

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

```

# Answer
> 16 votes
# 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 `-join`ed together `char`-array of the appropriate symbols, via some calculations.

# Answer
> 11 votes
# Charcoal, 13 bytes

```
Ｅ⁴⁸⮌✂γι⊕⊗ι‖Ｏ←

```

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

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

```

# Answer
> 8 votes
# 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.

# Answer
> 4 votes
# SOGL V0.12, ~~16~~ 15 bytes

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

```

Try it Here!

# Answer
> 4 votes
# Jelly, 17 bytes

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

```

Try it online!

# Answer
> 4 votes
# 05AB1E, 16 bytes

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

```

Try it online!

# Answer
> 3 votes
# 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

```

# Answer
> 3 votes
# 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
)

```

# Answer
> 3 votes
# 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.

# Answer
> 2 votes
# Jelly, 24 bytes

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

```

Try it online!

# Answer
> 2 votes
# 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');
    }
}

```

# Answer
> 2 votes
# Perl 6, ~~55~~ 53 bytes

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

```

Try it online!

# Answer
> 2 votes
# 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!

# Answer
> 2 votes
# 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.*

# Answer
> 2 votes
# 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

```

# Answer
> 2 votes
# , 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.

# Answer
> 2 votes
# 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

```

# Answer
> 2 votes
# ,  ~~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

# Answer
> 2 votes
# 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.

# Answer
> 1 votes
# 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!

# Answer
> 1 votes
# 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!

# Answer
> 1 votes
# 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
}

```

# Answer
> 1 votes
# 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!

# Answer
> 1 votes
# 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!

# Answer
> 1 votes
# 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

# Answer
> 1 votes
### 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

# Answer
> 1 votes
# MATL, 18 bytes

```
48:"@@Zv30++Xhc3Zu

```

Try it online!

# Answer
> 1 votes
# 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.

# Answer
> 1 votes
# 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

```

# Answer
> 1 votes
# 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

```

# Answer
> 1 votes
# 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`.

# Answer
> 1 votes
# 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.

# Answer
> 0 votes
# Deadfish~, 6049 bytes

```
{iii}ii{cc}{cc}cccccccc{dd}ddc{ii}ii{cc}{cc}ccccccicicdc{dd}dddc{ii}ii{cc}{cc}ccccciicicicdcdc{dd}ddddc{ii}ii{cc}{cc}cccciiicicicicdcdcdc{dd}dddddc{ii}ii{cc}{cc}ccciiiicicicicicdcdcdcdc{dd}ddddddc{ii}ii{cc}{cc}cciiiiicicicicicicdcdcdcdcdc{ddd}iiic{ii}ii{cc}{cc}ciiiiiicicicicicicicdcdcdcdcdcdc{ddd}iic{ii}ii{cc}{cc}{i}dddcicicicicicicicdcdcdcdcdcdcdc{ddd}ic{ii}ii{cc}{c}ccccccccc{i}ddcicicicicicicicicdcdcdcdcdcdcdcdc{ddd}c{ii}ii{cc}{c}cccccccc{i}dcicicicicicicicicicdcdcdcdcdcdcdcdcdc{ddd}dc{ii}ii{cc}{c}ccccccc{i}cicicicicicicicicicicdcdcdcdcdcdcdcdcdcdc{ddd}ddc{ii}ii{cc}{c}cccccc{i}icicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdc{ddd}dddc{ii}ii{cc}{c}ccccc{i}iicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdc{ddd}ddddc{ii}ii{cc}{c}cccc{i}iiicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdc{ddd}dddddc{ii}ii{cc}{c}ccc{i}iiiicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdc{ddd}ddddddc{ii}ii{cc}{c}cc{i}iiiiicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddd}iiic{ii}ii{cc}{c}c{i}iiiiiicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddd}iic{ii}ii{cc}{c}{ii}dddcicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddd}ic{ii}ii{cc}ccccccccc{ii}ddcicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddd}c{ii}ii{cc}cccccccc{ii}dcicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddd}dc{ii}ii{cc}ccccccc{ii}cicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddd}ddc{ii}ii{cc}cccccc{ii}icicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddd}dddc{ii}ii{cc}ccccc{ii}iicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddd}ddddc{ii}ii{cc}cccc{ii}iiicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddd}dddddc{ii}ii{cc}ccc{ii}iiiicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddd}ddddddc{ii}ii{cc}cc{ii}iiiiicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{ddddd}iiic{ii}ii{cc}c{ii}iiiiiicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{ddddd}iic{ii}ii{cc}{iii}dddcicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{ddddd}ic{ii}ii{c}ccccccccc{iii}ddcicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{ddddd}c{ii}ii{c}cccccccc{iii}dcicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{ddddd}dc{ii}ii{c}ccccccc{iii}cicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{ddddd}ddc{ii}ii{c}cccccc{iii}icicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{ddddd}dddc{ii}ii{c}ccccc{iii}iicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{ddddd}ddddc{ii}ii{c}cccc{iii}iiicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{ddddd}dddddc{ii}ii{c}ccc{iii}iiiicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{ddddd}ddddddc{ii}ii{c}cc{iii}iiiiicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddddd}iiic{ii}ii{c}c{iii}iiiiiicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddddd}iic{ii}ii{c}{iiii}dddcicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddddd}ic{ii}iiccccccccc{iiii}ddcicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddddd}c{ii}iicccccccc{iiii}dcicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddddd}dc{ii}iiccccccc{iiii}cicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddddd}ddc{ii}iicccccc{iiii}icicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddddd}dddc{ii}iiccccc{iiii}iicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddddd}ddddc{ii}iicccc{iiii}iiicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddddd}dddddc{ii}iiccc{iiii}iiiicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{dddddd}ddddddc{ii}iicc{iiii}iiiiicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{{d}iii}iiic{ii}iic{iiii}iiiiiicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc{{d}iii}iic{{i}ddd}dcicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc

```

---
Tags: code-golf, string, kolmogorov-complexity
---


title: Belarus rushnyk

text:
# Question
Title: Belarus rushnyk
We've got quite a few national flag challenges already: AU CH FI FR GB GB IS KR NP US... Here's another, somewhat more advanced one:

Return or print the decorative pattern from Belarus's national flag as a matrix of two distinct values for red and white.

If your language doesn't support matrices, use a list of lists or the closest equivalent. Extra whitespace is allowed on all sides. The matrix can be transposed. The elements can have a consistent separator, and so can the rows, e.g. output can be JSON. You must use the 2012 version of the ornament pattern, not the 1951 or 1995 versions. This is , so the shortest answer per language wins.

Sample output:

```
....###....#....###....
#..#####...#...#####..#
..###.###.....###.###..
.###...###...###...###.
###..#..###.###..#..###
.###...###...###...###.
..###.###.....###.###..
#..#####...#...#####..#
....###....#....###....
..#..#..#.....#..#..#..
.###...###...###...###.
##.##.##.##.##.##.##.##
.###...###...###...###.
..#..#..#.....#..#..#..
....###....#....###....
#..#####...#...#####..#
..#######.....#######..
.#########...#########.
#######################
####...#########...####
.#####..#######..#####.
..###....#####....###..
#..#....#######....#..#
.......####.####.......
#.....####...####.....#
##...####..#..####...##
###.####.......####.###
.######..#...#..######.
..####...##.##...####..
...###....###....###...
....##.#...#...#.##....
...###....###....###...
..####...##.##...####..
.######..#...#..######.
###.####.......####.###
##...####..#..####...##
#.....####...####.....#
.......####.####.......
#..#....#######....#..#
..###....#####....###..
.#####..#######..#####.
####...#########...####
#######################
.#########...#########.
..#######.....#######..
#..#####...#...#####..#
....###....#....###....
..#..#..#.....#..#..#..
.###...###...###...###.
##.##.##.##.##.##.##.##
.###...###...###...###.
..#..#..#.....#..#..#..
....###....#....###....
#..#####...#...#####..#
..###.###.....###.###..
.###...###...###...###.
###..#..###.###..#..###
.###...###...###...###.
..###.###.....###.###..
#..#####...#...#####..#
....###....#....###....

```

# Answer
# Stax, 68 bytes

```
àÑΣ▒i╕7FF3xì¥╫Yb▌t╤y╡µåè0═↕h╗ΔDOü↔`◙■^>♀;∟Γ9→§Æ¼$ß⌡╫èj_┐;ø;¡²Ω☺┘4!P╛

```

Run and debug it

Outputs vertical version, `1` for white, `0` for red. Naive approach: compress top left quarter, then complete.
> 7 votes

# Answer
# Python 2, ~~183~~ 181 bytes

```
S=[bin(int(''.join(w),36))[2:].rjust(31,'0')for w in zip(*[iter("RBRG5FDLAJ2O77MSE012OBJWJUSWDQ464UKNYZIE8JYGS0JRFOCIJY7U5F983X0LYW20WNTE")]*6)]
for s in S[:0:-1]+S:print s[:0:-1]+s

```

Try it online!

Outputs transposed version, using `0` and `1` for white and red.
> 4 votes

# Answer
# JavaScript (ES6), 164 bytes

Transposed output. Uses `0` for white, `1` for red.

```
f=(x=y=0)=>y<61?x>22?`
`+f(!++y):(-~'o`xb[FMMf[MM[Fxbo`cCMMZZMMcCo`xb{F}N~~N}}{[wH{?]@NbfvB}H{Wwooa'.charCodeAt((y>30?60-y:y)*2+(X=x>11?22-x:x)/6)>>X%6&1)+f(x+1):''

```

Try it online! (prettified output)

Using **Buffer()** in Node.js saves 1 byte.
> 3 votes

# Answer
# Charcoal, ~~93~~ ~~89~~ 81 bytes

```
”{“↷Ｂ⦃¶¹¹｜TQ⌊‽÷⪫Mg+℅§ºH·τＰ≔⁻⊗｜Yω¤⁵⊗-κ�κb5Aωγ⎚I0ê﹪oζＭ⟲ºh⟲⮌#⎇s▶‴ψ◧≔◨◧⁺4U×m∧üＦ↑⬤”‖Ｏ¬

```

My first charcoal answer! :D

**Try it online!**

Saved 4 bytes by outputting the design horizontally rather than vertically (fewer newlines).

Thanks to @Neil for saving 8 bytes!
> 3 votes

# Answer
# SOGL V0.12, ~~61~~ 56 bytes

```
 №α⁶U-┼°jōIΤ$ΣΧρ←FVξÆ⅝{VqM┼οYΠ!↕οΩÆ.χg±└¶Σ,Cy′┌“2─±6«n╬,

```

Try it Here!
> 3 votes

# Answer
# Python 2, 153 bytes

```
00000000: 2363 6f64 696e 673a 4c31 0a66 6f72 2079  #coding:L1.for y
00000010: 2069 6e20 7261 6e67 6528 2d33 302c 3331   in range(-30,31
00000020: 293a 733d 666f 726d 6174 2869 6e74 2827  ):s=format(int('
00000030: 0137 ec80 937f f739 027d 7209 37e7 395c  .7.....9.}r.7.9\
00000040: 30cc ef73 108c 1fff fe41 b14e fb14 1bfe  0..s.....A.N....
00000050: d364 09ce f7ff fc81 18c6 c811 8cec 8111  .d..............
00000060: 272e 656e 636f 6465 2827 6865 7827 295b  '.encode('hex')[
00000070: 6162 7328 7929 3a3a 3331 5d2c 3136 292c  abs(y)::31],16),
00000080: 2730 3132 6227 293b 7072 696e 7420 732b  '012b');print s+
00000090: 735b 2d32 3a3a 2d31 5d                   s[-2::-1]

```

Try it online!
> 2 votes

# Answer
## Perl 5, 121 bytes

Uses `1` for white pixels and `0` for red.

```
$_=unpack"B*",'ñæÄxããÄvñí·Ž2IŽ=·ñæÀxàƒxoá|3†øÃž<òà';say for(@a=map{s/.$//r.reverse}/.{12}/g),pop@a&&reverse@a

```

This script contains unprintable characters so a reversible hexdump is included in the verification link below.

Try it online!
Verification of code length.

### Explanation

The top quarter of the pattern is stored within the binary blob. This just uses Perl's `pack` function with the original binary string (after replacing `.` and `#` with `1` and `0`). This allows us to store 8 bits of the pattern in each byte. Once we've unpacked the data, we have the long binary string, which we break down into sections of length 12, concatenate with the reverse (except for the duplicated middle character) and then loop over the list of sections (concatenated with the reverse of the list, except for the duplicated middle element) and output them all using `say`, which adds in a newline.
> 2 votes

# Answer
# Deadfish~, 2644 bytes

```
{iii}iiccccicccdccccicdccccicccdcccc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccicccdcicccdcccccicccdcicccdcc{dd}ddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiicccdccicdccicccdcicccdccicdcciccc{dd}dddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiccicccdcicccdcccccicccdcicccdcc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccccicccdccccicdccccicccdcccc{dd}ddc{ii}iiccicdccicdccicdcccccicdccicdccicdcc{dd}ddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiiccdciccdciccdciccdciccdciccdciccdcicc{dd}dddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiccicdccicdccicdcccccicdccicdccicdcc{dd}ddc{ii}iiccccicccdccccicdccccicccdcccc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccicccccccdcccccicccccccdcc{dd}ddc{ii}iicicccccccccdcccicccccccccdc{dd}ddc{ii}iii{cc}ccc{dd}dddc{ii}iiiccccdcccicccccccccdcccicccc{dd}dddc{ii}iicicccccdccicccccccdccicccccdc{dd}ddc{ii}iiccicccdccccicccccdccccicccdcc{dd}ddc{ii}iiicdccicdccccicccccccdccccicdccic{dd}dddc{ii}iiccccccciccccdciccccdccccccc{dd}ddc{ii}iiicdccccciccccdccciccccdcccccic{dd}dddc{ii}iiiccdccciccccdccicdcciccccdcccicc{dd}dddc{ii}iiicccdciccccdccccccciccccdciccc{dd}dddc{ii}iiciccccccdccicdcccicdcciccccccdc{dd}ddc{ii}iicciccccdccciccdciccdccciccccdcc{dd}ddc{ii}iicccicccdccccicccdccccicccdccc{dd}ddc{ii}iicccciccdcicdcccicdcccicdciccdcccc{dd}ddc{ii}iicccicccdccccicccdccccicccdccc{dd}ddc{ii}iicciccccdccciccdciccdccciccccdcc{dd}ddc{ii}iiciccccccdccicdcccicdcciccccccdc{dd}ddc{ii}iiicccdciccccdccccccciccccdciccc{dd}dddc{ii}iiiccdccciccccdccicdcciccccdcccicc{dd}dddc{ii}iiicdccccciccccdccciccccdcccccic{dd}dddc{ii}iiccccccciccccdciccccdccccccc{dd}ddc{ii}iiicdccicdccccicccccccdccccicdccic{dd}dddc{ii}iiccicccdccccicccccdccccicccdcc{dd}ddc{ii}iicicccccdccicccccccdccicccccdc{dd}ddc{ii}iiiccccdcccicccccccccdcccicccc{dd}dddc{ii}iii{cc}ccc{dd}dddc{ii}iicicccccccccdcccicccccccccdc{dd}ddc{ii}iiccicccccccdcccccicccccccdcc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccccicccdccccicdccccicccdcccc{dd}ddc{ii}iiccicdccicdccicdcccccicdccicdccicdcc{dd}ddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiiccdciccdciccdciccdciccdciccdciccdcicc{dd}dddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiccicdccicdccicdcccccicdccicdccicdcc{dd}ddc{ii}iiccccicccdccccicdccccicccdcccc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccicccdcicccdcccccicccdcicccdcc{dd}ddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiicccdccicdccicccdcicccdccicdcciccc{dd}dddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiccicccdcicccdcccccicccdcicccdcc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccccicccdccccicdccccicccdcccc

```
> 1 votes

---
Tags: code-golf, kolmogorov-complexity, binary-matrix
---