title: Interpret Gelatin

text:
# Question
Title: Interpret Gelatin
Gelatin is a worse version of Jelly. It is a tacit programming language that always takes a single integer argument and that has 7 (or maybe 16) commands. You are to take in a Gelatin program and its argument and output the result.

## Gelatin

Gelatin programs will always match the following regex:

```
^[+_DSa\d~]*$

```

i.e. they will only contain `+_DSa0123456789~` characters. The commands in Gelatin are:

* Digits return their value (`0` is \\$0\\$, `1` is \\$1\\$ etc.) Digits are stand alone, so `10` represents \\$1\\$ and \\$0\\$, not \\$10\\$
* `a` returns the argument passed to the Gelatin program
* `D` takes a left argument and returns it minus one (decremented)
* `S` takes a left argument and returns its square
* `+` takes a left and a right argument and returns their sum
* `_` takes a left and a right argument and returns their difference (subtract the right from the left)
* `~` is a special command. It is always preceded by either `+` or `_` and it indicates that the preceding command uses the same argument for both the left and the right.

Each command - aside from `~` \- in Gelatin has a fixed *arity*, which is the number of arguments it takes. Digits and `a` have an arity of \\$0\\$ (termed *nilads*), `D` and `S` have an arity of \\$1\\$ (termed *monads*, no relation) and `+` and `_` have an arity of \\$2\\$ (termed *dyads*)

If `+` or `_` is followed by a `~`, however, they become *monads*. This affects how the program is parsed.

Tacit languages try to avoid referring to their arguments as much as possible. Instead, they compose the functions in their code so that, when run, the correct output is produced. How the functions are composed depends on their arity.

Each program has a "flow-through" value, `v` and an argument `ω`. `v` is initially equal to `ω`. We match the start of the program against one of the following arity patterns - earliest first, update `v` and remove the matched pattern from the start. This continues until the program is empty:

* **2, 1**: This is a dyad `d`, followed by a monad `M`. First, we apply the monad to `ω`, yielding `M(ω)`. We then update `v` to be equal to `d(v, M(ω))`.
* **2, 0**: This is a dyad `d`, followed by a nilad `N`. We simply update `v` to be `d(v, N)`
* **0, 2**: The reverse of the previous pattern, `v` becomes `d(N, v)`
* **2**: The first arity is a dyad `d`, and it's not followed by either a monad or a nilad as it would've been matches by the first 2. Therefore, we set `v` to be `d(v, ω)`
* **1**: The first arity is a monad `M`. We simply set `v` to be `M(v)`

For example, consider the program `+S+~_2_` with an argument `5`. The arities of this are `[2, 1, 1, 2, 0, 2]` (note that `+~` is one arity, `1`). We start with `v = ω = 5`:

* The first 2 arities match pattern **2, 1** (`+S`), so we calculate `S(ω) = S(5) = 25`, then calculate `v = v + S(ω) = 5 + 25 = 30`
* The next arity matches pattern **1** (`+~`). `+~` means we add the argument to itself, so we double it. Therefore, we apply the monad to `v`, updating it to `v = v + v = 30 + 30 = 60`
* The next arity pattern is **2, 0** (`_2`), which just subtracts 2, updating `v` to `v = v - 2 = 60 - 2 = 58`
* Finally, the last arity pattern is **2** (`_`), meaning we update `v` to be `v = v - ω = 58 - 5 = 53`.
* There are now no more arity patterns to match, so we end the program

At the end of the program, Gelatin outputs the value of `v` and terminates.

In a more general sense, `+S+~_2_` is a function that, with an argument \\$\omega\\$, calculates \\$2(\omega + \omega^2) - 2 - \omega = 2\omega^2 + \omega - 2\\$.

---

You are to take a string representing a Gelatin program, using the characters specified above, and a positive integer \\$\omega\\$ and output the result of running the Gelatin program with an argument of \\$\omega\\$

You may assume that the arities of the program will always fit one of the 5 patterns (so nothing like `S1S` (**1, 0, 1**) will appear), and that the flow-through value will never exceed your language's integer bounds. The output may be negative.

This is so the shortest code in bytes wins

## Test cases

```
Program         ω              out
+S              7              56
_aSS+           20             20
++DDDS+1_       15             1750
_S              13             -156
D0+             12             11
_+~SSS++__S++a  6              1679598
_++a            17             34
a+_6D           20             33
D+_+_aD         17             15
                5              5
DD              8              6
+_aa+S+SS+_+    4              6404
+9+S_           19             370
_DDD+_a+_3_4D_  13             -9
SS_SD+          15             50414
+~D_~_          7              -7
D_a+S           10             99
_S+aD+4         1              4
+_a+            3              6
_aD+60+         13             5

```

This is a program that randomly generates \\$n\\$ Gelatin programs, along with random inputs and the intended outputs

# Answer
# JavaScript (ES6),  ~~306 ... 227~~  226 bytes

Expects `(program)(ω)`.

```
s=>g=(v,w=v,n=0,h=_=>(O={a:w,'+':"x+y",_:"x-y",S:"x*x",D:"x-1",'+~':"x*2",'_~':"0"}[c=(s+'a').match(/.~?/g)[n++]]||+c)[2]>O?2:O>g)=>(I=h(i=h(E=(o,x,y)=>eval(o)),o=O),o)?g(i?E(o,v,I?I-2?E(O,w):w:O):I?E(O,o,v):v,w,n-=i==I|i&1):v

```

Try it online!

## Commented

### Header and helper function `h`

```
s =>                 // outer function taking the program string s
g = (                // g = inner recursive function taking:
  v,                 //   v = current output value
  w = v,             //   w = initial value of v (aka ω)
  n = 0,             //   n = pointer in the command stream
  h = _ => (         //   h is a helper function which turns the next
                     //   command into a JS code snippet or an integer,
                     //   along with the arity of the command:
    O = {            //     1) command:
      a   : w,       //       'a' : use w
      '+' : "x+y",   //       '+' : add y to x
      _   : "x-y",   //       '_' : subtract y from x
      S   : "x*x",   //       'S' : square x
      D   : "x-1",   //       'D' : decrement x
      '+~': "x*2",   //       '+~': double x
      '_~': "0"      //       '_~': yield 0
    }[               //
      c = (s + 'a')  //       append an explicit 'a' command at the end
      .match(/.~?/g) //       split the commands (either "x" or "x~")
      [n++]          //       load the next command into c
    ]                //
    || +c            //       if the above is undefined, use +c (it's a digit)
  )                  //     2) arity of the command:
  [2] > O ? 2        //       dyad if the 3rd character is 'y'
          : O > g    //       monad if it's a code snippet, or nilad otherwise
) =>                 //

```

### Body of `g`

```
( I =                // (O, I) = (2nd command, 2nd arity)
  h( i =             // (o, i) = (1st command, 1st arity)
    h( E =           // E is a helper function
      (o, x, y) =>   //   which takes o, x, y
        eval(o)      //   and evaluates o in this local context
    ),               //
    o = O            //
  ),                 //
  o                  // we eventually test o
) ?                  // if o is defined:
  g(                 //   do a recursive call to g:
    i ?              //     if the 1st command is not a nilad:
      E(             //       v = result of a call to E with:
        o,           //         the 1st command
        v,           //         x = v
        I ?          //         if the 2nd command is not a nilad:
          I - 2 ?    //           if the 2nd command is a monad:
            E(O, w)  //             y = result of the 2nd command as a monad
          :          //           else (the 2nd command is a dyad):
            w        //             y = w
        :            //         else:
          O          //           y = O
      )              //       end of call
    :                //     else (the 1st command is a nilad):
      I ?            //       if the 2nd command is not a nilad:
        E(O, o, v)   //         v = result of the 2nd command as a dyad
      :              //       else:
        v,           //         v is left unchanged
    w,               //     pass w unchanged
    n -=             //     decrement n if only one command was 'consumed':
      i == I | i & 1 //       i.e. if i = I or i is odd
  )                  //   end of recursive call
:                    // else:
  v                  //   we're done: return the final output value

```
> 10 votes

# Answer
# Jelly, 15 bytes

```
⁾D’y“S²a⁸~`”yKv

```

Try it online!

```
⁾D’y               Substitute D for Jelly's decrement builtin.
                   (This is done alone because ’ is a string terminator.)
    “      ”y      Substitute
     S²            S for square,
       a⁸          a for left argument,
         ~`        and ~ for reuse argument.
                   (+ and _ are already plus and minus.)
             K     Join the program on spaces to split up multi-digit numbers,
              v    and evaluate it as Jelly with the right argument as its sole argument.

```
> 9 votes

# Answer
# Charcoal, 147 bytes

```
Ｎθ≔θζＦ⁺⪫⪪⪫⪪Ｓ+~¦d¦_~¦z¦i«≡№DSdiz++__ι²«Ｆ⁼²Ｌυ⊞υθＦ²⊞υ⎇⊖Ｌυζι»¹«≔⎇υθζε≡ιD≦⊖εS≦×εεd≦⊗εz≦⁻εε⎚¿υ⊞υε≔εζ»⊞υ⎇⁼aιθＩι¿‹²Ｌυ«≔⎇⁼+§υ¹⁺§υ⁰§υ²⁻§υ⁰§υ²ζ≔…⟦ζι⟧⁻Ｌυ³υ»»Ｉζ

```

Try it online! Link is to verbose version of code. Takes the argument as the first input and the script as the second input. Explanation:

```
Ｎθ≔θζ

```

Input the argument and copy it to the flow-though value.

```
Ｆ⁺⪫⪪⪫⪪Ｓ+~¦d¦_~¦z¦i«

```

Transform the script by replacing the `+~` and `_~` operators with single-byte operators and appending the identity operator (in case the script ends with a dyadic operator). Loop over each operator.

```
≡№DSdiz++__ι

```

See how many arguments this operator expects.

```
²«Ｆ⁼²Ｌυ⊞υθＦ²⊞υ⎇⊖Ｌυζι»

```

If this is a dyad, then if there is already a dyad on the stack then push the argument as its RHS. Push the flow-through value and the dyad, ensuring that the dyad is between its operands. Note that the flow-through value is incorrect if there is already a dyad on the stack but that will be fixed up later.

```
¹«≔⎇υθζε≡ιD≦⊖εS≦×εεd≦⊗εz≦⁻εε⎚¿υ⊞υε≔εζ»

```

If this is a monad, then get either the flow-through value or the argument (depending on whether there is a dyad on the stack), apply the monad to it, then save it to the flow-through value or the stack (again depending on whether there is a dyad on the stack).

```
⊞υ⎇⁼aιθＩι

```

Otherwise push either the argument (if this is an `a` operator) or the numeric value of the digit to the stack, assuming that the next operator is a dyad.

```
¿‹²Ｌυ«

```

If we now have a dyad with both its arguments on the stack, then:

```
≔⎇⁼+§υ¹⁺§υ⁰§υ²⁻§υ⁰§υ²ζ

```

Update the flow-through value with the result of the dyad.

```
≔…⟦ζι⟧⁻Ｌυ³υ

```

If there were in fact two dyads on the stack, then recalculate the stack with the new flow-through value and the current dyad, otherwise clear the stack.

```
»»Ｉζ

```

Once the script has been processed output the final flow-through value.
> 6 votes

# Answer
# APL (Dyalog Unicode), 193 bytes (SBCS)

```
B M N←'(?<!⍨)([+_])' '(D|S|⍨[+_])' '[0-9⍵]'
_←-⍨
S←×⍨
D←¯1∘+
{(⍎'{','⍵}',⍨'.'⎕R' \0 '⌽(B,M)(B,N)(∊'('N')'B)(∊B'(?!'N'|'M')')⎕R')⊢\1)⍵\2((' ')⊢\0(' ')⊢⍨\2\1(' ')⊢\0⍵('⊢'a' '(.)~'⎕R'⍵' '⍨\1'⊢⍺)⍵}

```

Try it online!

Takes the program on the left and the argument on the right. I figured this'd be easy with APL's trains and regex, but apparently not ⍨.

```
⍝ Regexes (regices?) for dyads (B), monads (M), and nilads (N)
B M N←'(?<!⍨)([+_])' '(D|S|⍨[+_])' '[0-9⍵]'
_←-⍨ ⍝ The _ dyad (flipped because APL is RTL)
S←×⍨ ⍝ The S monad (multiply with itself)
D←¯1∘+ ⍝ The D monad (add -1 to decrement)

```

The actual function:

```
{(⍎'{','⍵}',⍨'.'⎕R' \0 '⌽(B,M)(B,N)(∊'('N')'B)(∊B'(?!'N'|'M')')⎕R')⊢\1)⍵\2((' ')⊢\0(' ')⊢⍨\2\1(' ')⊢\0⍵('⊢'a' '(.)~'⎕R'⍵' '⍨\1'⊢⍺)⍵}

```

First `'a' '(.)~'⎕R'⍵' '⍨\1'⊢⍺` replaces `a` with  and `+~` and `_~` with `⍨+` and `⍨_`. This is just to make life simpler later. The next part is

```
(B,M)(B,N)(∊'('N')'B)(∊B'(?!'N'|'M')')⎕R')⊢\1)⍵\2((' ')⊢\0(' ')⊢⍨\2\1(' ')⊢\0⍵('

```

This may look like a mess, but it's actually pretty simple:

* The pattern `BM` (dyad, monad) becomes `((M⍵)B⊢)`, but reversed.
* The pattern `BN` (dyad, nilad) becomes `(NB⊢)`, but reversed.
* The pattern `NB` (nilad, dyad) becomes `(NB⍨⊢)`, but reversed.
* The pattern `B` (dyad not followed by a nilad or monad) becomes `(⍵B⊢)`, but reversed.
* Monads not preceded by dyads are left as is.

This is pretty much an exact translation of the rules in the question. After this,  reverses everything because unlike Jelly, APL goes from right to left (this is also why `_` takes its arguments reversed). Then `'.'⎕R' \0 '` puts a space on each side of each character so that APL doesn't throw up the result thinking `SD` is a single token. Then the result `r` is turned into `{r⍵}` and evaluated to obtain a dfn. This function is applied to the outer function's right argument, .
> 4 votes

# Answer
# Pip, 129 bytes

```
YaLRqR"+~_~_"<>2;^"TZ-"`\W\w?|[A-Z]|..`Y V$0R['^.XU`([A-Z]|^.)$`][`&y``&a`]R(^"DSTZ").CXX'Y.[B.vB.'*.B"2*".B0]R`\W$`_.yR`^\W`y._y

```

Try it online!

### How?

We're basically going to use a translate-and-eval approach. Unlike Jelly (*cough*), Pip's execution model is rather different from Gelatin's, so the translation takes some work. We are fortunate in some ways: `0-9` and `+` can be used as they are, and so can `a` if we take the input number as a command-line argument.

```
Ya

```

Copy the input number into `y`, which will be our flow-through value.

```
qR"+~_~_"<>2;^"TZ-"

```

Read the Gelatin program from stdin and make some substitutions: `+~` -\> `T` (for Twice, since `x+x` = `2*x`), `_~` -\> `Z` (for Zero, since `x-x` = `0`), and `_` -\> `-` (so we can eval it later). After these substitutions, we have two dyads (`+` and `-`), four monads (`D`, `S`, `T`, and `Z`), and eleven nilads (`0` through `9`, plus `a`). Note that all monads are capital letters. Note also that both dyads are symbols, whereas all monads and nilads are alphanumeric.

```
LR  ...  `\W\w?|[A-Z]|..`

```

Parse the arity patterns with regex and loop over all matches. The first branch `\W\w?` matches a dyad followed by a monad, nilad, or nothing; the second branch `[A-Z]` matches a single monad; and the third branch `..` matches two characters, which in practice is the only remaining case, a nilad followed by a dyad.

```
$0R['^.XU`([A-Z]|^.)$`][`&y``&a`]

```

Starting from the arity pattern stored in the match variable `$0`, we make some more replacements. This stage adds the right argument for monads and for solitary dyads: A monad at the beginning of the pattern must be pattern 1; its argument should be `y`, the flow-through value. After that replacement, any other monad (pattern 2,1) or any other single character (pattern 2) should have a right argument of `a`, the input number.

```
...  R(^"DSTZ").CXX'Y.[B.vB.'*.B"2*".B0]

```

Next, we replace monads with the appropriate Pip expressions: `Dx` (here `x` represents the right argument, either `y` or `v`) becomes `Yx-1`; `Sx` becomes `Yx*x`; `Tx` becomes `Y2*x`; and `Zx` becomes `Y0`. (The `Y` enforces correct precedence of operations in the 2,1 pattern.)

```
...  R`\W$`_.yR`^\W`y._

```

Finally, we fill in the missing argument of each dyad. An operator at the end of the pattern is a dyad with a left argument (pattern 0,2), so its right argument should be `y`, the flow-through value. An operator at the beginning of the pattern is a dyad with a right argument (pattern 2,0 or 2,1 or 2), so its left argument should be \`y.

```
Y V  ...

```

Evaluate the resulting expression as Pip code, and store the result back into `y`.

```
y

```

After the loop, output the final value of `y`.
> 3 votes

---
Tags: code-golf, interpreter, jelly
---


title: Shortest Sorted Hello World

text:
# Question
Title: Shortest Sorted Hello World
Write a program that takes no input and prints `Hello, World!` to stdout or your language's closest alternative. The catch is that each line in your program must only contain printable ASCII characters and it must be in lexicographical order, a.k.a. sorted.

Here are all 95 printable ASCII characters in order:

```
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

```

So, for example, the line `!!A0~` would be invalid because the `A` and `0` are out of order. The line `!!0A~` would be valid.

Each line in your program may be any length and there may be any number of lines. Empty lines are considered sorted. Each of the newlines in your program must be the same (no mixing `\n` and `\r\n`). Tabs and other non-printable ASCII characters are forbidden.

**Due to popular demand, the win condition has been switched around:**
The submission with the fewest *lines* wins. Tiebreaker goes to the shortest program (newlines count as single characters).

Only `Hello, World!` and an optional trailing newline should be output. Note that HQ9+ is invalid since it outputs `hello, world`. I may forbid languages similar to HQ9+ that have one character "Hello, World!" commands due to their triviality.

Hint:

> This is definitely possible in Unary and Lenguage, though not very concisely.

# Answer
# Headsecks, 1 line, 366 bytes

<pre><code>                                                                        $(((((((((((((((((((((((((((((,000000044888<AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADIIIIIIIIIIIILPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPTXXXXXXXXXXXXXXXXXXXXXXXX\```diiiiiilqqqqqqqqtyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy|
</code></pre>

Headsecks is a trivial Brainfuck substitution where the only thing that matters is the code point modulo 8. The equivalent Brainfuck is merely

```
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------.

```

Luckily this naive approach *just* fits. There's some potential for golfing down bytes, but it might be hard.

Tested using this Python interpreter.

---

## Generating code

```
code = "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------."
command_map = "+-<>.,[]"

last_point = 32
out = []

for char in code:
    curr_mod = command_map.index(char)
    last_mod = last_point % 8

    if curr_mod > last_mod:
        last_point += curr_mod - last_mod

    elif curr_mod < last_mod:
        last_point += (8 - last_mod) + curr_mod

    out.append(chr(last_point))

print("".join(out))

```
> 19 votes

# Answer
# ///, 7 lines, 22 bytes

```
/
//Hello
,
 Wor
l
d
!

```

A rare chance for /// to be competitive (well as long as no one starts with Unary and Lenguage...).

The code first encounters a `/`, and parses the

```
/
//

```

as a substitution instruction which removes all newlines from the remainder of the program. Afterwards, the program merely reads

```
Hello, World!

```

which is printed verbatim as it doesn't contain any further slashes.
> 30 votes

# Answer
# JavaScript (~~67~~ ~~66~~ 62 lines, ~~227~~ 269 bytes)

(Note: only tested on Firefox 36 and Safari 8, contains minor ES6 features (the `Set` class))

```
Z
=
!""+
(0[[]]
+
(
!!""+Set
));c
=Z[~
-22]
$=Z[
3]
$$=Z[
15]
$$$=Z[
24]
$$$$=Z[
1]
$$$$$=Z[
0]
Set
[c
+
$$$+Z[
5]
+Z[
16]
+
$$$$$+
$$$$+Z[
2]
+c
+
$$$$$+
$$$+
$$$$]
(Z[
14]
+
$$+
$+
$$$$+
$$$$$+
"(\
'H\
"+
$+
$$+
$$+
$$$+
",\
 W\
"+
$$$+
$$$$+
$$+Z[
6]
+
"\
!')\
")
()

```

---

The code above basically does:

```
alert("Hello, World!")

```

Obviously `alert` is not sorted. So instead we need to generate the statement as a string, and "eval" it:

```
s = "alert('Hello, World!')";   // generate this using sorted code
eval(s)

```

How to generate the string? ES5 supports line continuation so that

```
"AL\
ERT" === "ALERT"

```

But the character code `\` appears *before* all lowercase letters, so we have to generate the lowercase letters using other methods.

We borrow some idea of JSFuck here. The lowercase letters involved in the alert statements are:

```
t e r a o l d

```

all of these can be extracted from characters of standard objects, which may be expressed in terms of some sorted sequence:

```
t, e, r ← true      = !""
a, l    ← false     = !!""
o       ← function  = Set
d       ← undefined = 0[[]]

```

How do we evaluate the string? Surely we cannot use `eval(s)` as it is not sorted. Alternatively we could use `Function(s)()`, but we cannot use `Function` as it is not sorted either. However, `Function` is the constructor of all functions, which means `Set.constructor === Function`.

Adding the identifier `constructor` makes the list of lowercase letters become:

```
t e r a o l d c u n s

```

which fortunately could still be generated by `"truefalseundefinedfunction"`:

```
t, e, r, u ← true      = !""
a, l, s    ← false     = !!""
o, c, n    ← function  = Set
d          ← undefined = 0[[]]

```

---

After prettifying, the code above should read like:

```
// lines 1~8 defines our string containing all lowercase letters we want
Z = true + (undefined + (false + Set))
// Z = "trueundefinedfalsefunction Set() { [native code] }"

// lines 8~20 defines the variables `c`, `$` (e), `$$` (l), `$$$` (o),
// `$$$$` (r), `$$$$$` (t)
// for the corresponding lowercase letters extracted from `Z`

// the rest calls:
Set["constructor"]("alert('Hello, World')")()
// lines 22~36 generates the "constructor" string
// lines 37~61 generates the "alert('Hello, World')" string

```

---

Update: Renamed `E`, `L`, `O`, `R`, `T` to various repetition of `$` to reduce 4 lines.
> 17 votes

# Answer
# Insomnia, 4 lines, 59 bytes

```
 FFFFGjnnnnooty
FLLddeejkopqyyyyy~~
(<ddjnoppppqrtu
<<Fddfj

```

This program is generated by optimizing for line count.

### 10 lines, 43 bytes

```
(u
pt
(dppty
p~
j
<Fptt{
(otz
?o
FLu
<?FFu~

```

This above program is generated by optimizing for byte count.
> 13 votes

# Answer
# Cygwin bash, 16 lines, 60 bytes

This only works due to the case-insensitive file name on Windows, and the fact that Cygwin look up the utilities case-insensitively even if you don't set it to recognize path case-insensitively.

```
A\
=Hello
A\
+=\
",
"Wor
A\
+=l
A\
+=d
A\
+=\
!
E\
CHO\
 $A

```

Take note of that `ECHO` at the end.
> 11 votes

# Answer
# \>\<\>, 6 lines, 111 bytes

```
  """""""/;;Hello
        &\o
      &++\oooo~~
"++++++++\bbbdlr
    +++++\ccccccccfooo}
    $++66\cfffffooooopr

```

I'm having trouble golfing out an extra line, but in any case I'm happy to have beaten the 7-line method.

## Explanation

\>\<\> is a stack-based 2D language where instructions are single chars and program flow can be up, down, left or right. The `"` instruction toggles string parsing, pushing chars until a closing `"` is met, but because of the nature of \>\<\> there's no such thing as "multi-line string parsing" like with CJam's strings or Python's triple quoted strings. This turned out to be a major problem because starting and ending a line with a `"` and having other chars in between (e.g. `"some chars"`) is not allowed!

Note that `/` and `\` reflect program flow, so we actually execute the first line then all of the lines in reverse order, and most lines are actually executed backwards!

```
[Line 1]

""""""              Three empty strings, push nothing
"/;;Hello  "        Push "/;;Hello  ". Note the wrapping - ><> is toroidal!
""""""              Three empty strings, push nothing

[Line 6]
66++$               Turn the top " " into "," by adding 12, then swap top two
rp                  Reverse stack and pop top 3
ooooo               Print "Hello", stack is now " ,"
fffffc              Push some 15s and a 12

[Line 5]
+++++               Sum the 15s and 12 to give 87, or "W"
}ooo                Move "W" to the back and output ", W"
fcccccccc           Push a 15 and some 12s

[Line 4]
++++++++            Sum the 15 and 12s to give 111, or "o"
"rldbbb\++++++++"   Push chars to stack
r                   Reverse stack
ld                  Push length of stack and 13, not used
bbb                 Push three 11s

[Line 3]
++&                 Sum the 11s to give 33, or "!" and put in register
~~                  Pop top two
oooo                Print "orld"

[Line 2]
&                   Put "!" from register to stack
o                   Print "!"

[Line 1]
;                   Terminate

```

---

On a side note, here's an amusing attempt at a \>\<\> least bytes (23 lines, 47 bytes):

```
v
"
!
d
l
r
o
W

,
o
l
l
e
H
"
/<
l
?
!
;
o
\^

```
> 11 votes

# Answer
# CJam, ~~5~~ 4 lines, 162 bytes

```
"Hello
")))))))))))))))))))))))))))))))))))68S\cel
"Wor
")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))@SX\c|

```

Same number of lines as Insomnia! (but a lot more bytes)

Try it online.

## Explanation

```
"Hello\n"        Push "Hello" and a newline
)                Uncons the newline
)))...)))        Increment the newline into a ","
68S\             Push 68 and a space then swap, leaving 68 on top
c                Convert 68 into a char "D"
el               Lowercase "D" into "d"
"Wor\n"          Push "Wor" and a newline
)                Uncons the newline
)))...)))        Increment the newline into an "l"
@                Rotate top three elements, moving the "d" to the top
SX\              Push a space and 1 then swap, leaving the space on top
c                Convert the space (which is an array) into a char
|                Bitwise or the space (32) with 1 to give "!" (33)

```

CJam automatically prints the stack afterwards.

Thanks to @Optimizer for reminding me that `Sc` works, because otherwise `SX|` fails (it does a setwise or instead, giving the array consisting of a space and 1).
> 10 votes

# Answer
# PHP (7 / 17 lines, 36 / 59 bytes):

Due to the amount of invalid answer, I rewrote this answer.

The browser version? Gone.

But I have 2 solutions, both based on bitwise `xor` (`^`) of strings in PHP.

This is an extremely powerful solution! Sometimes, it allows to save plenty of bytes.

First, the shortest answer:

```
Echo
Hello
,AM^mm
,Wor
,OOO^
"#+n
";

```

I know, it looks awful, but it works!

The next one depends on newlines.

Yes, it uses newlines (`\n`/UNIX style is required)!

```
Echo
Bo
.ff
.e
.
"&*]ex
fn
"^
"\n
\n
\n
\n
\n
\n
\n
",B^c
;

```

The newlines on this one are required to work.

It isn't perfect, but works!

---

Both answers were based on @MartinBüttner's solution:

```
Echo
Hello
.
chr
(44
).
chr
(29
+3
).Wor
.l
.d
."!
";

```

---

A special thank to @n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳, @CJDennis, @MartinBüttner and @skagedal for detecting all my mistakes and for their suggestions.
> 8 votes

# Answer
# \>\<\> (Fish), 5 lines, many bytes

The code is extremely long, when I say `[6535529689086686142930090 '+' signs]` and `[6535529689086686142930090 'd' characters]` in the first line of the code, I mean that there are literally `6535529689086686142930090` plus signs in a row!

(And for the following lines add the necessary prefix spaces.)

```
'[6535529689086686142930090 '+' signs]^`[6535529689086686142930090 'd' characters]
                                   **,/288
                                     -/:o
                             %**288:;?\
                                   (1:\

```

A shorter testable alternative which only prints `Hi`:

```
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++^`hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
                                                                                **,/288
                                                                                -/:o
                                                                                %**288:;?\
                                                                                (1:\

```

Method:

* In the first line we create a huge number representing the string in base128.
* In the rest of the lines (going from bottom to top) we print the following character in every loop until the value of the integer reaches 0.
* The looping code is `:1(?;:882**%:o-288**,`.

(We can print arbitrary 2+ chars long string with this method.)
> 8 votes

# Answer
# Pyth, 7 lines, 23 bytes

```
-
"Hello
,
 Wor
l
d
!"b

```

Pretty simple, just use a multiline string and remove the newlines.

Try it here.
> 7 votes

# Answer
# Forth, 41 lines, 143 bytes

Try it online.

I'm very proud of this. I whipped it out pretty quickly once I found I could do it, having Google searched for case-insensitive languages, and I already know Forth decently. It can almost definitely be shortened, both bytes and lines. Suggestions are appreciated. :D

This program essentially pushes the decimal value of each ASCII character, then prints each one. I attempted to optimize while I wrote it, hence it is less readable than I'd like.

```
33
99
1
+
DUp
8
+
2DUp
6
+
SWap
11
+
2OVer
SWap
8
9
*
EMit
1
+
EMit
DUp
DUp
EMit
EMit
3
+
EMit
29
3
2DUp
+
EMit
*
EMit
EMit
EMit
EMit
EMit
EMit

```
> 4 votes

# Answer
# Marbelous, 9 lines, 94 bytes

```
3333
    @ADD
    358C
++--29\\
++--3555DE
<<<<<<>>~~
+++++446666D
++++++++../\
      ++------

```

Test it online here. `Using spaces for blank cells` must be checked.

**Visual representation of source:**

**Explanation:** Each hexadecimal value in this program moves downward every "tick" (unless it is on `\\`, in which case it moves to the right). `++` will increment the value, `--` decrement, `~~` apply a bitwise not, etc. Values that fall of the bottom are printed as an ASCII character.

For example: The `33` in the top corner becomes `(((0x33 +1 +1) << 1) +1 +1 = 0x6C (l)`.
> 4 votes

# Answer
## Batch - 39 Lines (202 bytes)

I wanted to cut down on the size by enabling delayed expansion by running the code inside of a `cmd` call using the `/v on` switch, but could not get past all the carats.

```
@S^
ET^
LO^
C^
AL^
 EN^
ABL^
E^
DEL^
AY^
E^
DEX^
P^
ANS^
IO^
N
@S^
ET^
 0=Hello
@S^
ET^
 1=^
,^
 Wor
@S^
ET^
 2=l
@S^
ET^
 3=d
@E^
CHO^
 !^
0^
!!1^
!!2^
!!3^
!^^^
!

```

Without the newlines (and carats to escape newlines):

```
@SETLOCAL ENABLEDELAYEDEXPANSION
@SET 0=Hello
@SET 1=, Wor
@SET 2=l
@SET 3=d
@ECHO !0!!1!!2!!3!^^!

```
> 3 votes

# Answer
# Rebol - 15 lines (51 bytes)

```
PRin
AJOin
[
'Hello
Sp
+
12
Sp
'Wor
'l
'd
Sp
+
1
]

```

Words in Rebol are case-insensitive (eg. `PRINT`, `Print` and `print` would all call the same function).

The above code tidied up:

```
prin ajoin [
    'Hello  sp + 12  sp  'Wor  'l  'd  sp + 1
]

```

NB. `sp` returns the space char!
> 2 votes

# Answer
# Perl, 17 lines

```
$_
=
'pr
int
"Hello
,
 Wor
l
d
!"';s
!
!!g
;s
!.
*
!$&
!eex

```
> 2 votes

# Answer
# Unary, 1 line, lots of bytes

Every character in this program is `0`. The source is too long to put in here, but it consists of a string of this many zeros:

```
327380789025192647555922325233404088310881092761595127419003295178342329930050528932118548

```

This is the decimal representation for this binary number:

```
0b1010010010010010010010010110000010010010010110000010010000010010010000010010010000010001001001001011111000010000010000011110001111001011111000000100000011011011100010010010010010010010100100010010010100000000100001011100001100010010010100011011011011011011100011011011011011011011011100000000010100

```

Which was created from this BrainF\*** program:

```
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>-[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.

```

See how I generated it: http://ideone.com/lMT40p
> 2 votes

# Answer
# Vyxal, 9 lines, 25 bytes

```
`
Hello
,
 Wor
l
d
!`
\
-

```

Try it Online!

```
`        #
Hello    |
,        |
 Wor     | Push 'Hello\n,\n Wor\nl\nd\n!'
l        |
d        |
!`       #
     \   # Push '\n'
      -  # Remove all '\n' from 'Hello\n,\n Wor\nl\nd\n!'
         # Implicit output

```
> 2 votes

# Answer
# Ruby, 19 lines, 95 bytes

```
$;=
$>
$;<<
:Hello
$;<<
44::chr
$.=
33::
-1
$;<<
$.::chr
$;<<
:Wor
$;<<
:l
$;<<
:d
$;<<
33::chr

```

Possibly the second-hardest code restriction for Ruby I've seen on this site, after the monstrosity here.

Edit for explanation: The only Ruby output method that's sorted is the `<<` method on STDOUT. Unfortunately, the constant for STDOUT is `$>`, and `>` is higher ASCII than most symbols, so it's not really possible to call a method on it. We need a multi-line assignment statement to get it into a more tractable variable name, `$;` (semicolon is still pretty high, but most variables of this form are either non-assignable, or can only be strings).

Symbols (`:Wor`, etc. ) are the easiest way to do a literal, and I don't see a way to strip newlines from a string, so I need multiple print statements. The space and punctuation can't go into a symbol literal, but luckily the `chr` method on numbers is legal, so I can get a character from its ASCII value. `::` is an alternate way of calling methods. Space is tricky because I can't write `32`, so I subtract 1 from 33 and assign it to a variable.
> 1 votes

# Answer
# Retina, 12 lines, 29 bytes (non-competing)

The language is newer than the challenge.

```

Hello
$
,
$
 Wor
$
l
$
d
$
!
```

**Try it online**
> 0 votes

---
Tags: code-golf, restricted-source, printable-ascii, hello-world
---


title: ASCII Hangman in Progress

text:
# Question
Title: ASCII Hangman in Progress
*(inspired by a question over on Code Review)*

Suppose two people are playing Hangman, but you've only overheard the game and want to draw the current status.

Given two words as input, where the words each match `[A-Z]+` or `[a-z]+` (your choice), output the current state of the hangman game as ASCII art, following the below rules.

* The first word is the word to be guessed, and the second word is the already-guessed letters. These can be taken as input in any order.
* The word to be guessed is guaranteed non-empty, but the already-guessed letters may be empty (i.e., as if it's the start of the game).
* The game will always be a valid hangman game (i.e., guessed letters won't be duplicated, letters won't be guessed past the end of the game, you'll only receive letters as input, etc.).
* Below the hangman drawing must be the word to be guessed, with `_` in place of letters yet unknown, separated by spaces. For example, if the word to be guessed was `BOAT`, then below the hangman drawing must be `_ _ _ _`. If the word was `BOAT` with `A` guessed, then below the drawing must be `_ _ A _`.
* Below the word to be guessed must be letters already guessed that are *not* in the word. These can be in any order, and can be separated by any non-alphabetical separator, if so desired.

Here are the states of the hangman game, from initial start to game end. Each wrongly guessed letter advances the state by one. So the first wrongly guessed letter makes the head `O` appear, the next makes the body `|` appear, etc.

```
  +---+
  |   |
      |
      |
      |
      |
=========

  +---+
  |   |
  O   |
      |
      |
      |
=========

  +---+
  |   |
  O   |
  |   |
      |
      |
=========

  +---+
  |   |
  O   |
 /|   |
      |
      |
=========

  +---+
  |   |
  O   |
 /|\  |
      |
      |
=========

  +---+
  |   |
  O   |
 /|\  |
 /    |
      |
=========

  +---+
  |   |
  O   |
 /|\  |
 / \  |
      |
=========

```

## Input

* Two strings in any convenient format, with the first guaranteed non-empty.
* You can take the input in either order (e.g., word to guess and then guessed letters, or vice versa). Please state in your submission the input order.

## Output

The resulting ASCII art representation of the hangman game in progress, as described above, again in any convenient format.

## Rules

* Leading or trailing newlines or whitespace are all optional, so long as the characters themselves line up correctly.
* Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
* If possible, please include a link to an online testing environment so other people can try out your code!
* Standard loopholes are forbidden.
* This is so all usual golfing rules apply, and the shortest code (in bytes) wins.

## Examples

### #1

`BOAT` and `ATG`

```
  +---+
  |   |
  O   |
      |
      |
      |
=========
_ _ A T
G

```

### #2

`ZEPPELIN` and

```
  +---+
  |   |
      |
      |
      |
      |
=========
_ _ _ _ _ _ _ _

```

### #3

`ZEPPELIN` and `EATOLINSHR`

```
  +---+
  |   |
  O   |
 /|\  |
 / \  |
      |
=========
_ E _ _ E L I N
A T O S H R

```

### #4

`RHYTHM` and `ABCDE`

```
  +---+
  |   |
  O   |
 /|\  |
 /    |
      |
=========
_ _ _ _ _ _
EDCBA

```

### #5

`BOAT` and `ATOB`

```
  +---+
  |   |
      |
      |
      |
      |
=========
B O A T

```

### #6

`AIRPLANE` and `AJKEI`

```
  +---+
  |   |
  O   |
  |   |
      |
      |
=========
A I _ _ _ A _ E
KJ

```

# Answer
> 10 votes
# Python 2, ~~215~~ ~~192~~ ~~184~~ 183 bytes

-8 bytes thanks to Raphaël Côté
-1 byte thanks to Jonathan Frech

```
a,b=input()
j=' '.join
s=b-set(a)
print"""  +---+
  |   |
  %s   |
 %s%s%s  |
 %s %s  |
      |
=========
"""%tuple('O/|\/\\'[:len(s)].ljust(6)),j(['_',i][i in b]for i in a),'\n',j(s)

```

Try it online!

# Answer
> 8 votes
# Charcoal, ~~83~~ ~~69~~ 68 bytes

```
Ｆη¿№θι⁰«ι→⊞υι»←⸿Ｆθ«⎇№ηιι_→»←⸿×=⁸↖=←↑⁵←+←³↓+|ＦＬυ≡ι⁰↓O¹←|²/|³\⁴⸿ /⁵ \«

```

Try it online! Link is to verbose version of code. Edit: Saved 14 bytes by switching to `switch`. Saved 1 byte by printing the single `|` as a literal. Note: At the time the question was set, `switch` didn't work at all in Verbose mode and needed a trailing `«` in Succinct mode (the current version on TIO has neither bug, so it shows the Succinct translation as 67 bytes), while `Map`'s bugs prevented me from using `Print(Join(Map(q, Ternary(Count(h, i), i, "_")), " "));`. Fortunately I managed to come up with a kludge for the same length (and indeed I also tried switching the other loop to a Map but it too came out at the same length). Explanation:

```
Ｆη              For each letter in the guess,
  ¿№θι⁰«        if the word to be guessed does not contain the letter,
        ι→      print the failed guess, leave a gap,
          ⊞υι»  and push the letter to the array.

←⸿              Move to the start of the previous line.

Ｆθ«             For each letter in the word to be guessed,
   ⎇№ηιι        if the letter has been guessed then print it
        _       otherwise print a _.
         →»     Either way, leave a gap.

←⸿              Move to the start of the previous line.

×=⁸             Print 8 =s
   ↖=←          Print a 9th =, moving into position to
      ↑⁵        print 5 |s upwards,
        ←+←³    a + and 3 -s left,
            ↓+| and a + and a | down.

ＦＬυ             Loop once for each incorrect guess.
   ≡ι           Choose what to print based on the loop index.
     ⁰↓O        For the first incorrect guess, print an O.
     ¹←|        For the second incorrect guess, print a |.
     ²/         For the third incorrect guess, print a /.
     ³|\        For the fourth incorrect guess, print a \.
     ⁴⸿ /       For the fifth incorrect guess, print a / on the next line.
     ⁵ \        For the sixth incorrect guess, print another \.

```

# Answer
> 7 votes
# Python 2, 220 bytes

```
x,y=input()
x=[['_',k][k in y]for k in x]
y-=set(x)
s='''  +---+
  |   |
  0   |
 213  |
 4 5  |
      |
'''
for i in range(6):s=s.replace(`i`,[' ','O|/\\/\\'[i]][len(y)>i])
print s+'='*9+'\n'+' '.join(x)+'\n'+''.join(y)

```

Try it online!

-35 bytes thanks to Raphaël Côté
-20 bytes using sets
-1 byte thanks to micsthepick

# Answer
> 5 votes
# Jelly,  ~~72~~  73 bytes

+1 fixing an ace game bug that showed the full hanged person (changed `LN` to `Lạ6` near the end)

```
e€a⁸o”_$,ḟ@©K€Y,@“¥[$⁼Ż⁸½c¤ṫȷṃl®ḌvNṂeL©?Ḥ’ṃ“ -¶|O/\=+”¤Y⁶“$"÷ȷñŒ‘ḣ®Lạ6¤¤¦

```

A dyadic link taking the word on the left and the (unique and within-game) letters on the right and returning a list of characters, or a full program taking the input as command line arguments and printing the result.

**Try it online!**

### How?

Firstly:

```
“¥[$⁼Ż⁸½c¤ṫȷṃl®ḌvNṂeL©?Ḥ’ - base 250 number
                            = 305169639782226039115281574830092231403740634016078676

```

Is the numeric value of the full hanged person in base 9, where each of the 9 digits represent one of the characters: `<space>`, `<newline>`, `-`, `|`, `O`, `/`, `\`, `=`, or `+`.

the rest of the program:

```
e€a⁸o”_$,ḟ@©K€Y,@“...’ṃ“...”¤Y⁶“...‘ḣ®Lạ6¤¤¦ - Main link word, letters
e€                                           - exists in letters for €ach char in word
  a⁸                                         - and with word (word with 0 at un-guessed)
    o”_$                                     - or with '_' (word with _ at un-guessed)
         ḟ@                                  - filter remove (incorrect guesses)
           ©                                 - copy the result to the register and yield
        ,                                    - pair
            K€                               - join €ach with spaces
              Y                              - join with (a) newlines
                            ¤                - nilad followed by link(s) as a nilad:
                 “...’                       - the number described above
                       “...”                 - list of chars " -¶|O/\=+" (¶ = a newline)
                      ṃ                      - base decompress using the chars as digits
               ,@                            - pair (using swapped @rguments)
                             Y               - join with (a) newlines
                                           ¦ - sparse application:
                              ⁶              -   of: a space character
                                             -   to indexes:
                                          ¤  -     nilad followed by links as a nilad:
                               “...‘         -       literal [36,34,28,26,27,19]
                                         ¤   -       another nilad chain:
                                     ®       -         recall from register
                                      L      -         length (# of bad guesses)
                                       ạ6    -         absolute difference with 6
                                    ḣ        -       head (get the indexes to "erase"
                                             -             by applying the space char)
                                             - as a full program: implicit print

```

# Answer
> 3 votes
# Japt v2, ~~94~~ ~~91~~ ~~83~~ 81 bytes

*-3 bytes from some ideas from @ETHproductions' approach to this.*
*-8 bytes by using multiline string rotation.*
*-2 bytes by using v2.*

```
["+|||||
-
-
-  35
+|01
   24
"r\d_¨VkU l ?S:"O|/\\/\\"gZÃz '=³³¡VøX ?X:'_Ã¸VkU]·

```

Takes both word inputs as arrays of characters, with the guessing word first and guessed letters second. Incorrect letters are shown separated by `,`s. When there are no incorrect letters, the last line is blank (meaning output contains an extra trailing newline).

Try it online!

## Explanation

Implicit: `U` and `V` are input char arrays.

```
["..."

```

Start an array and push the hanging man format string, rotated left 90°.

```
r\d_

```

Replace (`r`) every digit (`\d`) with the following function:

```
¨VkU l ?S:"O|/\\/\\"gZÃ

```

If the digit is `>=` (`¨`) the amount of wrong guesses (`VkU l`), a space (`S`), otherwise, get the appropriate body part for that digit (`"..."gZ`).

```
z '=³³

```

Rotate the hanging man right 90° and push `=` repeated 3\*3 (`³³`) times to the array.

```
¡VøX ?X:'_Ã

```

Push the word-to-guess, with letters mapped (`¡`) to either themself (`X`) if contained in `V` (`VøX`), or `_` if not, and joined with spaces (`¸`), to the array.

```
VkU]·

```

Push the guessed-letters, with the letters in the word-to-guess removed (`k`), to the output array. Close the array and join with newlines (`·`).

Rotation visualized:

> ```
> +|||||      +---+
> -           |   |
> -      ->   0   |
> -  35      213  |
> +|01       4 5  |
>    24
>
> ```

# Answer
> 2 votes
# 05AB1E, 83 bytes

```
•LO„Ÿ¼Ì‘Šη…ÔÆ#δʒΣ•6B4ÝJ"+ -|="‡²¹SK©Ùg"O/|\/\"s£v5y.;}7ô»„==«5ð:¹D²SKDg'_×‡Sðý®Sðý»

```

Try it online!

---

# The Bitmap:

# 05AB1E, 18 bytes

```
•LO„Ÿ¼Ì‘Šη…ÔÆ#δʒΣ• # Push number described below in base-10.

```

Try it online!

This pushes the following bitmap plan:

```
1102220
1131113
1151113
1555113
1515113
1111113
4444444

```

---

Where the following additional bytes:

# 05AB1E, 13 bytes

```
6B            # Convert to base-6.
  4ÝJ         # Push 01234.
     "+ -|="  # Push that string.
            ‡ # Replace numbers with those letters.

```

Try it online!

Replace the pieces of the bitmap with the appropriate characters, leaving the 5's for replacing the pieces of the hangman later:

```
  +---+
  |   |
  5   |
 555  |
 5 5  |
      |
=======

```

---

# The Hanged Man:

Next, we calculate how many times the user guessed wrong by grabbing the letters that are in the second input, but not in the first input:

# 05AB1E, 6 bytes

```
²¹SK   # Get wrong guesses.
    ©Ù # Store them, and get unique wrong letters.

```

Try it online!

---

Finally, we use a secondary bitmap to substitute in the hanged man, separating by newlines and preparing it for the final print:

# 05AB1E, 26 bytes

```
g                           # Get the number of "messups".
 "O/|\/\"s£                 # Only that many chars of the hanged "bitmap".
           v5y.;}           # Replace 5's with "bitmap".
                 7ô»        # Split into rows.
                    „==«5ð: # Remove additional 5's.

```

Try it online!

This results in the first pieces, the only remaining pieces being outputting the two words at the bottom in a diff format...

---

# The Words Below:

Print the first word without the missing guesses:

# 05AB1E, 15 bytes

```
¹D²SK          # Word without the missing guesses.
     Dg'_×‡    # Replace missing guesses with "_".
           Sðý # Join by spaces.

```

Try it online!

---

# 05AB1E, 5 bytes

```
®     # Print stored missing guesses.
 Sðý  # Separated by spaces.
    » # Print everything in stack with newlines.

```

Try it online!

Print the calculated missed guesses from earlier we stored in a register.

# Answer
> 1 votes
# Jelly, 86 bytes

```
3ȷ6Dẋ6Ḍ+“Ȧṇ⁹c’
œ-Lḣ@“Ñæçðøþ‘⁵*$€×“µI,’D¤¤S+¢Dị“+-|/\O ”Us7Y,”=x9¤Y;⁷,œ-ðjɓi@€ị³;”_¤K;⁷

```

Try it online!

Whew... this was fun. I've never used so many `¤` characters.

**How it Works**

```
3ȷ6Dẋ6Ḍ+“Ȧṇ⁹c’ (1) the literal 300000030000003000000300000030003001222100
3ȷ6              - literal 3*10^6 = 3000000
   D             - digits
    ẋ6           - repeat six times
      Ḍ          - return to integer: 300000030000003000000300000030000003000000
       +         - add
        “Ȧṇ⁹c’   - literal 2998222100

œ-Lḣ@“Ñæçðøþ‘⁵*$€×“µI,’D¤¤S+¢Dị“+-|/\O ”Us7Y,”=x9¤Y,œ-;⁷ð,ɓi@€ị³;”_¤K;⁷
œ-Lḣ@“Ñæçðøþ‘⁵*$€×“µI,’D¤¤S - representation of the body parts
œ-L                           - wrong letters length
   ḣ@                         - get that many elements from the start of
                        ¤¤    - the literal:
     “Ñæçðøþ‘                   - [16, 22, 23, 24, 29, 31]
             ⁵*$€               - 10 to the power of each of them
                 ×              - multiplies by
                  “µI,’D        - the list [6, 4, 3, 5, 4, 5]
                          S   - sum
+¢Dị“+-|/\O ”Us7Y,”=x9¤;⁷  - complete the man
+                           - add
 ¢                          - the literal 3000000...1222100 calculated by link 1
  D                         - digits
   ị“+-|/\O ”               - index into the string “+-|/\O ”
             Us7Y           - reverse, split into lines of 7, join by linefeeds
                 ,          - append
                  ”=x9¤;⁷     - the string “=========”
                       ;⁷    - add a newline
,œ-                 - append missed letters:
,                      - append
 œ-                    - set difference
ð,ɓi@€ị³;”_¤K;⁷     - append the blanks
ð,ɓ                   - append
   i@€ị³;”_¤            - each letter if it is included in guesses, _ otherwise
            K         - join by spaces
             ;⁷       - add a newline

```

# Answer
> 1 votes
# C#, ~~305~~ 296 bytes

```
using System.Linq;w=>g=>{var r=string.Concat(g.Where(c=>!w.Contains(c)));var n=r.Length;return$@"  +---+
  |   |
  {(n>0?"O":" ")}   |
 {(n>2?"/":" ")+(n>1?"|":" ")+(n>3?"\\":" ")}  |
 {(n>4?"/":" ")} {(n>5?"\\":" ")}  |
      |
=========
{string.Join(" ",w.Select(c=>g.Contains(c)?c:'_'))}
"+r;}

```

*Svaed 9 bytes thanks to @raznagul.*

Try it online!

Full/Formatted Version:

```
using System;
using System.Linq;

class P
{
    static void Main()
    {
        Func<string, Func<string, string>> f = w=>g=>
        {
            var r = string.Concat(g.Select(c => !w.Contains(c) ? c + "" : ""));
            var n = r.Length;

            return $@"  +---+
  |   |
  {(n > 0 ? "O" : " ")}   |
 {(n > 2 ? "/" : " ") + (n > 1 ? "|" : " ") + (n > 3 ? "\\" : " ")}  |
 {(n > 4 ? "/" : " ")} {(n > 5 ? "\\" : " ")}  |
      |
=========
{string.Join(" ", w.Select(c => g.Contains(c) ? c : '_'))}
" + r;
        };

        Console.WriteLine(f("BOAT")("ATG") + "\n");
        Console.WriteLine(f("ZEPPELIN")("") + "\n");
        Console.WriteLine(f("ZEPPELIN")("EATOLINSHR") + "\n");
        Console.WriteLine(f("RHYTHM")("ABCDE") + "\n");
        Console.WriteLine(f("BOAT")("ATOB") + "\n");

        Console.ReadLine();
    }
}

```

This also works for 314 bytes (could probably be shorter still):

```
using System.Linq;w=>g=>{var r=string.Concat(g.Select(c=>!w.Contains(c)?c+"":""));var s=$@"  +---+
  |   |
  0   |
 213  |
 4 5  |
      |
=========
{string.Join(" ",w.Select(c=>g.Contains(c)?c:'_'))}
"+r;for(int i=0;i<6;++i)s=s.Replace(i+"",i<r.Length?i<1?"O":i<2?"|":i<3?"/":i<4?"\\":i<5?"/":"\\":" ");return s;}

```

# Answer
> 1 votes
# JavaScript (ES6), ~~203~~ ~~196~~ ~~187~~ ~~186~~ ~~185~~ ~~184~~ ~~180~~ ~~177~~ 176 bytes

Takes input as 2 arrays of individual characters in currying syntax.

```
a=>g=>`  +---+
  |   |
  1   |
 324  |
 5 6  |
      |
=========
${a.map(x=>g[s="includes"](x)?x:"_")}
`.replace(/\d|,/g,m=>" O|/\\/\\"[!!w[~-m]*~~m],w=g.filter(x=>!a[s](x)))+w

```

---

## ~~Try~~ Play it

```
o.innerText=(f=
a=>g=>`  +---+
  |   |
  1   |
 324  |
 5 6  |
      |
=========
${a.map(x=>g[s="includes"](x)?x:"_")}
`.replace(/\d|,/g,m=>" O|/\\/\\"[!!w[~-m]*~~m],w=g.filter(x=>!a[s](x)))+w)([...i.value="ZEPPELIN"])([...j.value=""])
oninput=_=>o.innerText=f([...i.value.toUpperCase()])([...j.value.toUpperCase()])
```

```
label,input{font-family:sans-serif;font-size:14px;height:20px;line-height:20px;vertical-align:middle}input{margin:0 5px 0 0;width:100px;}
```

```
<label for=i>Word: </label><input id=i type=password><label for=j>Guesses: </label><input id=j><pre id=o>
```

# Answer
> 1 votes
# Vim, 118 bytes

```
jYk:s/[^<C-r>0]/_/g
:s/./& /g
Yj:s/[<C-r>0]//g
oO|/\/\ <esc>ka <esc>jv$r dd{P|i |
 <esc>la
<esc>xpla
<esc>lxpo   <esc>:0,s/.*/ &  |/
o<esc>9i=<esc>{O  +---+

```

Try it online!

# Answer
> 1 votes
# Batch ~~853~~ ~~748~~ 736 bytes

Run from the command line with 2 args:

`%1` = word, `%2` = "doublequoted,delimited,list,of,letters"

**edit: requires Windows 10 / Virtual terminal support**

```
Echo off&cls
Set "$=Set "
%$%O=Echo(&%$%F=For /L %%i in (&%$%P=^<nul Set/P &%$%"C=|findstr "
%f:L=f%'%O%prompt $E^|cmd')do %$%\=%%i[
%$%n=^

Setlocal EnableDelayedExpansion
%F:/L=%"e1=3;3HO" "e2=4;3H|" "e3=4;2H/" "e4=4;4H\" "e5=5;2H/" "e6=5;4H\" "D= +---+!n!  |   |!n!")Do %$%%%i
%F%1 1 5)Do %$%D=!D!      ^|!n!
%O%!D!=========!n!&If "%~2"=="" Exit /b
%$%W=%~1&%F:/L=%%~2)Do (%$%/A i+=1
%$%G!i!=%%i&%$%G=!G!/ic:"%%i" )
%F%30,-1,0)Do if not "!W:~%%i,1!"=="" If "!#!"=="" %$%"#=%%i"
%O%%\%10;2H&%F%0 1 !#!)Do (%$%/A X=%%i+2
%P%"=%\%10;!X!H."&%O%"!W:~%%i,1!"%C%!G! >nul &&%P%"=%\%1D!W:~%%i,1!")
%P%"=%\%11;2H"&%F%1 1 !i!)Do %O%!W!%C%/ic:"!G%%i!" >nul||(%P%"=!G%%i!"&%$%/A e+=1)
%F%1 1 !e!)Do %P%"=%\%!e%%~i!"
%O%%\%11;1H

```

How? macros are used for repeated commands

* `Set`  Variable assignment `%$%`
* `For /L %%i in (` loops `%F%`
    + Substring modification is used to recycle the macro as `for /f` (`%F:L=f%`) or basic `for` loops (`%F:L=%`)
* `Echo(` (output type 1) `%O%`
* `< Nul Set /P` (output type 2) `%P%`
* `Findstr` (String comparison used in testing guesses against letters in word) `%C%`

The remarked ungolfed version:

```
@Echo off
 cls

:# define VT escape character 0x027
 For /f %%i in ('Echo(prompt $E^|cmd')do Set ESC=%%i[

:# define linefeed. empty lines required. must be expanded with delayed expansion
(Set \n=^

%= ABOVE EMPTY LINES REQUIRED =%)
:# enable environment to allow use of linefeed; modification of variables during code blocks and parsing of nested variables to emulate arrays
Setlocal EnableDelayedExpansion

:# define array of bodypart location and character representation 'incorrect.#'; define top 2 lines of Gallows
 For %%i in ("incorrect.1=3;3HO" "incorrect.2=4;3H|" "incorrect.3=4;2H/" "incorrect.4=4;4H\" "incorrect.5=5;2H/" "incorrect.6=5;4H\" "Gallows= +---+!\n!  |   |!\n!")Do Set %%i

:# define and output the remaining elements of the Gallows
 For /L %%i in (1 1 5)Do Set "Gallows=!Gallows!      |!\n!"
 Echo(!Gallows!=========!\n!

:# Exit script if second argument empty [ no letters guessed ]
 If "%~2"=="" Exit /b

:# assign word variable to facilitate substring assessment of word
 Set "Word=%~1"
 For %%i in (%~2)Do (                              %= For each delimited letter in argument =%
  Set /A "Guess.index+=1"                            %= Increment count                     =%
  Set "Guess.letter!Guess.index!=%%i"                %= Assign letter to Guess.letter array =%
  Set "Guess.letters=!Guess.letters!/ic:"%%i" "      %= Build list of findstr search values =%
 )

:# Calculate word string length [ 0 indexed ]
 For /L %%i in (30,-1,0)Do if not "!Word:~%%i,1!"=="" If "!Word.Length!"=="" Set "Word.Length=%%i"

:# move cursor to line 10 column 2 in advance of correct guess result output
 Echo(%ESC%10;2H

 For /L %%i in (0 1 !Word.Length!)Do (                   %= For each character in word                       =%
  Set /A "Xpos=%%i+2"                                    %= Assign X position offset for '.' output          =%
  <nul Set/P "=%ESC%10;!Xpos!H."                         %= Output '.' denoting unguessed letter spaces      =%
  Echo("!Word:~%%i,1!"| findstr !Guess.letters! >nul &&( %= Test letter in word against guessed letters list =%
   <nul Set/P "=%ESC%1D!Word:~%%i,1!"                    %= On match shift cursor left; overwrite unguessed marker '.' with matched letter =%
  )
 )

:# move cursor to line 11 column 2 in advance of incorrect guess result output
 <nul Set/P "=%ESC%11;2H"

 For /L %%i in (1 1 !Guess.index!)Do (                %= For each guessed letter                         =%
  Echo(!Word!|findstr /ic:"!Guess.letter%%i!" >nul||( %= Test index of guess array for a match in word   =%
   <nul Set/P "=!Guess.letter%%i!"                    %= On NO match output incorrectly guessed letter - =%
   Set /A "incorrect.guess.count+=1"                  %= and increment incorrect.guess.count             =%
  )
 )

:# For each index in incorrect.guess.count output incorrect.# array value - [ Y;Xcharacter ]
 For /L %%i in (1 1 !incorrect.guess.count!)Do <nul Set/P "=%ESC%!incorrect.%%~i!"
 Echo(%ESC%11;1H
``

```

# Answer
> 0 votes
# Scala, ~~392~~ 389 bytes

**This might *still* be heavily golfable.**

This is inside a function taking `s` and `t` as parameters, with `s` the word to guess and `t` the string containing already tried letters.

```
var f=s.map(x=>if(t contains x)x else"_") mkString " "
var o="""  +---+
  |   |
  0   |
 213  |
 4 5  |
      |
=========
"""
var c=0
var g=t.filter(x=>if(s contains x){false}else{c match{case 0=>o=o.replace("0","o")
case 1=>o=o.replace("1","|")
case y if y==2|y==5=>o=o.replace(y+"","\\")
case y if y==3|y==4=>o=o.replace(y+"","/")
case _=>()}
c+=1
true})
o.replaceAll("\\d"," ")+f+"\n"+g

```

EDIT:
-1 byte: `t.contains(x) -> t contains x`
-1 byte: `s.contains(x) -> s contains x`
-1 byte: `.mkString(" ") -> mkString " "`

Try it online!

# Answer
> 0 votes
# PHP 7, 246 bytes

```
for($t="  +---+
  |   |
  1   |
 324  |
 5 6  |
      |
=========
";$c=($w=$argv[1])[$i++];)$t.=strstr($g=$argv[2],$c)?"$c ":"_ ";for($t.="
";$c=$g[$k++];)strstr($w,$c)?:$t.=$c.!++$n." ";for(;$p++<6;)$t=strtr($t,$p," O|/\/\\"[$p>$n?0:$p]);echo$t;

```

takes input from command line arguments. Run with `-nr` or try it online.

```
for($t="  +---+\n  |   |\n  1   |\n 324  |\n 5 6  |\n      |\n=========\n";
    $c=($w=$argv[1])[$i++]; # 1. loop $c through word
)
    $t.=strstr($g=$argv[2],$c)  # if guessed,
        ?"$c ":"_ ";                # then append letter, else append underscore
for($t.="\n";$c=$g[$k++];)  # 2. loop through guesses
    strstr($w,$c)?:             # if not in word
        $t.=$c.!++$n." ";           # add to output, increment $n
for(;$p++<6;)               # 3. loop through possible false guesses
    $t=strtr($t,$p," O|/\/\\"[  # replace digit:
        $p>$n                   # if above no. of wrong guesses
            ?0:$p                   # then with space, else with hangman character
    ]);
echo$t;                     # 4. print

```

---
Tags: code-golf, ascii-art, game
---


title: ASCII Cayley Graph

text:
# Question
Title: ASCII Cayley Graph
While doing some research for a different challenge I'm formulating, I came across a Cayley graph, specifically this one. Since I'm one of the top challenge writers, of course I had to make an ASCII art challenge for this.

Your challenge is to produce this ASCII art depiction of a Cayley graph of the free group on two generators as follows:

```
                                               +
                                              +++
                                             + | +
                                            ++-+-++
                                             + | +
                                          +    |    +
                                         +++   |   +++
                                        + |    |    | +
                                       ++-+----+----+-++
                                        + |    |    | +
                                         +++   |   +++
                                          +    |    +
                                   +           |           +
                                  +++          |          +++
                                 + | +         |         + | +
                                ++-+-++        |        ++-+-++
                                 + | +         |         + | +
                              +    |           |           |    +
                             +++   |           |           |   +++
                            + |    |           |           |    | +
                           ++-+----+-----------+-----------+----+-++
                            + |    |           |           |    | +
                             +++   |           |           |   +++
                              +    |           |           |    +
                                 + | +         |         + | +
                                ++-+-++        |        ++-+-++
                                 + | +         |         + | +
                    +             +++          |          +++             +
                   +++             +           |           +             +++
                  + | +                        |                        + | +
                 ++-+-++                       |                       ++-+-++
                  + | +                        |                        + | +
               +    |    +                     |                     +    |    +
              +++   |   +++                    |                    +++   |   +++
             + |    |    | +                   |                   + |    |    | +
            ++-+----+----+-++                  |                  ++-+----+----+-++
             + |    |    | +                   |                   + |    |    | +
              +++   |   +++                    |                    +++   |   +++
               +    |    +                     |                     +    |    +
        +           |                          |                          |           +
       +++          |                          |                          |          +++
      + | +         |                          |                          |         + | +
     ++-+-++        |                          |                          |        ++-+-++
      + | +         |                          |                          |         + | +
   +    |           |                          |                          |           |    +
  +++   |           |                          |                          |           |   +++
 + |    |           |                          |                          |           |    | +
++-+----+-----------+--------------------------+--------------------------+-----------+----+-++
 + |    |           |                          |                          |           |    | +
  +++   |           |                          |                          |           |   +++
   +    |           |                          |                          |           |    +
      + | +         |                          |                          |         + | +
     ++-+-++        |                          |                          |        ++-+-++
      + | +         |                          |                          |         + | +
       +++          |                          |                          |          +++
        +           |                          |                          |           +
               +    |    +                     |                     +    |    +
              +++   |   +++                    |                    +++   |   +++
             + |    |    | +                   |                   + |    |    | +
            ++-+----+----+-++                  |                  ++-+----+----+-++
             + |    |    | +                   |                   + |    |    | +
              +++   |   +++                    |                    +++   |   +++
               +    |    +                     |                     +    |    +
                  + | +                        |                        + | +
                 ++-+-++                       |                       ++-+-++
                  + | +                        |                        + | +
                   +++             +           |           +             +++
                    +             +++          |          +++             +
                                 + | +         |         + | +
                                ++-+-++        |        ++-+-++
                                 + | +         |         + | +
                              +    |           |           |    +
                             +++   |           |           |   +++
                            + |    |           |           |    | +
                           ++-+----+-----------+-----------+----+-++
                            + |    |           |           |    | +
                             +++   |           |           |   +++
                              +    |           |           |    +
                                 + | +         |         + | +
                                ++-+-++        |        ++-+-++
                                 + | +         |         + | +
                                  +++          |          +++
                                   +           |           +
                                          +    |    +
                                         +++   |   +++
                                        + |    |    | +
                                       ++-+----+----+-++
                                        + |    |    | +
                                         +++   |   +++
                                          +    |    +
                                             + | +
                                            ++-+-++
                                             + | +
                                              +++
                                               +

```

## Input

No input, unless your language explicitly requires input to run.

## Output

The ASCII art representation shown above.

## MD5 Hashes

Since this is a pretty large output, to check your work here are some MD5 hashes of example forms of output (all are UTF-8 without BOM):

* Square space padding, `CR/LF` linefeeds, and trailing newline -- `954B93871DAAE7A9C05CCDF79B00BF3C` -- this is the representation used above.
* Square space padding, `CR/LF` linefeeds, no trailing newline -- `28405EF91DA305C406BD03F9275A175C`
* Square space padding, `LF` linefeeds, and trailing newline -- `8CA65FB455DA7EE5A4C10F25CBD49D7E`
* Square space padding, `LF` linefeeds, no trailing newline -- `FDB1547D68023281BB60DBEC82C8D281`
* No trailing spaces, `CR/LF` linefeeds, and trailing newline -- `77FDE8CE5D7BD1BDD47610BA23264A19`
* No trailing spaces, `CR/LF` linefeeds, no trailing newline -- `EAD390C3EFD37F0FCACE55A84B793AB5`
* No trailing spaces, `LF` linefeeds, and trailing newline -- `1F6CAB740F87881EB2E65BED65D08C36`
* No trailing spaces, `LF` linefeeds, no trailing newline -- `7D41CE1E637619FEA9515D090BFA2E9C`
* If there is an additional MD5 you would like for comparison, please let me know and I'll create it and update the challenge.

### Rules

* Leading or trailing newlines or whitespace are all optional, so long as the characters themselves line up correctly.
* Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
* If possible, please include a link to an online testing environment so other people can try out your code!
* Standard loopholes are forbidden.
* This is so all usual golfing rules apply, and the shortest code (in bytes) wins.

# Answer
> 9 votes
## JavaScript (ES6), ~~204~~ ~~195~~ ~~188~~ 180 bytes

```
f=
_=>[...Array(9119)].map((_,i)=>~i%96?g(48+~(i/96),47-i%96,5):`
`,g=(x,y,z,n=(1<<z)-z)=>x|y?(x=x<0?-x:x)+(y=y<0?-y:y)<n?` |-+`[2*!x+!y]:z--?x>y?g(x-n,y,z):g(x,y-n,z):` `:`+`).join``
;document.write(`<pre>`+f())
```

Square space padding, LF linefeeds, ~~and~~ no trailing newline, although I haven't checked the MD5.

```
f=
m=>[...Array((w=(4<<m)-m*-~m-2)*~-w)].map((_,i)=>~i%w?g(w/2+~(i/w),w/2-i%w-1,m):`
`,g=(x,y,z,n=(1<<z)-z)=>x|y?(x=x<0?-x:x)+(y=y<0?-y:y)<n?` |-+`[2*!x+!y]:z--?x>y?g(x-n,y,z):g(x,y-n,z):` `:`+`).join``
```

```
<input type=number min=0 oninput=o.textContent=f(this.value)><pre id=o>+
```

Parametrised version for ~~222~~ ~~216~~ ~~207~~ 199 bytes. Explanation: The output size is 9119 ASCII characters, including 46 newlines. (For the parametrised version, the output size is calculated including the trailing newline.) Each character is individually determined, firstly by checking whether a newline is due, otherwise by calling a function on the coordinates relative to the origin in the middle of the final diagram. The function recursively checks the point against the nearest crosses of each size to the point, and returns the appropriate character depending on whether the point is discovered to lie on the centre or axis of a cross.

# Answer
> 7 votes
# Röda, ~~284~~ ~~280~~ ~~238~~ 234 bytes

```
{a=[1,-1]t=[]seq 1,95|t+=[" "]*95,_
f={|x,y,i,d|{s=[27,12,5,2,1][i]i++
a|{|j|{seq y,y+s*j|t[_][x]="|"f x,y+s*j,i,2-j}if[d!=2+j]}_
a|{|j|{seq x,x+s*j|t[y][_]="-"f x+s*j,y,i,3-j}if[d!=3+j]}_}if[i<5]
t[y][x]="+"}f 47,47,0,0
t|print _&""}

```

Try it online!

This is an anonymous function. I used newlines instead of semicolons so it is very nicely formatted!

The recursive function `f` creates the graph in a two-dimensional array `t`, which is then printed at the last line.

I didn't find a way to calculate `27,12,5,2,1` in few bytes, so they are hard-coded.

# Answer
> 3 votes
# Charcoal, ~~50~~ 43 bytes

```
Ｆ³²⁴«Ｐ++↷ＡＥ…¹¦⁵∧¬﹪ιＸ³κ⁻Ｘ²⁺κ¹⁺κ²εＦ⁺ε⮌ε¿κ«+κ↶

```

Try it online! Link is to verbose version of code. I originally tried various reflections and rotations but they either didn't do what I want or in some cases were buggy. I then tried a nested loop approach but I've now switched to this iterative method which works by drawing a number of lines between each inner cross depending on how many powers of 3 the step number is divisible by. It can even be readily modified to accept a size parameter at a cost of only 4 bytes:

```
ＮβＦ×⁴Ｘ³β«Ｐ++↷ＡＥ…·¹β∧¬﹪ιＸ³κ⁻Ｘ²⁺κ¹⁺κ²εＦ⁺ε⮌ε¿κ«+κ↶

```

Edit: I've since worked out how to use `RotateShutterOverlap` to achieve this task, but annoyingly it takes me 44 bytes:

```
Ａ⁰ηＦ⁶«ＡηγＡ⁻⁺Ｘ²ιηιηＪη⁰Ｐ-γ+¿γ⟲ＳＯ²⁶⁻×²γ¹»‖⟲ＳＯ⁹⁵

```

If `RotateShutterOverlap` accepted a variable rotations integer, that would reduce it to 40 bytes:

```
Ａ⁰ηＦ⁶«Ａ∨η¹γＡ⁻⁺Ｘ²ιηιηＪη⁰Ｐ+γ+⟲ＳＯ⎇‹ι⁵Ｌβ²⁴⁶γ

```

As it is, using a rotations list parameter takes 45 bytes:

```
Ａ⁰ηＦ⁶«Ａ∨η¹γＡ⁻⁺Ｘ²ιηιηＪη⁰Ｐ+γ+⟲ＳＯ⟦⁶×²⁺¹⁼⁵ι⟧⁻×²γ¹

```

# Answer
> 2 votes
# 05AB1E, 620 bytes

```
•1dOœ˜‘Av–Qs†ƒFã&äuÌÊ¹Ý2býádÙI’´Ëœ¼)Y»+™ß›[Vg“Ò¢Jù1no<V<*Ét*-¢&â-ßBÆ×090`11-øsµ–¶1VÛ==ü:¼÷ØûÍZ„æ¹=#ùÞV«¡fä&Îˆ'ëˆÝ=ä^‰¤?Êçù!ØèØr-3îÛ+êò‚û¢½°BéG¦U”Ü1žˆr6S‹“ŽKRK°A¹ª¿â9]}×u¬]ž„Îï›V¦Â¶4Ãï¢v£×é´Ü2Äžiqô>§17F*ÎañníÆ4]s8mÏ›HSÏ771í´‰d3´Þ|À]Uà{þñýqø’e„XÿF4–:Yl&uqžÍÒÿ¾u9¤jóHP‰çêoÒNŠX-°xpÒÿ*ejÏD0Ë+GnÊ-/§3ÜJÙˆƒÌ=ŒÒOX‰|O%wæ[n‹ã4)ôF+~´Ö{aÄ$(Þí¼”÷u–qÿBòfÂíÜìTó–xÝwû¾])<§O«\‚e°‡¾‹K…ZDPô;µ!ÃÂ²&Ô¼¨1gŠ—Ÿ¦©zW¢¾×4K±ÔÄ_ìûÄ‚3¶Ñ>‚bùn±œ×)ÙCâRöè£¶”ˆ1ßÑÍ®Ö±[ZéRïyÓxÓE¨cW˜{Ã’ùoE›¥ÚvA¨‹êÆýÑY½RÎ5´‘Ê™uåÄr"ãYð÷I!0¤)å‡ëž”>úèWò}é€@.ØñÈQ€ñ{Á„‘Ü’‰~Çñ=…|“ÚƒÄ¬cóÇkþÛÇ–š;{¡¦½ÕrÎé–àTz€Kì2à^|¢èˆÎxž“å$œ2ô»EidœþFrSS¥ÝÜ—X¡á~îþQ˜NÜGñ¥Q)aè•4B"1230"" +-|"‡48ôû€û»

```

Try it online!

All I did was cut the pattern into fourths, converted the symbols to base-4, compressed 1/4 of the pattern into base-214 and then flipped it over the lines of symmetry. I'm working on something smarter using the actual algorithm, but until I finish that this is what'll be here for me.

# Answer
> 2 votes
# Python 3, 264 bytes

```
def F(g,p,d,k):
 for c in'-|'[d.real!=0]*(2**k-k-1):g[p]=c;p+=d
 P(g,p,k-1)
def P(g,p,k):
 if'+'==g.setdefault(p,'+')and k:
  for d in[1,1j,-1,-1j]:F(g,p+d,d,k)
g={}
P(g,0j,5)
print('\n'.join(''.join(g.get(r+c*1j,' ')for c in range(-47,48))for r in range(-47,48)))

```

Uses a pair of mutually recursive functions. F draws the lines and P inserts the '+'s. Can be golfed more, but out of time for now.

# Answer
> 2 votes
# C, 236 bytes

```
char t[95][95],i=95;f(x,y,s,n,m){if(t[y][x]<33){m=~s+(1<<s);for(n=~m;n++<m;)t[y][x+n]='-',t[y+n][x]=n==0?'+':'|';if(s--)f(x+n,y,s),f(x-n,y,s),f(x,y+n,s),f(x,y-n,s);}}main(){memset(t,32,9025);f(47,47,5);while(i--)printf("%.95s\n",t[i]);}

```

Just building the character table recursively before displaying it.

Try it online!

Thanks @Neil for making me realize that the length of the branches follow an actual rule.

# Answer
> 2 votes
# Deadfish~, 11547 bytes

```
{iii}ii{cccc}ccccccc{i}ic{d}d{cccc}ccccccc{dd}ddc{ii}ii{cccc}cccccc{i}iccc{d}d{cccc}cccccc{dd}ddc{ii}ii{cccc}ccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{cccc}ccccc{dd}ddc{ii}ii{cccc}cccc{i}icciicddciicddcc{d}d{cccc}cccc{dd}ddc{ii}ii{cccc}ccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{cccc}ccccc{dd}ddc{ii}ii{cccc}cc{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{cccc}cc{dd}ddc{ii}ii{cccc}c{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cccc}c{dd}ddc{ii}ii{cccc}{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{cccc}{dd}ddc{ii}ii{ccc}ccccccccc{i}icciicddciiccccddciiccccddciicddcc{d}d{ccc}ccccccccc{dd}ddc{ii}ii{cccc}{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{cccc}{dd}ddc{ii}ii{cccc}c{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cccc}c{dd}ddc{ii}ii{cccc}cc{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{cccc}cc{dd}ddc{ii}ii{ccc}ccccc{i}ic{d}d{c}c{{i}d}iic{{d}i}dd{c}c{i}ic{d}d{ccc}ccccc{dd}ddc{ii}ii{ccc}cccc{i}iccc{d}d{c}{{i}d}iic{{d}i}dd{c}{i}iccc{d}d{ccc}cccc{dd}ddc{ii}ii{ccc}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{ccc}ccc{dd}ddc{ii}ii{ccc}cc{i}icciicddciicddcc{d}dcccccccc{{i}d}iic{{d}i}ddcccccccc{i}icciicddciicddcc{d}d{ccc}cc{dd}ddc{ii}ii{ccc}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{ccc}ccc{dd}ddc{ii}ii{ccc}{i}ic{d}dcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{i}ic{d}d{ccc}{dd}ddc{ii}ii{cc}ccccccccc{i}iccc{d}dccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cc}ccccccccc{dd}ddc{ii}ii{cc}cccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{cc}cccccccc{dd}ddc{ii}ii{cc}ccccccc{i}icciicddciiccccddcii{c}cddcii{c}cddciiccccddciicddcc{d}d{cc}ccccccc{dd}ddc{ii}ii{cc}cccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{cc}cccccccc{dd}ddc{ii}ii{cc}ccccccccc{i}iccc{d}dccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cc}ccccccccc{dd}ddc{ii}ii{ccc}{i}ic{d}dcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{i}ic{d}d{ccc}{dd}ddc{ii}ii{ccc}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{ccc}ccc{dd}ddc{ii}ii{ccc}cc{i}icciicddciicddcc{d}dcccccccc{{i}d}iic{{d}i}ddcccccccc{i}icciicddciicddcc{d}d{ccc}cc{dd}ddc{ii}ii{ccc}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{ccc}ccc{dd}ddc{ii}ii{cc}{i}ic{d}d{c}ccc{i}iccc{d}d{c}{{i}d}iic{{d}i}dd{c}{i}iccc{d}d{c}ccc{i}ic{d}d{cc}{dd}ddc{ii}ii{c}ccccccccc{i}iccc{d}d{c}ccc{i}ic{d}d{c}c{{i}d}iic{{d}i}dd{c}c{i}ic{d}d{c}ccc{i}iccc{d}d{c}ccccccccc{dd}ddc{ii}ii{c}cccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{cc}cccc{{i}d}iic{{d}i}dd{cc}cccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}cccccccc{dd}ddc{ii}ii{c}ccccccc{i}icciicddciicddcc{d}d{cc}ccc{{i}d}iic{{d}i}dd{cc}ccc{i}icciicddciicddcc{d}d{c}ccccccc{dd}ddc{ii}ii{c}cccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{cc}cccc{{i}d}iic{{d}i}dd{cc}cccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}cccccccc{dd}ddc{ii}ii{c}ccccc{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{cc}c{{i}d}iic{{d}i}dd{cc}c{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{c}ccccc{dd}ddc{ii}ii{c}cccc{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cc}{{i}d}iic{{d}i}dd{cc}{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{c}cccc{dd}ddc{ii}ii{c}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}ccccccccc{{i}d}iic{{d}i}dd{c}ccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}ccc{dd}ddc{ii}ii{c}cc{i}icciicddciiccccddciiccccddciicddcc{d}d{c}cccccccc{{i}d}iic{{d}i}dd{c}cccccccc{i}icciicddciiccccddciiccccddciicddcc{d}d{c}cc{dd}ddc{ii}ii{c}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}ccccccccc{{i}d}iic{{d}i}dd{c}ccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}ccc{dd}ddc{ii}ii{c}cccc{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cc}{{i}d}iic{{d}i}dd{cc}{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{c}cccc{dd}ddc{ii}ii{c}ccccc{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{cc}c{{i}d}iic{{d}i}dd{cc}c{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{c}ccccc{dd}ddc{ii}iicccccccc{i}ic{d}d{c}c{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{c}c{i}ic{d}dcccccccc{dd}ddc{ii}iiccccccc{i}iccc{d}d{c}{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{c}{i}iccc{d}dccccccc{dd}ddc{ii}iicccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dcccccc{dd}ddc{ii}iiccccc{i}icciicddciicddcc{d}dcccccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}ddcccccccc{i}icciicddciicddcc{d}dccccc{dd}ddc{ii}iicccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dcccccc{dd}ddc{ii}iiccc{i}ic{d}dcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{i}ic{d}dccc{dd}ddc{ii}iicc{i}iccc{d}dccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddccc{i}iccc{d}dcc{dd}ddc{ii}iic{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}dc{dd}ddc{iii}iiicciicddciiccccddcii{c}cddcii{cc}ccccccddcii{cc}ccccccddcii{c}cddciiccccddciicddcc{ddd}dddc{ii}iic{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}dc{dd}ddc{ii}iicc{i}iccc{d}dccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddccc{i}iccc{d}dcc{dd}ddc{ii}iiccc{i}ic{d}dcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{i}ic{d}dccc{dd}ddc{ii}iicccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dcccccc{dd}ddc{ii}iiccccc{i}icciicddciicddcc{d}dcccccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}ddcccccccc{i}icciicddciicddcc{d}dccccc{dd}ddc{ii}iicccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dcccccc{dd}ddc{ii}iiccccccc{i}iccc{d}d{c}{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{c}{i}iccc{d}dccccccc{dd}ddc{ii}iicccccccc{i}ic{d}d{c}c{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{cc}cccccc{{i}d}iic{{d}i}dd{c}c{i}ic{d}dcccccccc{dd}ddc{ii}ii{c}ccccc{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{cc}c{{i}d}iic{{d}i}dd{cc}c{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{c}ccccc{dd}ddc{ii}ii{c}cccc{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cc}{{i}d}iic{{d}i}dd{cc}{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{c}cccc{dd}ddc{ii}ii{c}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}ccccccccc{{i}d}iic{{d}i}dd{c}ccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}ccc{dd}ddc{ii}ii{c}cc{i}icciicddciiccccddciiccccddciicddcc{d}d{c}cccccccc{{i}d}iic{{d}i}dd{c}cccccccc{i}icciicddciiccccddciiccccddciicddcc{d}d{c}cc{dd}ddc{ii}ii{c}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}ccccccccc{{i}d}iic{{d}i}dd{c}ccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}ccc{dd}ddc{ii}ii{c}cccc{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cc}{{i}d}iic{{d}i}dd{cc}{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{c}cccc{dd}ddc{ii}ii{c}ccccc{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{cc}c{{i}d}iic{{d}i}dd{cc}c{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{c}ccccc{dd}ddc{ii}ii{c}cccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{cc}cccc{{i}d}iic{{d}i}dd{cc}cccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}cccccccc{dd}ddc{ii}ii{c}ccccccc{i}icciicddciicddcc{d}d{cc}ccc{{i}d}iic{{d}i}dd{cc}ccc{i}icciicddciicddcc{d}d{c}ccccccc{dd}ddc{ii}ii{c}cccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{cc}cccc{{i}d}iic{{d}i}dd{cc}cccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{c}cccccccc{dd}ddc{ii}ii{c}ccccccccc{i}iccc{d}d{c}ccc{i}ic{d}d{c}c{{i}d}iic{{d}i}dd{c}c{i}ic{d}d{c}ccc{i}iccc{d}d{c}ccccccccc{dd}ddc{ii}ii{cc}{i}ic{d}d{c}ccc{i}iccc{d}d{c}{{i}d}iic{{d}i}dd{c}{i}iccc{d}d{c}ccc{i}ic{d}d{cc}{dd}ddc{ii}ii{ccc}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{ccc}ccc{dd}ddc{ii}ii{ccc}cc{i}icciicddciicddcc{d}dcccccccc{{i}d}iic{{d}i}ddcccccccc{i}icciicddciicddcc{d}d{ccc}cc{dd}ddc{ii}ii{ccc}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{ccc}ccc{dd}ddc{ii}ii{ccc}{i}ic{d}dcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{i}ic{d}d{ccc}{dd}ddc{ii}ii{cc}ccccccccc{i}iccc{d}dccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cc}ccccccccc{dd}ddc{ii}ii{cc}cccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{cc}cccccccc{dd}ddc{ii}ii{cc}ccccccc{i}icciicddciiccccddcii{c}cddcii{c}cddciiccccddciicddcc{d}d{cc}ccccccc{dd}ddc{ii}ii{cc}cccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{cc}cccccccc{dd}ddc{ii}ii{cc}ccccccccc{i}iccc{d}dccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cc}ccccccccc{dd}ddc{ii}ii{ccc}{i}ic{d}dcccc{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}dd{c}c{{i}d}iic{{d}i}ddcccc{i}ic{d}d{ccc}{dd}ddc{ii}ii{ccc}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{ccc}ccc{dd}ddc{ii}ii{ccc}cc{i}icciicddciicddcc{d}dcccccccc{{i}d}iic{{d}i}ddcccccccc{i}icciicddciicddcc{d}d{ccc}cc{dd}ddc{ii}ii{ccc}ccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}dccccccccc{{i}d}iic{{d}i}ddccccccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{ccc}ccc{dd}ddc{ii}ii{ccc}cccc{i}iccc{d}d{c}{{i}d}iic{{d}i}dd{c}{i}iccc{d}d{ccc}cccc{dd}ddc{ii}ii{ccc}ccccc{i}ic{d}d{c}c{{i}d}iic{{d}i}dd{c}c{i}ic{d}d{ccc}ccccc{dd}ddc{ii}ii{cccc}cc{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{cccc}cc{dd}ddc{ii}ii{cccc}c{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cccc}c{dd}ddc{ii}ii{cccc}{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{cccc}{dd}ddc{ii}ii{ccc}ccccccccc{i}icciicddciiccccddciiccccddciicddcc{d}d{ccc}ccccccccc{dd}ddc{ii}ii{cccc}{i}ic{d}dc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddcccc{{i}d}iic{{d}i}ddc{i}ic{d}d{cccc}{dd}ddc{ii}ii{cccc}c{i}iccc{d}dccc{{i}d}iic{{d}i}ddccc{i}iccc{d}d{cccc}c{dd}ddc{ii}ii{cccc}cc{i}ic{d}dcccc{{i}d}iic{{d}i}ddcccc{i}ic{d}d{cccc}cc{dd}ddc{ii}ii{cccc}ccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{cccc}ccccc{dd}ddc{ii}ii{cccc}cccc{i}icciicddciicddcc{d}d{cccc}cccc{dd}ddc{ii}ii{cccc}ccccc{i}ic{d}dc{{i}d}iic{{d}i}ddc{i}ic{d}d{cccc}ccccc{dd}ddc{ii}ii{cccc}cccccc{i}iccc{d}d{cccc}cccccc{dd}ddc{ii}ii{cccc}ccccccc{i}ic{d}d{cccc}ccccccc

```

Try it online!

Because why not?

---
Tags: code-golf, ascii-art, kolmogorov-complexity, fractal
---