# Question
Title: CGAC2022 Day 5: Preparing an advent calendar
Part of **Code Golf Advent Calendar 2022** event. See the linked meta post for details.

---

It's time to prepare an advent calendar, but I've only got a large sheet of rectangular paper, randomly colored red and green like this:

```
GRRRGRRGRG
GGRGGGRRGR
GRRGRGRGRG
GGRRGRGRGG
GRGGRGRGGG
RRGRGRGRRG
RRRGRGRGGG
RGGRGGRRRG
RGGGRRRRRG
GRGRRRGRRG

```

Out of this paper, I want to cut out a 5-by-5 region which is colored in a checkerboard fashion:

```
GRRRGRRGRG
GGRGGGRRGR
GRR**GRGRG**RG
GGR**RGRGR**GG
GRG**GRGRG**GG
RRG**RGRGR**RG
RRR**GRGRG**GG
RGGRGGRRRG
RGGGRRRRRG
GRGRRRGRRG
```

The exact coloring doesn't matter (the top left cell can be either green or red).

But if I'm unlucky, the piece of paper might not have such a region at all. In that case I will have to repaint some cells; I want to cut out a region which minimizes the amount of paint to make it checkered.

**Task:** Given a sheet of paper, output the minimum number of cells I need to recolor to get a checkered 5-by-5 grid.

Assume that both the width and height of the given paper are at least 5. You may choose to use any two distinct characters or numbers instead of R and G respectively.

Standard rules apply. The shortest code in bytes wins.

## Test cases

```
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR => 0

GRRRGRRGRG
GGRGGGRRGR
GRRGRGRGRG
GGRRGRGRGG
GRGGRGRGGG
RRGRGRGRRG
RRRGRGRGGG
RGGRGGRRRG
RGGGRRRRRG
GRGRRRGRRG => 0

RGRGRG
GRGRGR
RGRGRG
RRRRRR
RGRGRG => 2

RRRRR
RRRRG
RRRGG
RRGGG
RGGGG => 10

GGGGG
GGGGG
GGGGG
GGGGG
GGGGG => 12

RRGGGRRRGR
RRRGGRRRGR
RGGGGRRRGG
GRRGRRRRGG
GGGRGGRRGR
RRGGRGGGGG
GGRRRRRGRR
GGRGRRRRGR
GGRRRGGGGR
GRRGGGRGRR => 9

```

# Answer
# , 45 41 40 39 38 bytes

```
[:<./@(,,25-,)5 5+/@,@(=2|#\+/#\);._3]

```

Try it online!

Perfect problem for J's subarray, or tiling verb:

* `5 5...;._3]`For every 5 x 5 tiling of the input (which we take as a binary matrix), do the following
* `=2|#\+/#\` Create a template checkerboard `2|#\+/#\` and return where the current tile is equal to that `=`. (see penultimate step to understand why checking equal instead of not-equal is ok here)
* `+/@,@` And sum
* `[:...(,,25-,)` Cat that result with 25 minus that result. This gives us "both possible checkerboards", because if one checkerboard misses in `x` places, the other will miss in `25 - x` places.
* `<./@` Take the min
> 6 votes

# Answer
# Pip `-x`, ~~68~~ 54 bytes

*-12 thanks to Dlosc's suggestions*

```
Fx,#g-4Fz,#@g-4lAL:[25-Y$+:%_=BMEFL:_@>zH5Mg@>xH5y];Nl

```

Input is a binary matrix.

Try It Online!

Here's some code to convert a matrix of `R` and `G` to a binary matrix that can be used in Pip.

### How? (Outdated until I find time to update)

`T#g-5<Uv{. . .}`: Repeat until `T` the length `#` of the input matrix `g` minus 5 `-5` is less than `v` incremented (modify in-place) `<Uv`. The initial value of `v` is `-1`. This essentially loops from `v=0` to `v=#g-5`.

`Y-1T#@g-5<Uy{. . .}`: Set `Y` the variable `y` to `-1`. Then repeat until `T` the length `#` of the first element `@` of the input matrix `g` minus 5 `-5` is less than `y` incremented (modify in-place) `<Uy`.This essentially loops from `y=0` to `y=#@g-5`.

`FL:_@>yH5Mg@>vH5`: Get all the elements starting from index `v` (`@>v`) of the input matrix `g` and then get the first `5` elements of the resulting matrix `H5`. For each `M` row `_` in the resulting matrix, get all the elements starting from index `y` (`@>y`) of the row `_` and then get the first `5` elements of the resulting list `H5`. Then flatten `FL` the resulting matrix. This essentially creates a flattened 5-by-5 sub-matrix with `g[v][y]` (not real Pip code, just pseudocode) as the top left corner.

`z:_%2=BMZ,25. . .`: Zip `MZ` the range `,` from 0 to `25` with the flattened sub-matrix described previously, and map the zipped pairs to the block `_%2=B`, with values from `,25` being `_` and values from the flattened matrix being `B`. Test if the value from the range `_` modulo `2` (`%2`) is equal to `=` the value from the flattened matrix `B`. Set `:` the resulting list to `z`: This essentially tests the 5-by-5 sub-matrix against a checkered 5-by-5 matrix (which, when flattened, is the alternating list `0,1,0,...,1`, represented by taking the range `,25` and taking modulo `2` of that list), and sees how many places it "misses". This will give how many values need to change within the 5-by-5 submatrix in order to get a checkered matrix.

`lAL:[$+:z25-z]`: Extend `AL` the list `l` with the list `[$+:z25-z]`, which consists of two values `$+:z` and `25-z`. Sum `$+` the list `z`, modifying in-place `:`. `25-z` takes the sum and subtracts it from `25`. The initial value of `l` is the empty list `[]`. This essentially keeps track of how many changes are needed to change from the specific 5-by-5 submatrix to a checkered matrix. The reason we also append `25-z` to the list is to handle the fact that there are two possible checkered matrices that we can change the sub-matrix into, and that changing the submatrix into one of the checkered matrices may be more efficient than changing it to the other checkered matrix. It just so happens that the number of changes needed in order to change the sub-matrix into one possible checkered matrix is `25` minus the numbers of changes needed for the other possible checkered matrix.

`Nl`: Takes the minimum of the list `l` and implicitly outputs the result.
> 5 votes

# Answer
# Python, ~~130~~ ~~128~~ 111 bytes

* -2 bytes thanks to Neil, thanks to order of operations
* -9 bytes thanks to 72.100.97.109

Python is extraordinarily bad at working with multidimensional arrays without numpy. Or maybe I just missed something obvious.

```
lambda a:min(sum(y+a[x+i//5][y//2+i%5]+i&1for i in r(25))for x in r(len(a)-4)for y in r(2*len(a[0])-8))
r=range

```

Attempt This Online!

## Short Explanation

Basically there are 4 loops. The outer loop `for x in r(len(a)-4)for y in r(len(a[0])-4)` find the top left corner of every 5 by 5 square. We multiply this by 2 to get a extra bit.

The inner loop sums the number of squares in that area that do not fit the grid. We add a lot of terms and then &1 them. This basically is equivolent to XORing all their last bits. We need to swap based on the position within the square as well as the last binary digit of `y`. If this is not equal to the grid at that position (also XOR) we include it in the sum.

Finally, we get the minimum value of all of this.
> 4 votes

# Answer
# Python, 111 bytes (@att)

```
lambda A:25-max(map(abs,sum(map(g,*map(g,*A)),[])))>>1
g=lambda*a,c=0:[c:=x+y-c for x,y in zip(a,5*(0,)+a)][4:]

```

Attempt This Online!

### Python, 115 bytes

```
lambda A:25-max(map(abs,sum(map(g,zip(*map(g,A))),[])))>>1
g=lambda a,c=0:[c:=x+y-c for x,y in zip(a,5*(0,)+a)][4:]

```

Attempt This Online!

Takes a list of tuples of spins (+/-1).

### How?

The standard tool for matching a pattern that may be shifted is convolution. Using "spins" (+1,-1) instead of "booleans" (1, 0) and convolving the input with a 5x5 checkerboard template yields 25 at each offset that has a perfect match (and -25 for a perfect anti-match). Each mismatched square removes 2; when the value becomes negative it will be more economical to match the negative template. This hopefully explains the (25-|x|) / 2 in `f`.

In addition, we use the fact that the checkerboard made of `1`s and `-1`s is a "rank-1-matrix" meaning that it can be written as the outer product of two vectors which in this case, conveniently, happen to be the same vector v=\[1,-1,1,-1,1\]. Using this the 2D convolution with the checkerboard template can be broken down into two 1d convolutions, one for each axis.

Further, because of the special structure of v we can write the convolution as a running difference. This is essentially what `g` does.
> 4 votes

# Answer
# Charcoal, ~~57~~ 56 bytes

```
ＷＳ⊞υＥι﹪⁺℅κ⁺λＬυ²≔⟦⟧ηＦ⁻Ｌυ⁴Ｆ⁻Ｌθ⁴⊞ηΣＥ✂υι⁺⁵ι¹Σ✂λκ⁺⁵κ¹Ｉ⌊⁺η⁻²⁵η

```

Try it online! Takes input as a list of newline-terminated strings of `G`s and `R`s (although `0`s and `1`s also work). Explanation:

```
ＷＳ⊞υＥι﹪⁺℅κ⁺λＬυ²

```

Read in the strings, but replace each character with a bit according to the parity of the sum of its character code, row and column.

```
≔⟦⟧θＦ⁻Ｌυ⁴Ｆ⁻Ｌθ⁴⊞θΣＥ✂υι⁺⁵ι¹Σ✂λκ⁺⁵κ¹

```

Collect all of the `5×5` regions and count the bits in each region.

```
Ｉ⌊⁺θ⁻²⁵θ

```

Subtract all of the counts from `25` and output the minimum of both sets of counts.
> 3 votes

# Answer
# JavaScript (ES6), 115 bytes

Expects a matrix filled with `"0"`'s and `"1"`'s.

```
f=(m,x=0,[r,...a]=m)=>m[4]?r[x+4]?Math.min((g=n=>t=n--&&(r[x]+n-m[n/5|0][x+n%5]&1)+g(n))(25),25-t,f(m,x+1)):f(a):25

```

Try it online!

### Commented

Nested `map()` loops tend to be lengthy. So we don't use any explicit loop and go 100% recursive instead.

```
f = (                  // f is a recursive function taking:
  m,                   //   m[] = input matrix
  x = 0,               //   x = position in the current row
  [ r,                 //   r[] = current row
    ...a ] = m         //   a[] = remaining rows
) =>                   //
m[4] ?                 // if there's still at least 5 rows:
  r[x + 4] ?           //   if there's still at least 5 columns:
    Math.min(          //     get the minimum:
      ( g = n =>       //       g is a recursive function taking a counter n
        t =            //         save the result in t
        n-- && (       //         if n is not 0 (decrement it afterwards):
          r[x] +       //           take the value at the top-left corner
          n -          //           add n
          m[n / 5 | 0] //           subtract the value of the cell at
          [x + n % 5]  //           (x + (n mod 5), floor(n / 5))
          & 1          //           isolate the least significant bit
        ) + g(n)       //           add the result of a recursive call
      )(25),           //       initial call to g with n = 25
      25 - t,          //       also try 25 - t
      f(m, x + 1)      //       do a recursive call to f with x + 1
    )                  //     end of Math.min()
  :                    //   else:
    f(a)               //     do a recursive call to f for the next row
:                      // else:
  25                   //   stop the recursion

```
> 3 votes

# Answer
# Jelly, ~~19~~ ~~18~~ 17 bytes

```
Z5ƤẎ5Ƥ€Ẏ;¬$¬Ðe€§Ṃ

```

Try it online!

*-1 thanks to Jonathan Allan*

Expects a binary matrix. Feels... inelegant.
> 3 votes

# Answer
# , ~~106~~ 104 bytes

```
\(x,g=12){for(i in 5:ncol(x))for(j in 5:nrow(x))g=min(g,m<-sum(x[j-4:0,i-4:0]==matrix(1:0,5,5)),25-m);g}

```

Attempt This Online!

Based on Jonah's explanation in the J answer.

Takes input as a binary matrix.
> 3 votes

# Answer
# Octave, 79 bytes

```
@(a)min([b=conv2(mod(a+(1:rows(a))'+(1:rows(a')),2),~~e(5,5),"valid"),25-b](:))

```

Try it online!

Takes input as a binary matrix.

---

# Octave, 56 bytes, by @Luis Mendo

```
@(x)min(25-abs(conv2(x,j.^((t=0:2:8)+t'),'valid'))(:))/2

```

Try it online!

Takes input as a matrix with `1` and `-1`.
> 3 votes

# Answer
# PARI/GP, 70 bytes

```
a->(25-vecmax(abs(g(g(a)))))/2
g(a)=Mat(Vec(x^5\(x+1)*Pol(a~))[5..-5])

```

Attempt This Online!

Takes input as a matrix with `1` and `-1`. Based on @Luis Mendo's comment of my Octave answer.

---

# PARI/GP, 82 bytes

```
a->vecmin(concat(m=matrix(#a~-4,#a-4,x,y,sum(j=0,24,(a[x+j\5,y+j%5]+j)%2)),-m)%25)

```

Attempt This Online!

Takes input as a binary matrix.
> 2 votes

# Answer
# 05AB1E, 20 bytes

```
2Fø€ü5}εε˜Â«āÉα2äO]ß

```

Input as a binary-matrix.

Try it online or verify all test cases.

**Explanation:**

```
2Fø€ü5}       # Create all overlapping 5x5 blocks of the (implicit) input-matrix:
2F    }       #  Loop 2 times:
  ø           #   Zip/transpose; swapping rows/columns
              #   (which will use the implicit input-matrix in the first iteration)
   €          #   Map over each inner list:
    ü5        #    Create overlapping quintuplets
εε         ]  # Nested map over each block:
  ˜           #   Flatten the 5x5 block to a single list
   Â          #   Bifurcate it; short for Duplicate & Reverse copy
    «         #   Merge the reversed copy to the list
     ā        #   Push a list in the range [1,length] (without popping): [1,50]
      É       #   Convert it to a list of [1,0,1,0,1,0,...] with an is_odd check
       α      #   Get the absolute difference at the same positions of the two lists
        2ä    #   Split the list back into two parts of length 25 each
          O   #   Sum each inner list, resulting in a pair [c,25-c]
              #   (where `c` is the amount of bits that has to be changed to get a
              #   checkered 5x5 block with 1s at the corners)
           ]ß # After the nested map: pop and push the flattened minimum
              # (which is output implicitly as result)

```
> 2 votes

# Answer
# Retina, 145 bytes

```
L$v`(?<=(.)*)(.{5}).*¶(?<7-1>.)*(.{5}).*¶(?<1-7>.)*(.{5}).*¶(?<7-1>.)*(.{5}).*¶(?<1-7>.)*(.{5})
00$2$3$4$5$6
,T,2,`d`10
%O`.
01
0¶1
N$`
$.&
\G.\B

```

Try it online! Takes input as a newline-separated list of binary strings but header converts from strings of `G` and `R` for convenience. Explanation:

```
L$v`(?<=(.)*)(.{5}).*¶(?<7-1>.)*(.{5}).*¶(?<1-7>.)*(.{5}).*¶(?<7-1>.)*(.{5}).*¶(?<1-7>.)*(.{5})
00$2$3$4$5$6

```

Extract all of the 5×5 regions as flattened strings, but prefix two `0`s because it's golfier not to have any zero-length strings later.

```
,T,2,`d`10

```

Toggle alternate bits. The ideal case is now either one `0` bit or one `1` bit (one of the `0` bits added above would have been toggled to `1`).

```
%O`.

```

Sort the bits within each string of 25 bits.

```
01
0¶1

```

Separate the strings of `0` and `1` bits.

```
N$`
$.&

```

Sort ascending by length.

```
\G.\B

```

Subtract `1` and convert the minimum to decimal.
> 2 votes

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

```
{12.5-⌈/|,5-/5-⌿⍵}

```

Try it on APLgolf!

Input a matrix with `0.5` and `¯0.5`.
> 1 votes

# Answer
# C (clang), ~~142~~ 138 bytes

-4 bytes thanks to @ceilingcat

```
#define l(n,m)for(int n=m;n--;)
c;j;f(*r,*t,w,h){*r=99;l(y,h-4)l(x,w-4)l(i,2){j=i,c=0;l(Y,5)l(X,5)c+=t[(Y+y)*w+X+x]!=j,j=!j;*r>c?*r=c:0;}}

```

Try it online!
> 0 votes

---
Tags: code-golf, grid, binary-matrix
---


title: Shuffle a ragged array

text:
# Question
Title: Shuffle a ragged array
A ragged array is an array where each element is an array of unknown number of positive integers.

For example, the following are ragged arrays:

```
[[1,2,3],[4],[9,10]]               Shape:  3,1,2
[[1],[2],[3]]                      Shape:  1,1,1
[[1,2,3,4,5,6,8]]                  Shape:  7

```

The following are *not* ragged arrays:

```
[1]   Each element will be an array
[]    The array will contain at least 1 element
[[1,2,3],[]]  Each subarray will contain at least 1 integer

```

**You need to input a ragged array, and return a ragged array with the integers shuffled**

* The output array must have the same *shape* as the input array. We define the *shape* of the array as the length of each subarray.
* Each integer must have an equally likely chance to appear in each possible location.
* You can assume that your language's built-in random is random.

For example, if I passed in: `[[4],[1,2,3],[4]]`, then `[[1],[4,4,2],[3]]` would be a valid output, but `[[4,1,3],[3],[4]]` or `[[4],[4],[1,2,3]]` would not.

# Answer
# Jelly, 3 bytes in Jelly's codepage

```
FẊṁ

```

Explanation:

```
FẊṁ
F    flatten list
 Ẋ   shuffle the output from the previous line
  ṁ  unflatten the list, shaping it like…

```

Because the program is incomplete ( doesn't have a second argument stated), the default is to use the program input; thus  causes the output to have the same sublist pattern as the input.

Try it online!
> 18 votes

# Answer
## PowerShell v2+, 86 bytes

```
param($n)$a=$n-split'[^\d]'-ne''|sort{random};-join($n-split'\d+'-ne''|%{$_+$a[$i++]})

```

Works via string manipulation. Input is passed in as a string representing the array, in whatever format works for *your* language. ;-)

`-split`s out the input on non-digits, `sort`s them based on the `random` script block (which will assign a different random weight for each input to the sort), stores that into `$a`. We then `split` the input again, this time on digits, and for each one output the current value (usually brackets and commas) string-concatenated with the corresponding number from `$a`. That's `-join`ed together back into a string, and output is implicit.

### Examples

```
PS C:\Tools\Scripts\golfing> .\shuffle-a-ragged-array.ps1 "@(@(1,2,3),4)"
@(@(3,2,1),4)

PS C:\Tools\Scripts\golfing> .\shuffle-a-ragged-array.ps1 "@(@(1,2,3),4)"
@(@(1,2,4),3)

PS C:\Tools\Scripts\golfing> .\shuffle-a-ragged-array.ps1 "[[4],[1,2,3],[4]]"
[[4],[2,4,3],[1]]

PS C:\Tools\Scripts\golfing> .\shuffle-a-ragged-array.ps1 "[[10],[1,2,3],[5]]"
[[10],[5,2,1],[3]]

PS C:\Tools\Scripts\golfing> .\shuffle-a-ragged-array.ps1 "[[10],[1,2,3],[5]]"
[[5],[10,2,1],[3]]

```
> 7 votes

# Answer
# Python 2, 89 bytes

```
from random import*
x=input();r=sum(x,[]);shuffle(r)
print[[r.pop()for _ in t]for t in x]

```

Try it online!
> 5 votes

# Answer
# JavaScript (ES6), ~~78~~ 75 bytes

```
x=>x.map(y=>y.map(z=>+s.splice(Math.random()*s.length,1)),s=eval(`[${x}]`))

```

This is the first time I can remember using `.splice()` in a code-golf challenge...

You can golf off two bytes by shuffling the array beforehand:

```
x=>x.map(y=>y.map(z=>s.pop()),s=eval(`[${x}]`).sort(_=>Math.random()-.5))

```

However, this seems to put the last integer first the majority of the time, so I'm going to assume that the integers aren't uniformly distributed.
> 3 votes

# Answer
# Ruby, 47 bytes

```
->a{b=a.flatten.shuffle;a.map{|x|x.map{b.pop}}}

```
> 2 votes

# Answer
# 05AB1E, 17 bytes

```
˜.r¹vDyg£DˆgF¦}}¯

˜                 Unflatten input
 .r               tmp = shuffle(flattened_input)
   ¹v             For each sub-array
     Dyg£         Take the first length(current_array) elements from tmp
         Dˆ       Append the result to a global array
           gF¦}   Remove the first elements from tmp
               }  End for
                ¯ Display the global array

```

Try it online!

I'm waiting for the 05AB1E or 2sable solution using some unflattening/molding built-in I don't know yet :) .
> 2 votes

# Answer
# Brachylog, 17 bytes

```
c@~P,?:{l~l}a.cP,

```

Try it online!

### Explanation

We basically create a list of sublists with variable elements that has the same "shape" as the Input, and then state that if we concatenate everything into a single list, it must result in a shuffle of the concatenation of the input into a single list.

```
c@~P,                 Concatenate the Input into a single list. Shuffle it and call that P.
     ?:{   }a.        The Output is the result of applying this to each element of the input:
        l~l               The Output is a list of same length as the Input.
             .cP,     P is the concatenation of the sublists of the Output.

```
> 2 votes

# Answer
# Bash, ~~63~~, 58 bytes

EDITS:

* Optimized *sed* expression a bit, -5 bytes

Note:

Bash does not really support multidimensional arrays (they can only be simulated, to some extent), so instead, this program will accept a "serialized" text representation of a rugged array, as depicted in the task description, e.g.: `[[1,2,3],[4],[9,10]]`, and provide output in the same format.

**Golfed**

```
printf `sed 's/\w\+/%d/g'<<<$1` `grep -Po '\d+'<<<$1|shuf`

```

**Test**

```
>./shuffle []
[]

>./shuffle [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
[11,12,9,5,3,6,1,15,14,2,13,7,10,8,4]

>./shuffle [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
[9,15,11,10,7,6,1,14,2,3,12,5,4,13,8]

>./shuffle [[1,2,3],[4],[9,10]]
[[10,2,4],[9],[3,1]]

>./shuffle [[1,2,3],[4],[9,10]]
[[3,4,1],[10],[2,9]]

```

A nice bonus is that you can feed it rugged arrays of an arbitrary depth:

```
./shuffle [[1,[2,[3,[99,101]]],[4],[9,10]]
[[9,[4,[1,[101,2]]],[10],[3,99]]

```

and it will still operate correctly.

Try it online !
> 2 votes

# Answer
## Perl, 37 bytes

36 bytes of code + `-p` flag.

```
@n=/\d+/g;s/\d+/splice@n,rand@n,1/ge

```

To run it:

```
perl -pE '@n=/\d+/g;s/\d+/splice@n,rand@n,1/ge' <<< "[[4],[1,2,3],[4]"

```

**Explanations:**

```
@n=/d+/g                # store all the integers in @n
s/\d+/                  # replace each integer with ...
splice@n,rand@n,1/ge    # a element at a random position of @n (which is deleted from @n)

```
> 1 votes

# Answer
# Pyth, 15 bytes

```
tPc.SsQ.u+NlYQ0

```

A program that takes input of a list and prints the result.

Test suite

**How it works**

```
tPc.SsQ.u+NlYQ0  Program. Input: Q
       .u    Q0  (1) Reduce Q with starting value 0, returning all results:
         +        Add
          N       the current value
           lY     to the length of the next element of Q
     sQ          Flatten Q
   .S            (2) Randomly shuffle
  c              Chop (1) at every location in (2)
tP               Discard the first and last elements
                 Implicitly print

```
> 1 votes

# Answer
# **PHP**, 105 bytes

```
$m=array_merge(...$i=$_GET[i]);shuffle($m);foreach($i as$v)$o[]=array_splice($m,0,count($v));print_r($o);

```

reduced to 105 bytes thanks to `user59178`.

Original answer:

# **PHP**, 132 bytes

```
$i=$_GET['i'];$m=call_user_func_array('array_merge',$i);shuffle($m);foreach($i as$v){$o[]=array_splice($m,0,count($v));}print_r($o);

```
> 1 votes

# Answer
# APL, 35 bytes

I'm barely even beating Perl, there has to be something I'm missing.

```
{Z[?⍨⍴Z]⊂⍨(⍳⍴Z←∊⍵)∊⊃¨{⍵+⊃⌽⍺}\⍳¨⍴¨⍵}

```

E.g:

```
      {Z[?⍨⍴Z]⊂⍨(⍳⍴Z←∊⍵)∊⊃¨{⍵+⊃⌽⍺}\⍳¨⍴¨⍵}(1 2 3)(,4)(9 10)
┌──────┬─┬───┐
│10 3 2│1│9 4│
└──────┴─┴───┘

```

Explanation:

* Find the corresponding indices of the starts of the sub-arrays in a flattened array:
    + `⍳¨⍴¨⍵`: For each sub-array, get a list of the indices
    + `{⍵+⊃⌽⍺}\`: Starting with the first sub-array, add the last value in the array to each value in the next array.
    + `⊃¨`: get the first items of the arrays, which are the starting places
    + `(⍳⍴Z←∊⍵)∊`: store the flattened array in `Z`. Generate a bit-vector where the ones mark the places where the sub-arrays should start.
* Shuffle the flattened array:
    + `?⍨⍴Z`: generate a random permutation of `Z`.
    + `Z[`...`]`: permute `Z`.
* `⊂⍨`: Split up the permutation in sub-arrays according to the bit-vector.
> 1 votes

# Answer
## Mathematica, 67 Bytes

```
ReplacePart[#,Thread[RandomSample@Position[#,_Integer]->Union@@#]]&

```

Explanation: This shuffles the list of positions of all integers in the 2D ragged array. `Union@@` is short for `Flatten@`

Note: Squiggly brackets `{}` are used instead of brackets `[]`.
> 1 votes

# Answer
# Factor \+ `arrays.shaped`, 67 bytes

```
[ [ flatten randomize ] [ array-replace ] bi [ cut swap ] map nip ]

```

Try it online!

## Explanation

Assumes the input is always a 2D array.

* `[ flatten randomize ] [ array-replace ] bi` Place the flat, shuffled version of the input and the lengths of its rows on the stack.
* `[ cut swap ] map nip` Create a ragged array from a flat sequence and a list of lengths. See https://codegolf.stackexchange.com/a/233190/97916.
> 1 votes

# Answer
# K (ngn/k), 18 bytes

```
{(,/x)@<==0N?&#'x}

```

Try it online!

* `&#'x` build a list containing n-copies of each top level index, where n is the length of each element of the ragged list (e.g. `0 1 1 1 2`)
* `0N?` shuffle that list
* `<==` group the indices, group them again (to essentially flip the keys and values of the dictionary), and sort them ascending (this preserves the original order of the lengths)
* `(,/x)@` index into the flattened input and (implicitly) return
> 1 votes

# Answer
# Vyxal, 5 bytes

```
fÞ℅$•

```

Try it Online!

```
f     # Flatten
 Þ℅   # Shuffle
   $• # Mold to original shape

```
> 1 votes

# Answer
# Octave , 60 bytes

```
@(a)mat2cell([a{:}](randperm(sum(s=cellfun(@numel,a)))),1,s)

```
> 0 votes

# Answer
# **MATLAB**, 84 bytes

```
function b=g(c);a=[c{:}];a=a(randperm(numel(a)));b=mat2cell(a,1,cellfun('length',c))

```
> 0 votes

# Answer
# Java, 368 bytes

```
interface Z{int w(int i);default Z m(int n,int s){return i->w(i)+i>=n?s:0;}static int[][]f(int[][]r){int L=0,o=0,x,d,e=0;Z u=i->0,v=i->i;for(int[]a:r){d=a.length;L+=d;u=u.m(L,1);v=v.m(L,-d);}int[]c=new int[L];for(;e<L;)c[e++]=(int)(L*Math.random());for(int[]a:r){for(x=0;x<a.length;){d=c[x+o];e=v.w(d);d=u.w(d);L=a[x];a[x++]=r[d][e];r[d][e]=L;}o+=a.length;}return r;}}

```

the method `static int[][] f( int[][] r ){...}` solves the challenge. decided to roll my own functional interface to avoid an import and to add in a default method for ease of use

```
interface Z{ //define my own functional interface instead of importing

  int w(int i);

  //return a new lambda
  //where w(int i) adds the value s
  //to the result when i is greater than n
  default Z m(int n,int s){
      return i->w(i)+i>=n?s:0;
  }

  static int[][]f(int[][]r){
      int L=0,o=0,x,d,e=0;
      Z u=i->0, //lambda to convert a flattened index to the input's first dimension index
        v=i->i; //lambda to convert a flattened index to the input's second dimension index
      for(int[]a:r){
          d=a.length;
          L+=d; //running total of the lengths
          u=u.m(L,1); //increment the 1st conversion by 1 at every array length
          v=v.m(L,-d); //decrement the 2nd conversion by the array length after that length
      }
      int[]c=new int[L]; //will contain flattened index swapping positions
      for(;e<L;) //randomize the swap positions
          c[e++]=(int)(L*Math.random());
      for(int[]a:r){ //swap the elements from the input
          for(x=0;x<a.length;){
              d=c[x+o]; //flattened swap index
              e=v.w(d); //convert swap index to 2nd dimension index
              d=u.w(d); //convert swap index to 1st dimension index
              L=a[x];
              a[x++]=r[d][e];
              r[d][e]=L;
          }
          o+=a.length; //increment offset for flattened index array
      }
      return r;
  }

}

```
> 0 votes

# Answer
# , 36 bytes

```
{(0,sums -1_count each x)_0N?raze x}

```

# k, 22 bytes

```
{(0,+\-1_#:'x)_0N?,/x}

```
> 0 votes

---
Tags: code-golf, array, random
---


# Question
Title: Write a number as a sum of Fibonacci numbers
In 2009, Hannah Alpert described the "far-difference" representation, a novel way of representing integers as sums and differences of Fibonacci numbers according to the following rules:

* every two terms of the same sign differ in index by at least 4, and
* every two terms with different signs differ in index by at least 3.

### Example

```
  n  | far-difference
+----+------------------------------+
| 10 | 13 - 3     = F_5 - F_2       |
| 11 | 13 - 2     = F_5 - F_1       |
| 12 | 13 - 1     = F_5 - F_0       |
| 13 | 13         = F_5             |
| 14 | 13 + 1     = F_5 + F_0       |
| 15 | 13 + 2     = F_5 + F_1       |
| 16 | 21 - 5     = F_6 - F_3       |
| 17 | 21 - 5 + 1 = F_6 - F_3 + F_0 |
| 18 | 21 - 3     = F_6 - F_2       |
| 19 | 21 - 2     = F_6 - F_1       |
| 20 | 21 - 1     = F_6 - F_0       |
+----+------------------------------+

```

As a non-example, we do not write \\$16 = 13 + 3 = F\_5 + F\_2\\$ because \\$13 = F\_5\\$ and \\$3 = F\_2\\$ have the same sign and therefore violate the first rule because their index differs by \\$3\\$.

As another non-example, we do not write \\$8 = 13 - 5 = F\_5 - F\_3\\$ because \\$13 = F\_5\\$ and \\$-5 = - F\_3\\$ have different signs and violate the second rule because their index differs by \\$2\\$.

# Challenge

Write a program that takes an integer `n` as an input and outputs a list of numbers that describes its far-difference representation, or any other reasonable output (e.g. `[21, -5, 1]` or `"21 - 5 + 1"`.)

This is a challenge, so the shortest code wins.

# Answer
> 6 votes
# Python, 148 bytes

```
g=lambda n,j=1:n>sum(map(f,range(j,0,-4)))and g(n,j+1)or n*[1]and[f(j)]+([-x for x in g(-n)]if(n:=n-f(j))<0else g(n))
f=lambda n:n<2or f(n-1)+f(n-2)

```

Attempt This Online!

Not 100% sure about this though output looks ok.

### How?

Assuming the desired representation exists and is unique the following recursion should work: Find the smallest sum \\$F\_n+F\_{n-4}+F\_{n-8}+...\\$ that is at least as large as N where N is the number we wish to represent. Then the representation starts with \\$F\_n\\$. And now we use recursion on the difference between N and \\$F\_n\\$ and that's it.

# Answer
> 5 votes
# Charcoal, 44 bytes

```
ＮθＷθ«≔⟦÷θ↔θ⟧ηＷ‹↔ΣΦ⮌η¬﹪μ⁴↔θ⊞ηΣ…⮌η²≧⁻↨η⁰θ⟦Ｉ↨η⁰

```

Try it online! Link is to verbose version of code. Uses my observation that the first term in the expansion of `N` is `F(n)` where `A097083(n)` is the largest term not greater than `N`, and then assumes that the remaining terms can be calculated by subtracting `F(n)` from `N` (adjusting for the sign of `N`).

```
Ｎθ

```

Input `N`.

```
Ｗθ«

```

Repeat until `N` is zero.

```
≔⟦÷θ↔θ⟧η

```

Start with the sign of `N`.

```
Ｗ‹↔ΣΦ⮌η¬﹪μ⁴↔θ

```

While `A097083(n)` is less than `N`...

```
⊞ηΣ…⮌η²

```

... calculate the next Fibonacci number.

```
≧⁻↨η⁰θ

```

Subtract `F(n)` from `N`.

```
⟦Ｉ↨η⁰

```

Output `F(n)` on its own line.

# Answer
> 4 votes
# JavaScript (ES6), 106 bytes

This version is based on @Neil's insight about A097083 and the conjectured formula from OEIS:

$$\text{A097083}(n)=\lfloor F(n+2)/\sqrt{5}\rfloor$$

Returns an array of integers.

```
f=(n,k=s=1)=>n?(g=n=>v=n<3?n:g(n-1)+g(n-2))(k+2)*v<n*n*5?f(n,k+1):[g(k)*s,...f((n-v)/s*(s*=v<n||-1),1)]:[]

```

Try it online!

---

# JavaScript (ES6), 127 bytes

Returns a space-separated string such as `21 -5 1`.

```
f=(n,a=[1,-1])=>(g=([v,...a],s,p,d)=>v?g(a,s,p,-~d)||d>3&d!=5&&g(a,s-v,[p]+v+' '):s?0:o=p)(a,n)?o:f(n,[v=a[0]+a[2]||2,-v,...a])

```

Try it online!

# Answer
> 3 votes
# 05AB1E, 48 bytes

```
·ÅF.āæεU1®‚XgãεX*]€`ʒø`ü2εÄ`α4y.±O_-@}PsOIQ*}нøн

```

Brute-force, so very slow..

Try it online or verify all few test cases.

**Explanation:**

```
·           # Double the (implicit) input-integer
 ÅF         # Push a list of all Fibonacci values <= this 2*input
   .ā       # Enumerate this list, pairing each with their 0-based index
     æ      # Get the powerset of this list of Fibonacci-index pairs
ε           # Map each list of pairs to:
 U          #  Pop and store the current list in variable `X`
 1®‚        #  Push pair [1,-1]
    Xg      #  Push the length of the current list `X`
      ã     #  Get the cartesian product of the [1,-1] and this length
       ε    #  Map over each list of 1s and/or -1s:
        X*  #   Multiply the values to the values in list `X`
]           # Close the nested maps
 €`         # Flatten it one level down
.Δ          # Find the first result which is truthy for:
  ø         #  Zip/transpose; swapping rows/columns
   `        #  Pop and push the list of values and indices separated to the stack
    ü2      #  Get all overlapping pairs of the indices
  ε         #  Map over each pair of indices:
   Ä        #   Get the absolute values of both indices in the pair
    `       #   Pop and push them to the stack
     α      #   Get the absolute difference between the two
   4        #   Push 4
    y       #   Push the current pair of indices again
     .±     #   Get the sign of each index
       O    #   Sum the pair of signs together (either -2; 0; or 2)
        _   #   Check if it's equal to 0 (1 if 0; 0 if -2 or 2)
         -  #   Subtract that from the 4
          @ #   Check if the earlier difference is >= this 4-signDiff
  }         #  Close the inner map
   P        #  Check if all of them were truthy by taking the product
  s         #  Swap so the list of values is at the top
   O        #  Sum them together
    IQ      #  Check if this sum is equal to the input
  *         #  Check if both were truthy
 }ø         # After the find_first: zip/transpose; swapping rows/columns
   н        # Only keep the first list of values
            # (which is output implicitly as result)

```

---
Tags: code-golf, math, number-theory, fibonacci, integer-partitions
---


title: In Honor of Adam West

text:
# Question
Title: In Honor of Adam West
Adam West passed away, and I'd like to honor his memory here on PPCG, though I doubt he knew of our existence. While there are many, many different things that this man is known for, none are more prominent than his role as the ~~original~~ batman. I'll always remember my step-father still watching the old-school Batman and Robin to this day. This challenge is simplistic in nature, not at all in line with the complicated man that was Adam West. However, it's the best I could come up with, as this is the most iconic image of the man's career.

---

*I wanted to post this earlier, but I was waiting for someone to come up with something better.*

---

Output the following (with or without trailing spaces/newlines):

```
           *                         *
       ****          *     *          ****
     ****            *******            ****
   ******            *******            ******
  *********         *********         *********
 ***********************************************
*************************************************
*************************************************
*************************************************
 ***********************************************
  *****       *********************       *****
    ****       ***    *****    ***       ****
       **       *      ***      *       **

```

This is , the lowest byte-count will win.

# Answer
> 49 votes
# Jelly, 44 bytes

```
“¡©İ'¹!ðkW>ṅṙẏṙlœf:ßŒÆ@Ƥ’b25o99Jx$ị⁾ *s25ŒBY

```

Try it online!

### How it works

```
“¡©İ'¹!ðkW>ṅṙẏṙlœf:ßŒÆ@Ƥ’

```

This is a numeric literal. All characters are replaced with their 1-based indices in Jelly's code page the result is interpreted as a bijective base-250 integer, yielding

```
58616171447449697510361193418481584558895594063391402

```

Next, `b25` convert that integer to base **25** and `o99` replaces **0** with **99**, yielding

```
11 1 20 4 10 1 8 4 12 4 3 6 12 4 2 9 9 5 1 99 1 24 2 5 7 11 4 4 7 3 4 3 7 2 7 1 6 2

```

`Jx$` replaces the **j**th base-25 digits **n** with **n** copies of **j**, yielding

```
1 1 1 1 1 1 1 1 1 1 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 7 7 7 7 7 7 7 7 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 11 11 11 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 14 14 14 14 15 15 16 16 16 16 16 16 16 16 16 17 17 17 17 17 17 17 17 17 18 18 18 18 18 19 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 21 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 23 23 24 24 24 24 24 25 25 25 25 25 25 25 26 26 26 26 26 26 26 26 26 26 26 27 27 27 27 28 28 28 28 29 29 29 29 29 29 29 30 30 30 31 31 31 31 32 32 32 33 33 33 33 33 33 33 34 34 35 35 35 35 35 35 35 36 37 37 37 37 37 37 38 38

```

Now, `ị⁾ *` indexes into the character pair. Indexing is 1-based and modular, so odd numbers get replaced with spaces, even ones with asterisks. This yields

```
           *                    ****          *        ****            ****   ******            ****  *********         ***** *************************************************************************************************** ************************  *****       ***********    ****       ***    ***       **       *      **

```

`s25` chops the result into chunks of length **25**. If we write each chunk on its own line, we get

```
           *
       ****          *
     ****            ****
   ******            ****
  *********         *****
 ************************
*************************
*************************
*************************
 ************************
  *****       ***********
    ****       ***    ***
       **       *      **

```

The *bounce* atom `ŒB` palindromizes each chunk by appending a reversed copy without its first character, yielding

```
           *                         *
       ****          *     *          ****
     ****            *******            ****
   ******            *******            ******
  *********         *********         *********
 ***********************************************
*************************************************
*************************************************
*************************************************
 ***********************************************
  *****       *********************       *****
    ****       ***    *****    ***       ****
       **       *      ***      *       **

```

Finally, `Y` introduces the actual linefeeds.

# Answer
> 161 votes
# Wordfuck, ~~5761~~ 2686 bytes

*I guess using his name as a source code gets Adam West some honor.*

```
adam west adam west adam_wes t_a dam_we st_a dam_ west adam west adam west adam west_ad am_west_a dam_we st ad am we st ad am we st ad am west_a dam_we st_a dam_ west_ada m_w est ada m_w est ada m_west_ adam west_a dam_west_ adam_we st_ ad am_west ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am_wes t_ adam_w est_ adam west adam west adam west adam west adam we st_adam west_ad am we st ad am we st adam_w es t_ ad am west_ad am we st ad am we st ad am we st_ada m_ west_ad am we st ad am west_a da m_west_ ad am we st ad am we st ad am west_a da m_ we st adam_w es t_adam_ west_ad am we st ad am west_a da m_ we st adam_we st ad am we st ad am we st ad am we st_ada m_ we st ad am we st adam_we st ad am we st ad am we st ad am we st_ada m_ we st ad am_wes t_ adam_we st_adam we st ad am_wes t_ ad am we st ad am_west ad am we st ad am we st ad am we st adam_w es t_ ad am we st ad am_west ad am we st ad am we st ad am we st adam_w es t_ ad am we st adam_w es t_adam_ west_ad am we st_ada m_ we st ad am we st ad am west_ad am we st ad am we st ad am west_a da m_ we st ad am we st ad am_west ad am we st ad am we st ad am_wes t_ ad am we st ad am we st adam_w es t_adam_ west_ad am west_a da m_ we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st_ada m_ west_ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am west_a da m_west_ ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am_wes t_ adam_we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st adam_w es t_adam_ west_ad am west_a da m_ we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st ad am we st_ada m_ west_ad am_west ad am west_a da m_ we st ad am_west ad am we st ad am we st_ada m_ we st ad am we st ad am we st ad am we st ad am we st ad am west_ad am we st ad am we st adam_w es t_ ad am we st_ada m_ west_ad am_west ad am we st adam_w es t_ ad am west_ad am we st ad am we st adam_w es t_ ad am_west ad am we st adam_w es t_ ad am we st_adam we st ad am west_a da m_ we st_adam we st ad am we st ad am_wes t_ ad am we st_ada m_ west_ad am_west ad am we st ad am we st_ada m_ we st_adam we st ad am we st ad am_wes t_ adam_we st ad am we st ad am_wes t_ ad am west_ad am we st ad am we st_ada m_ west_ad am we st ad am we st adam_w es t!

```

Try it online! (transpiled brainfuck)

Adam West singing (thanks @carusocomputing)

# Answer
> 71 votes
## Python, ~~530~~ ~~529~~ ~~528~~ 524 bytes

```
import zlib as Holy
B=list("NNAAAnAAnnAnaAannnaaaaNaAAnNanAaAanNNaNNaNaanNNANanNNANaAnAaANANAAnAaANNnAanAaNnAaAANNAaAnNANAaaANNAanAaNaNNNAaNNanAAnNNnaaaNANANANnnaaaNaaAAAANaNaNaNAnNAAAAaaaaANAaNnnAaAaNAAaANNnaaNnNnaannaaAaananannNnAAAAAanAananANAnaAAnANAAaaaAaaanaaAAaanNAnanAAnnnANAnNAnnAnnnanaNNaaaNaNNaAAnNAaaANNNANAnAaaAaNaANnNNNaaAanaaaanaaaaaAaAaNnNnnaAnANaNnnANanNA")
A=dict(N='11',A='01',n='10',a='00')
T=""
POP=BIFF=POW=OOF=lambda:A[B.pop()]
while B:T+=chr(int(POP()+POW()+BIFF()+OOF(),2))
print Holy.decompress(T)

```

# Answer
> 19 votes
## JavaScript (ES6), ~~148~~ 146 bytes

```
_=>`n2zh2
f8l2b2l8
b8pep8
7cpepc
5ijiji
3yyq
0
0
0
3yyq
5afy8fa
98f69a96f8
f4f2d6d2f4`.replace(/./g,c=>'* '[(n=parseInt(c,36))&1].repeat(n/2||49))

```

### Demo

```
let f =

_=>`n2zh2
f8l2b2l8
b8pep8
7cpepc
5ijiji
3yyq
0
0
0
3yyq
5afy8fa
98f69a96f8
f4f2d6d2f4`.replace(/./g,c=>'* '[(n=parseInt(c,36))&1].repeat(n/2||49))

o.innerHTML = f()
```

```
<pre id=o></pre>
```

# Answer
> 13 votes
# Python, ~~149~~ 142 bytes

*7 bytes saved thanks to @PM2Ring*

```
for l in"b1d 74a13 54c4 36c4 2995 1o 0p 0p 0p 1o 257b 447343 727162".split():x=''.join(s*int(k,36)for s,k in zip(' *'*3,l));print(x+x[-2::-1])

```

# Answer
> 13 votes
# MATL, ~~61~~ 59 bytes

```
' *'60:'*u9|K9j[~F9R,>ejc4Q,7;F\1l_=7sFR'F11:ZaY"13e)25ZvZ)

```

Try it online!

### How it works

This uses the following, standard techniques:

* Since the image is *horizontally symmetric*, only the left half (including center column) is encoded.
* The image is linearized in column-major order (down, then across) and the resulting sequence is *run-length encoded*.
* The resulting run lengths take values from `1` to `11`, so the sequence of run lengths is *compressed by base conversion*, from base `11` to base `94` (printable ASCII chars except single quote, which would need escaping).

# Answer
> 11 votes
Various solutions, all using Run Length Encoding, with a variety of techniques to encode the RLE data.

## Python 3, ~~125~~ 121 bytes

This version uses a `bytes` string to store the data.

```
s=''
for c in b'<)@4/:),0/>/,3>/*981(WYYY(W*14=./4-.-4+4)2+':s+=' *'[c%2]*(c//2-19);s*=len(s)<25or print(s+s[-2::-1])or 0

```

Let `s` be a string of stars or of spaces. Then the byte `n` encoding `s` is given by

```
n = 38 + 2*len(s) + (s[0]=='*')

```

---

## Python 2, ~~133~~ 126 bytes

This version uses alphabetic coding. The letter value determines the length of the output string, the case of the letter determines whether it's composed of spaces or stars.

```
s=''
for c in'kAmgDjAceDlDcFlDbIiEaXYYYaXbEgKdDgCdCgBgAfB':
 s+=' *'[c<'a']*(int(c,36)-9)
 if len(s)>24:print s+s[-2::-1];s=''

```

---

My original 133 byte Python 2 solution.

This version uses zero-length strings so it can easily alternate between star and space strings.

```
s=''
for c,n in zip(24*' *','b1d074a13054c436c429951o0p0p0p1o257b447343727162'):
 s+=c*int(n,36)
 if len(s)>24:print s+s[-2::-1];s=''

```

---

Just for fun, here's a one-liner using the alphabetic coding.

Python 2, 148 bytes

```
print'\n'.join(''.join(s+s[-2::-1])for s in zip(*[iter(''.join(' *'[c<'a']*(int(c,36)-9)for c in'kAmgDjAceDlDcFlDbIiEaXYYYaXbEgKdDgCdCgBgAfB'))]*25))

```

---

For even more fun, here's a pattern in Conway's Game of Life that generates a version of the Batman logo. I had to double each line to keep the aspect ratio roughly the same as the text version. This pattern doesn't *really* compute the logo (although it *is* possible to do computations in Life - it's Turing-complete), it just replays it from memory loops, so I guess I can't post it as a code golfing entry (although I *did* create it using a Python script I wrote a few years ago). ;)

It's encoded in a fairly standard RLE format that most Life engines can load. If you don't have a GoL program (eg Golly), you can view it in action online with this online Life engine, which can import Life RLE files. Here's a PNG version of that Life pattern, some Life programs (including Golly) can load Life patterns from PNGs and various other image file formats.

# Answer
> 8 votes
# vim, 168 156 bytes

```
:nm N a <C-v><ESC>
:nm A a*<C-v><ESC>
:nm B aY<C-v><ESC>yyp!!rev<C-v><CR>kJh4xo<C-v><ESC>
11NA13NB7N4A10NA3NB5N4A12N4AB3N6A12N4AB2N9A9N5ABN24AB25ABkyyppjN24AB2N5A7N11AB4N4A7N3A4N3AB7N2A7NA6N2ABdd

```

This assumes a Unix environment, for `rev`. I use a fairly straightforward (count,character) encoding, with N and A appending a  and `*` respectively, and B doing the copy and reverse.

In the actual file, the bracketed entries are replaced by the literal bytes they represent. `<C-v>` is 0x16, `<ESC>` is 0x1b, and `<CR>` is 0x0d.

Try it online

# Answer
> 7 votes
# Charcoal, ~~69~~ ~~54~~ ~~52~~ 48 bytes

```
Ｅ⪪”｜↖y{{﹪yc›o”n↗πf>T≔Ｙ¿PN｜ωπＱβ” ⪫Ｅι×§* μ⌕βλω‖Ｏ←

```

Try it online! Link is to verbose version of code. Edit: Thanks to @ASCII-only, saved 4 bytes by switching from a separate flag to looping over indices, ~~7 bytes by using the (undocumented?) `⸿` character,~~ and a further 4 bytes by using the alphabet for the run length encoding. Saved a further 2 bytes because `AtIndex` automatically takes the modulo. Saved a further 4 bytes because `Map` automatically creates an index variable. Explanation:

```
Print(Map(

```

The outer `Map` returns an array. `Print` handles this by printing each element on its own line, thus avoiding having to manually `Join` them with `\n`.

```
Split("anb adbke eme fjj y z z z y lhf dedhe cgbhc" " "),

```

The string encodes all the half-rows of the output. Alternating letters refer to the number of `*`s and spaces (`a=0` is used to handle a row that starts with a space). The space is a convenient choice of delimiter, but also turns out to compress well (x also compresses to an overall 55 bytes). Each row is processed separately. (Note: The deverbosifier fails to remove the separator between a compressed and uncompressed string, otherwise the code would have a `,` for readability.)

```
Join(Map(i, Times(AtIndex("* ", m), Find(b, l))), w)));

```

Loop over every letter, expanding to the appropriate number of `*`s or spaces. The variable `m` is the inner loop index for this `Map`, while `l` holds the letter. The result is then `Join`ed into a single string using the predefined empty string `w`.

```
ReflectOverlap(:Left);

```

Once all the rows are printed, reflect everything to the left, overlapping the middle column.

I tried handling the newlines, spaces and stars all in one loop but it actually took two more bytes this way:

```
Print(Join(Map("anb adbke eme fjj y z z z y lhf dedhe cgbhc", Ternary(Equals(" ", i), "\n", Times(AtIndex("* ", k), Find(b, i)))), w));
ReflectOverlap(:Left);

```

# Answer
> 7 votes
# 05AB1E, 47 bytes

```
„ *19×S•«M;Ó8ζ?èYÑ?½¨/Ž´.δòÈÖ<•25вт<19ǝ×J13ä€û»

```

Try it online!

# Answer
> 7 votes
# Clojure, ~~833~~ ~~437~~ ~~342~~ 332 bytes

Almost by definition Clojure will never win any prizes for brevity, but as I looked forward EVERY DARN WEEK to the TWO (count 'em - **TWO**) episodes of Batman (same Bat-time, same Bat-channel!) it's clear that there is no time to lose!

Quick, Robin - to the Bat-REPL!!!

```
(defn p[](loop[l[[11 1 25 1][7 4 10 1 5 1 10 4][5 4 12 7 12 4][3 6 12 7 12 6][2 9 9 9 9 9][1 47][0 49][0 49][0 49][1 47][2 5 7 21 7 5][4 4 7 3 4 5 4 3 7 4][7 2 7 1 6 3 6 1 7 2]]](loop[a(first l)c " "](print(apply str(repeat(first a)c)))(if(>(count a)1)(recur(rest a)(if(= c " ")"*" " "))(println)))(if(>(count l)1)(recur(rest l)))))

```

Un-golfed version:

```
(defn print-bat-signal []
  (loop [lines [ [11 1 25 1]  ; spaces asterisks spaces asterisks
                 [7 4 10 1 5 1 10 4]
                 [5 4 12 7 12 4]
                 [3 6 12 7 12 6]
                 [2 9 9 9 9 9]
                 [1 47]
                 [0 49]
                 [0 49]
                 [0 49]
                 [1 47]
                 [2 5 7 21 7 5]
                 [4 4 7 3 4 5 4 3 7 4]
                 [7 2 7 1 6 3 6 1 7 2]] ]
    ; (print-bat-signal-line (first lines))
    (loop [ aLine (first lines)
            c   " " ]
      (print (apply str (repeat (first aLine) c)))
      (if (> (count aLine) 1)
        (recur (rest aLine) (if (= c " ") "*" " "))
        (println)))
    (if (> (count lines) 1)
      (recur (rest lines)))))

```

RIP Adam West. No matter how ridiculous those shows were, those of us who were kids salute you.

# Answer
> 6 votes
# PHP, 137 bytes

```
<?=gzinflate(base64_decode(U1CAAy0FXECLC8YAAnQNyAJAwIVFIYSPRYgLLkWEYrByLS10WTwiXAgmcYCLRPV00kGyN6BhgB4eyABZjgstyqAsuDpU5YjEgJIOEKoQigE));

```

Try it online!

# PHP, 177 bytes

```
foreach(["9zojk",a2878,aa4nb,b7u9z,chbf3,eze2n,jz6rj,jz6rj,jz6rj,eze2n,cepdr,ako8z,a1pc1]as$v)echo$t=strtr(substr(base_convert($v,36,2),1),10,"* "),"* "[$k++<2],strrev($t),"\n";

```

Try it online!

# PHP, 179 bytes

```
for(;$o=ord(kAlgDjAbeDlCcFlCbIiDaWXXXaWbEgJdDgCdBgBgAfA[$i++]);($x+=$s)%24?:print$r.("* "[$k++<2]).strrev($r)."\n".$r="")$r.=strtr(str_repeat($b=+($o>96),$s=$o-64-$b*32),10," *");

```

Try it online!

# Answer
> 6 votes
# T-SQL, ~~283 276~~ 222 bytes

```
SELECT CAST(DECOMPRESS(CAST('H4sIAAAAAAAEAFNQgAMtBVxAi5cLxgICdB3IAkAAVYuqEsLHIgRWjV0KqxBIvZYWujQeEaAGLdIALxeJGuinhXSvQEMCPVSQAbIcJPJQReGSSHxU9WAeSppAqEMoBwCfudAGawIAAA=='as XML).value('.','varbinary(max)'))AS varchar(max))

```

Implementing GZIP compression of the original batman string, via the method posted here. This works only in SQL 2016 and later.

For earlier SQL versions, use my prior method (**276 bytes**):

```
DECLARE @ CHAR(999)=REPLACE(REPLACE(REPLACE('PRINT SPACE(11#1$25#1&$7#4$10#1$5#1$10#4&$5#4$12#7$12#4&$3#6$12#7$12#6&$2#9$9#9$9#9&$1#47&#49&#49&#49&$1#47&$2#5$7#21$7#5&$4#4$7#3$4#5$4#3$7#5&$7#2$7#1$6#3$6#1$7#2)','#',')+REPLICATE(''*'','),'$',')+SPACE('),'&',')+CHAR(13')EXEC(@)

```

Basically I'm manually encoding a giant string that determines what to print next, using the following method:

* `#7` gets replaced by `+REPLICATE('*',7)`
* `$4` gets replaced by `+SPACE(4)`
* `&` gets replaced by `+CHAR(13)`

After replacement, the full 958 character string looks like (with line breaks at each line in the Batman symbol:

```
PRINT
SPACE(11)+REPLICATE('*',1)+SPACE(25)+REPLICATE('*',1)+CHAR(13)
+SPACE(7)+REPLICATE('*',4)+SPACE(10)+REPLICATE('*',1)+SPACE(5)+REPLICATE('*',1)+SPACE(10)+REPLICATE('*',4)+CHAR(13)
+SPACE(5)+REPLICATE('*',4)+SPACE(12)+REPLICATE('*',7)+SPACE(12)+REPLICATE('*',4)+CHAR(13)
+SPACE(3)+REPLICATE('*',6)+SPACE(12)+REPLICATE('*',7)+SPACE(12)+REPLICATE('*',6)+CHAR(13)
+SPACE(2)+REPLICATE('*',9)+SPACE(9)+REPLICATE('*',9)+SPACE(9)+REPLICATE('*',9)+CHAR(13)
+SPACE(1)+REPLICATE('*',47)+CHAR(13)
+REPLICATE('*',49)+CHAR(13)
+REPLICATE('*',49)+CHAR(13)
+REPLICATE('*',49)+CHAR(13)
+SPACE(1)+REPLICATE('*',47)+CHAR(13)
+SPACE(2)+REPLICATE('*',5)+SPACE(7)+REPLICATE('*',21)+SPACE(7)+REPLICATE('*',5)+CHAR(13)
+SPACE(4)+REPLICATE('*',4)+SPACE(7)+REPLICATE('*',3)+SPACE(4)+REPLICATE('*',5)+SPACE(4)+REPLICATE('*',3)+SPACE(7)+REPLICATE('*',5)+CHAR(13)
+SPACE(7)+REPLICATE('*',2)+SPACE(7)+REPLICATE('*',1)+SPACE(6)+REPLICATE('*',3)+SPACE(6)+REPLICATE('*',1)+SPACE(7)+REPLICATE('*',2)

```

Which gets executed as dynamic SQL, producing the following output:

```
           *                         *
       ****          *     *          ****
     ****            *******            ****
   ******            *******            ******
  *********         *********         *********
 ***********************************************
*************************************************
*************************************************
*************************************************
 ***********************************************
  *****       *********************       *****
    ****       ***    *****    ***       *****
       **       *      ***      *       **

```

# Answer
> 6 votes
# C (gcc), 191 bytes

```
#define x 16777215
char*b,*c,a[50];l[]={4096,122888,491535,2064399,4186143,x/2,x,x,x,x/2,4064255,983495,98435,0},*p=l;main(){for(;*p;p++,puts(a))for(b=c=a+23;b>=a;*p/=2)*b--=*c++=" *"[*p&1];}

```

Try it online!

# Answer
> 4 votes
# Python 2, 134 bytes

```
for w in'1D 4A13 4C4 6C4 995 O P P P O 57B 47343 27162'.split():r=''.join(c*int(k,36)for c,k in zip(3*'* ',w));print'%25s'%r+r[-2::-1]

```

Try it online!

Run-length encodes each line from the left half in base 36. Mirrors it to make the full line, which is printed. The leading spaces are not encoded; instead, the left half is padded to length 25.

# Answer
> 4 votes
# Java, ~~296~~ 214 bytes

Golfed:

```
()->{String r="";boolean b=1<0;for(int a:";1I1074:151:4054<7<4036<7<6029999901_10a10a10a01_0257E570447345437407271636172".toCharArray()){for(int i=0;i<a-48;++i)r+=(b?'*':' ');if(a<49)r+='\n';else b=!b;}return r;}

```

Ungolfed:

```
public class InHonorOfAdamWest {

  public static void main(String[] args) {
    System.out.println(f(() -> {
      String r = "";
      boolean b = 1 < 0;
      for (int a : ";1I1074:151:4054<7<4036<7<6029999901_10a10a10a01_0257E570447345437407271636172".toCharArray()) {
        for (int i = 0; i < a - 48; ++i) {
          r += (b ? '*' : ' ');
        }
        if (a < 49) {
          r += '\n';
        }
        else {
          b = !b;
        }
      }
      return r;
    }));
  }

  private static String f(java.util.function.Supplier<String> f) {
    return f.get();
  }
}

```

# Answer
> 4 votes
# PowerShell, ~~129~~ 128 bytes

```
-join('5+C+<.4+/+4.6.616.206160/33333-Y+s*t+Y-/1?1/0.1-./.-1.5,1+0-0+1,'|% t*y|%{(' ','*')[$i++%2]*($_-42)})-split'(.{49})'-ne''

```

Try it online!

Ungolfed:

```
-join(
    '5+C+<.4+/+4.6.616.206160/33333-Y+s*t+Y-/1?1/0.1-./.-1.5,1+0-0+1,'|% toCharArray|%{
        (' ','*')[$i++%2]*($_-42)
    }
)-split'(.{49})'-ne''

```

Output:

```
           *                         *
       ****          *     *          ****
     ****            *******            ****
   ******            *******            ******
  *********         *********         *********
 ***********************************************
*************************************************
*************************************************
*************************************************
 ***********************************************
  *****       *********************       *****
    ****       ***    *****    ***       ****
       **       *      ***      *       **

```

## Main idea is very simple

The Emblem Coding:

1. Concatenate all emblem lines to one string
2. Count spaces and asterisks
3. Encode length of each segment + 42 as a char

Decoding (this script):

1. Get code of the char minus 42 for each char from the cripto-string. This is a length of a segment
2. Append segment, consisting of a space or asterisk repeated `Length` times
3. Insert new line each 49 symbols to split lines

## Some smart things

1. The coding algorithm suggests a symbol with code 189 to display 3 middle asterisk lines. This symbol is not ASCII. It works normal with modern environments, but there are ambiguities with script length. So, I replace non-ascii-symbol `½` to `s*t` (73 asterisks, 0 spaces, 74 asterisks).
2. I cut off right spaces in the last line to save 1 byte. Sorry, Batman.
3. Why the offset is 42? Just wanted :) And cripto-string looks nice.

## Extra: Scipt for coding of the Emblem

```
(@"
           *                         *
       ****          *     *          ****
     ****            *******            ****
   ******            *******            ******
  *********         *********         *********
 ***********************************************
*************************************************
*************************************************
*************************************************
 ***********************************************
  *****       *********************       *****
    ****       ***    *****    ***       ****
       **       *      ***      *       **
"@ -replace"`n"-split'( +|\*+)'-ne''|%{[char]($_.Length+42)})-join''

```

# Answer
> 3 votes
# Bubblegum, 75

xxd dump:

```
00000000: cd92 b501 8050 1043 fb4c 91fa efbf 1f0e  .....P.C.L......
00000010: 2f87 d371 5814 37d3 7c35 4d2b 1826 64f6  /..qX.7.|5M+.&d.
00000020: d8aa 419c 2a11 3e75 ce25 6d1e ee9d 22e0  ..A.*.>u.%m...".
00000030: bb11 f04f 0d7f 2e38 dfc8 6926 3dad 0871  ...O...8..i&=..q
00000040: f316 1071 6db8 fc07 a408 f7              ...qm......

```

Try it online.

# Answer
> 3 votes
# Coffeescript (282 Bytes)

```
t=['6bk','59mw','l2j3','2ghsf','4zg2n','9zldr','jz6rj','4u7zz','165qf','47wj']
[0,1,2,3,4,5,6,6,6,5,7,8,9].map((d)->parseInt(t[d], 36).toString(2).padStart 25, '0').forEach (d)->console.log (d+d.split('').reverse().join('').substring(1)).replace(/0/g, ' ').replace(/1/g,'*')

```

### Explaination (using plain-ol ES6)

* Like other's mentioned, the image is symmetric, so we can toss out half of it in the encoding
* Several lines are also repeated, so we can toss each line in a lookup table to save a few bytes
* We convert each half-line into binary (using 0 as space and 1 as \*), and encode it at that highest radix in Javascript (36), resulting in the encoding array.
* First map takes each line and converts it back into its final output half-line, padding it with 0s
* Second map concatenates each line with its reversed half (tossing the middle column the second time), and replaces the 0s and 1s with spaces and \*s

```
var t = [
    '6bk',
    '59mw',
    'l2j3',
    '2ghsf',
    '4zg2n',
    '9zldr',
    'jz6rj',
    '4u7zz',
    '165qf',
    '47wj'
];
[0,1,2,3,4,5,6,6,6,5,7,8,9].map((d) => {
    return parseInt(t[d], 36).toString(2).padStart(25, '0');
})
.forEach((d) => {
    console.log((d + d.split('').reverse().join('').substring(1))
        .replace(/0/g, ' ')
        .replace(/1/g, '*'));
});
```

# Answer
> 2 votes
# , 102 bytes

```
i±³ *±±
³ *± ´*·
´*±² ´*µ
´*±² ¶*³
µ*¹ ¹*
²´* Ä3o²µ*jo±±*· µ*
³*´ ³*· ´*´
**¶ *· **· Îæ$vp

```

Try it online!

Hexdump:

```
00000000: 69b1 b320 2ab1 b120 0ab3 202a b120 b42a  i.. *.. .. *. .*
00000010: b720 0ab4 2ab1 b220 b42a b520 0ab4 2ab1  . ..*.. .*. ..*.
00000020: b220 b62a b320 0ab5 2ab9 20b9 2a20 200a  . .*. ..*. .*  .
00000030: b2b4 2a20 1bc4 336f b2b5 2a1b 6a6f b1b1  ..* ..3o..*.jo..
00000040: 2ab7 20b5 2a20 200a b32a b420 b32a b720  *. .*  ..*. .*.
00000050: b42a b420 0a2a 2ab6 202a b720 2a2a b720  .*. .**. *. **.
00000060: 1bce e624 7670                           ...$vp

```

This uses run-length encoding to generate the following batman half:

```
             *
   *          ****
****            ****
****            ******
*****         *********
************************
*************************
*************************
*************************
************************
***********       *****
***    ***       ****
**      *       **

```

And then reverses and duplicates each line.

# Answer
> 2 votes
# C# (.NET Core), 342 333 328 185 175 bytes

```
_=>{var r="";for(int i=0,j,k=0;i<63;i++)for(j=0;j++<"-#;#4&,#'#,&.&.).&*(.).('+++++%Q#µ#Q%')7)'(&)%&'&%)&-$)#(%(#)$)"[i]-34;){r+=i%2<1?' ':'*';if(++k%49<1)r+='\n';}return r;}

```

Try it online!

Lots of bytes saved after changing the approach. Taking the drawing as a 2D array, I calculated the RLE encoding by files:

```
{ 11, 1, 25, 1, 18, 4, 10, 1, 5, 1, 10, 4, 12, 4, 12, 7, 12, 4, 8, 6, 12, 7, 12, 6, 5, 9, 9, 9, 9, 9, 3, 47, 1, 147, 1, 47, 3, 5, 7, 21, 7, 5, 6, 4, 7, 3, 4, 5, 4, 3, 7, 4, 11, 2, 7, 1, 6, 3, 6, 1, 7, 2, 7 }

```

Odd indices stand for s and even indices stand for `*`s. Then I substituted every number for a printable ASCII representation (taking the '#' character as 1), and I got:

```
-#;#4&,#'#,&.&.).&*(.).('+++++%Q#µ#Q%')7)'(&)%&'&%)&-$)#(%(#)$)

```

So the algorithm just calculates the drawing by decompressing this string and adding newlines in the proper places.

# Answer
> 2 votes
## Mathematica 151 Bytes

```
Uncompress@"1:eJxTTMoPCm5iYmBQQAAtBVxAK8bA0AjGBgJ0PcgCQABXjaoWwsciBFWPXRKrEESHlha6AjwiYC1apAGQHhK10FsTOV6Chgp6CCEDZDlYdKKKw6WR+OjxD+KiJBSEQoR6AC49ZiI="

```

Cheap and uncreative. The string is just from the built-in `Compress` command used on the required output.

Update:

I think I can do better with the built-in `ImportString` \ `ExportString` functions but I can't see to copy and paste the resulting strings from `ExportString` correctly. E.g.

```
b = "           *                         *\n       ****          *     *          ****\n     ****            *******            ****\n   ******            *******            ******\n  *********         *********         *********\n ***********************************************\n*************************************************\n*************************************************\n*************************************************\n ***********************************************\n  *****       *********************       *****\n    ****       ***    *****    ***       ****\n       **       *      ***      *       **"
ExportString[b,"GZIP"]
ImportString[%,"GZIP"]

```

I can not seem to copy the text output from the second line to replace the `%` in the third line.

# Answer
> 2 votes
# Bash, ~~407~~ 322 bytes

```
w=`yes 1|head -30|tr -d '\n'`
for i in B1C000 74A120 54C003 36C003 299004 1C0506 0D0506 0D0506 0D0506 1C0506 257505 447342 727161
{ read a b c d e f <<<$(echo $i| fold -1| xargs)
x=`printf "%.$[0x${a}]d%.$[0x${b}]s%.$[0x${c}]d%.$[0x${d}]s%.$[0x${e}]d%.$[0x${f}]s" 0 $w 0 $w 0 $w`
echo -n $x$[f<1?0:1]
rev<<<$x
}|tr 01 \ \*

```

Try it online!

really awful, need more time or help to golf it. it generates the output with 0 an 1 and transliterates in the end. Encoded in hexa digits the amount of 0 and 1, taking care to make last digit 0 for the first two rows as a flag to output middle column. Uses printf pressision to either digit or string to output 0 and 1. think the `%.$[0x${X}]C` pattern could be used to golf it.

```
w=`yes 1|head -30|tr -d '\n'`  # w=111111111111111111111111111111
for i in B1C000 74A120 54C003 36C003 299004 1C0506 0D0506 0D0506 0D0506 1C0506 257505 447342 727161
{ read a b c d e f <<<$(echo $i| fold -1| xargs)
printf "%.$[0x${a}]d
%.$[0x${b}]s
%.$[0x${c}]d
%.$[0x${d}]s
%.$[0x${e}]d
%.$[0x${f}]s" 0 $w 0 $w 0 $w
echo -n $[f<1?0:1]
printf "%.$[0x${f}]s
%.$[0x${e}]d
%.$[0x${d}]s
%.$[0x${c}]d
%.$[0x${b}]s
%.$[0x${a}]d\n" $w 0 $w 0 $w 0
}|tr 01 \ \*

```

# Answer
> 2 votes
## PowerShell, 305 bytes, 307 bytes, 316 bytes

```
[IO.StreamReader]::new(([IO.Compression.GZipStream]::new([IO.MemoryStream]::new(([Convert]::FromBase64String('H4sIAAAAAAAEAL1SOQ4AIAjbTfwDc///QFE8gKAJi53sNQASbYBuQC3rxfANLTBm1iaFB9JIx1Yo9Tzg7YfCBeRQS7Lwr5IfZW7Cb0VDe3I8q25TcXvrTsyXOLGTbuHBUsBqAgAA')),0,102),[IO.Compression.CompressionMode]::Decompress))).ReadToEnd()

```

Maybe someone else can help me shorten it further, though I can't figure out how unless there's a more concise way to define a custom type accelerator.

Edit: Shortened version (thanks @root). Encoded string (pre base64 encoding) can be trimmed by eight array positions and the range can be thus decreased. Not sure why StreamWriter is introducing this bloat into the MemoryStream. Insight into the underlying behavior would be appreciated.

```
[IO.StreamReader]::new(([IO.Compression.GZipStream]::new([IO.MemoryStream]::new(([Convert]::FromBase64String('H4sIAAAAAAAEAL1SOQ4AIAjbTfwDc///QFE8gKAJi53sNQASbYBuQC3rxfANLTBm1iaFB9JIx1Yo9Tzg7YfCBeRQS7Lwr5IfZW7Cb0VDe3I8q25TcXvrTsyXOLGTbg')),0,94),[IO.Compression.CompressionMode]::Decompress))).ReadToEnd()

```

Ungolfed:

```
#Read decoded stream
[IO.StreamReader]::new(
    (
        #Reverse GZip encoding
        [IO.Compression.GZipStream]::new(
            #Load GZip encoded string into a memory stream
            [IO.MemoryStream]::new(
                (
                    # Convert Base64 back to GZip encoded string
                    [Convert]::FromBase64String('H4sIAAAAAAAEAL1SOQ4AIAjbTfwDc///QFE8gKAJi53sNQASbYBuQC3rxfANLTBm1iaFB9JIx1Yo9Tzg7YfCBeRQS7Lwr5IfZW7Cb0VDe3I8q25TcXvrTsyXOLGTbuHBUsBqAgAA')
                ),
                #Start of range
                0,
                #End of range. Stick the Memory Stream into a variable and use .Length here for non golf code
                102
            ),
            #Specify that we are decompressing
            [IO.Compression.CompressionMode]::Decompress
        )
    )
).ReadToEnd()

```

Compression code:

```
$s = '           *                         *
       ****          *     *          ****
     ****            *******            ****
   ******            *******            ******
  *********         *********         *********
 ***********************************************
*************************************************
*************************************************
*************************************************
 ***********************************************
  *****       *********************       *****
    ****       ***    *****    ***       ****
       **       *      ***      *       **'

#Create Memory Stream
$ms = [IO.MemoryStream]::new()
#Initialize a stream
$sw = [IO.StreamWriter]::new(
    #Create GZip Compression stream
    [IO.Compression.GZipStream]::new(
        #Reference Memory Stream
        $ms,
        #Set mode to compress
        [IO.Compression.CompressionMode]::Compress
    )
)
#Write input into stream
$sw.Write($s)
#Close the stream
$sw.Close()

#Convert Array to Base64 string
[Convert]::ToBase64String(
    #Retrieve Memory Stream as an array
    ($ms.ToArray() | select -SkipLast 8)
)

```

# Answer
> 2 votes
# Python 3, ~~232~~ ~~197~~ ~~183~~ 164 bytes

Yet Another Python Answer. No boring compression code though. Exciting compression code.

```
for s in map(lambda x:x+x[-2::-1],b".$; *',$' ('.* &).* %,+, $R #T #T #T $R %()8 '')&&( *%)$(&".split()):print(*((u-35)*" "+(v-35)*"*"for u,v in zip(*[iter(s)]*2)))

```

I'm using the magic number 35 because that way, no control characters, spaces or things that would need to be escaped occur. Sad that I have to process the spaces and stars separately, that costs me a bit.

### Ungolfed:

```
for s in map(lambda x:x+x[-2::-1],   # map a list to the list and itself reversed,
                                     # minus the last (center) element
# magic string:
".$; *',$' ('.* &).* %,+, $R #T #T #T $R %()8 '')&&( *%)$(&"
.split()):                           # split on whitespace to divide into lines
 print(*(                            # unpack generator expression
(ord(s[i])-35)*" "                   # convert character to int, -25, times space
+(ord(s[i+1])-35)*"*"                # same thing with "*"
for i in range(0,len(s)-1,2)))       # for every pair in the list

```

# Answer
> 2 votes
# Perl 5, 168 bytes

```
$_="11 *25
7 4*10 *5 *10 4
5 4*12 7*12 4
3 6*12 7*12 6
2 9*9 9*9 9
 47
49
49
49
 47
  5*7 21*7 5
4 4*7 3*4 5*4 3*7 4
7 **7 *6 3*6 *7 *";s/$/*/gm;say s/\d+(.)/$1x$&/ger

```

Note the trailing space at the end of only the first line. Requires `-M5.01`, which is free.

Can probably be golfed quite a bit more.

# Answer
> 2 votes
# CJam, 78 bytes

```
"@ÇÏßÿÿÿÿÿÿÿÿÿÿÿÿýÿÿóÿ"{8{_2U#&'*S?\}fU;}/]25/{_24/~;W%N}%

```

Try it online!

---

How it works:

Like many other submissions, this takes advantage of vertical symmetry so that only the following data has to be encoded:

```
           *
       ****          *
     ****            ****
   ******            ****
  *********         *****
 ************************
*************************
*************************
*************************
 ************************
  *****       ***********
    ****       ***    ***
       **       *      **

```

Since all lines are 25 characters long, we can drop all newlines:

```
           *                    ****          *        ****            ****   ******            ****  *********         ***** *************************************************************************************************** ************************  *****       ***********    ****       ***    ***       **       *      **

```

This string only contains spaces and `*`, so it's the perfect candidate for a bitmap. 8 characters are chunked into one with a `1` bit meaning `*` and `0` meaning space. The string is 325 characters long, so it's padded with 3 additional spaces to be dividable by 8. This yields the binary string:

```
@ÇÏßÿÿÿÿÿÿÿÿÿÿÿÿýÿÿóÿ

```

Now, onto the code part:

```
{8{_2U#&'*S?\}fU;}/]25/{_24/~;W%N}%     e# for each character do:
 8{_2U#&'*S?\}fU                        e#   for U in 0..7 do:
   _2U#&'*S?\                           e#     push (char & pow(2, U)) ? '*' : ' '
   _                                    e#     duplicate the character
    2U#                                 e#     push pow(2, U)
       &                                e#     bitwise-AND the char with the value
        '*                              e#     push '*'
          S                             e#     push space
           ?                            e#     ternary select
            \                           e#     swap the pushed char with the original (for next loop iteration)
                ;                       e#   pop the character (from last loop iteration) from the stack
                    ]                   e# wrap all pushed chars in one array
                     25/                e# split array after every 25 elements (chars)
                        {_24/~;W%N}%    e# for each char group do:
                         _24/~;W%N      e#   mirror string and append newline
                         _              e#   duplicate string
                          24/           e#   split at 24 chars
                             ~          e#   dump array to stack
                              ;         e#   pop top stack element
                               W%       e#   select every -1th element (reverse)
                                 N      e#   push newline

```

# Answer
> 2 votes
# LaTeX, 314 bytes

```
\documentclass{book}\begin{document}\def\r#1#2{\ifnum#2>64#1\r#1{\numexpr#2-1}\fi}\catcode`.13\catcode`!13\catcode`-13\def!#1{\r*{`#1}}\def-#1{\r~{`#1}}\let.\par\tt-K!A-Y!A.-G!D-J!A-E!A-J!D.-E!D-L!G-L!D.-C!F-L!G-L!F.-B!I-I!I-I!I.-A!o.!q.!q.!q.-A!o.-B!E-G!U-G!E.-D!D-G!C-D!E-D!C-G!D.-G!B-G!A-F!C-F!A-G!B\enddocument

```

The ungolfed version with explanations:

```
\documentclass{book}
\begin{document}
% Macro for repeating #1 (#2-64) times
\def\r#1#2{\ifnum#2>64#1\r#1{\numexpr#2-1}\fi}
% Prepare '.', '!' and '-' for usage as macro names
\catcode`.13\catcode`!13\catcode`-13
% The ASCII code of #1 (a character) is used as the number of how often '*' will be printed with \r
\def!#1{\r*{`#1}}
% Same as ! but for spaces
\def-#1{\r~{`#1}}
% . becomes a line break
\let.\par
% Set monospace font
\tt
% And finally print the whole thing
-K!A-Y!A.-G!D-J!A-E!A-J!D.-E!D-L!G-L!D.-C!F-L!G-L!F.-B!I-I!I-I!I.-A!o.
!q.!q.!q.-A!o.-B!E-G!U-G!E.-D!D-G!C-D!E-D!C-G!D.-G!B-G!A-F!C-F!A-G!B
\enddocument

```

# Answer
> 2 votes
# Brainfuck, 369 bytes

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

```

Try it online!

General idea is to fill memory with counts for how many spaces, stars, and newlines to output (the character to write is the position modulo 3), terminated by a `255`. To efficiently build the counts the symbol is broken into a bottom half, which is prefilled with `0 7 3`, and the top half which is prefilled with `0 9 4`.

`+[[->>>+<<<]>+++++++>+++>+]-` Fills the memory with 254 repetitions of `0 7 3` terminated with a `255`, not all of them are used but its easier to create that many than any other count.

`<-<<<--<-<<<-<<--<<<-<<+<+<<<<---<<++<---<<<<<+<---<+<++<<<+<[->++<]<<<<<++<-----<<[[-]<]+<-<` Updates the counts of the bottom half, note the `[[-]<]` which zeros 3 consecutive cells and is used as a marker for changing the cell repetitions and to compact the middle 5 lines into a loop.

`[++<<+<]>[>>>]` Update remaining cells to be repetitions of `0 9 4`.

`<<<<+<+<<<+<<<+<<<+<--<[[->+++++>>]<[<<<]>]+<+<+++++<<<+++++<<<+++++<-------<+<++<+++<<[+++<]<++<------<+<<+++<<[+++<]<<----[<+<]<+[----<]<---<+<<<--<+<+[-<+++>]+<+<<---<++<` Update the counts of the top half.

`++++++++[-<+<++++<++++>>>]<--<+>>+[-[-<.>]<<<[->>>+<<<]>>>>+]` Output the characters. The first loop builds `42 32 10`, second loop outputs the right most character n times and then moves the left most character forwards 3 cells and repeats until a `255` is hit.

# Answer
> 1 votes
# Mathematica, 271 bytes

```
T=Table;f[x_]:=""<>T["*",x];m={f@49};n={f@47};g[y_]:=""<>T[" ",y];k[a_,b_,c_,d_,e_]:={(s=f@a<>g@b<>f@c<>g@d<>f@e)<>StringDrop[StringReverse@s,1]};Grid@{k[1,13,0,0,0],k[4,10,1,3,0],k[4,12,0,0,4],k[6,12,0,0,4],k[9,9,0,0,5],n,m,m,m,n,k[5,7,0,0,11],k[4,7,3,4,3],k[2,7,1,6,2]}

```

# Answer
> 1 votes
# Braingolf, ~~590~~ ~~580~~ ~~579~~ ~~577~~ ~~428~~ ~~423~~ 312 bytes

*-111 bytes because LeakyNun is a golfing god*

```
14#
46*6394943[92+.6,5][8]#.[# ]#*[# ]#*#
[# ][#*][# ]#*[# ]#*[# ]#*...#
[# ][#*][# ][#*][# ]#*...#
# ..[#*][# ][#*][# ][#*]#
# .[#*][# ][#*][# ][#*]#
# [#*]#
&@#0[#*]#
!&@!&@# &@#.[#*]"
  "&@4645*643646366556[#*][# ][#*][# ][#*]"
    "[#*][# ]#*..# ...[#*]# ...#*..[# ][#*]#
[# ]#*.[# ]#*[# ]#*..[# ]#*[# ]#*.&@

```

Try it online!

Braingolf is **not** good at ASCII art, but dammit I tried.

No way in hell am I explaining this clusterf\**k

# Answer
> 1 votes
# gawk, ~~284~~ 264 bytes.

Uses LZW compression.

```
BEGIN{d["#"]="\n";d["$"]=" ";d["%"]="*";n=38
split("$&'($%),--%#/%3.&+(7.3318;5';B@6;=*B95I4DL=L?:QJ)T0HWZ[\\F]_`Q#adaceh[1ilOERVi2F>MqJIusX,v8}~62#",x,"")
while(++i<96){c=x[i];c in d||d[c]=p substr(p,1,1)
p&&d[sprintf("%c",n++)]=p substr(d[c],1,1)
printf p=d[c]}}

```

# Answer
> 1 votes
# ///, ~~171~~ 166 bytes

5 bytes saved because I was using `\r\n` in the source, lol.

```
/-/  //,/!!//'/**//&/*"//%/--//#/,,,,,!*//"/%-//!/''/"% &""" *
" !"%*% &%!
% !""!'&"!
- !*&"!'&"!'
-,&- ,&- ,*
 #'
!#
!#
!#
 #'
-!& ,,!& !*
%!" '*%!*%'& !
" *& &'&& '

```

Try it online!

Compressed by using successive iterations of replacing the "most economical" substrings with a single character. This is nearly optimal, though one of two things could be the case:

1. I could get away with using some meta replacements (e.g. dynamically insert regexes)
2. It is somehow more beneficial to replace less economical substrings first (unlikely).

# Answer
> 1 votes
# braingasm, 187 bytes

`XXX` represents a string of 154 mostly unprintable bytes (here's a hexdump of the whole program).

```
"XXX",76[->$[<s[32.]z[42.]q[10.]>]>]

```

The string is is dumped onto the tape and its bytes are read in pairs in a sort of run-length encoding scheme: The first byte is initially either `0`, `1` or `8`, but then decremented by one to become `-1`, `0` or `7`. Each of these numbers will only pass one of the following tests:

* `s` \- signed =\> print `32` (space)
* `z` \- zero =\> print `42` (asterisk)
* `q` \- prime =\> print `10` (newline)

The second byte of each pair is the number of times to print.

# Answer
> 1 votes
## JavaScript (ES6, no string encoding), 233 bytes

Golfed:

```
[[11,1,13],[7,4,10,1,3],[5,4,12,4],[3,6,12,4],[2,9,9,5],[1,24],[0,25],[0,25],[0,25],[1,24],[2,5,7,11],[4,4,7,3,4,3],[7,2,7,1,6,2]].map(a=>a.map((b,c)=>' *'[c%2].repeat(b)).join``).map(a=>a+a.split``.reverse().join``.slice(1)).join`
`

```

Ungolfed:

```
[
    [11, 1, 13],
    [7, 4, 10, 1, 3],
    [5, 4, 12, 4],
    [3, 6, 12, 4],
    [2, 9, 9, 5],
    [1, 24],
    [0, 25],
    [0, 25],
    [0, 25],
    [1, 24],
    [2, 5, 7, 11],
    [4, 4, 7, 3, 4, 3],
    [7, 2, 7, 1, 6, 2]
]
    .map(row => row
        .map((val, idx) => ' *'[idx % 2].repeat(val))
        .join``
    )
    .map(str => str + str
        .split``
        .reverse()
        .join``
        .slice(1)
    )
    .join`
`

```

### Explanation

The matrix represents the left half of the logo as numbers of alternating character always starting with space, and including the middle character. Thus each list is a half-palindrome line, each number the number of times to repeat a character, and the parity of its index whether the character is a space (even) or asterisk (odd).

The first map replaces lists of numbers with lists of repeated characters and joins into a single string (per line).

The second map mirrors each string excluding the already-included middle character.

Lastly the lines are joined with newlines and the final result of the expression is the complete string, to be assigned or used as an argument.

### Demo

```
o.innerHTML = [[11,1,13],[7,4,10,1,3],[5,4,12,4],[3,6,12,4],[2,9,9,5],[1,24],[0,25],[0,25],[0,25],[1,24],[2,5,7,11],[4,4,7,3,4,3],[7,2,7,1,6,2]].map(a=>a.map((b,c)=>' *'[c%2].repeat(b)).join``).map(a=>a+a.split``.reverse().join``.slice(1)).join`
`
```

```
<pre id=o></pre>
```

# Answer
> 1 votes
## sed, 244 bytes

Alphabetic RLE. Uppercase letters encode stars, lower case encode spaces, underscores encode newlines. So 'A' -\> '\*', 'B' -\> '\**' etc. This script doesn't take advantage of the pattern's left-right symmetry, thus some of the strings are longer than 26 bytes; those strings are encoded using two letters.

```
s/.*/kAyAk_gDjAeAjDg_eDlGlDe_cFlGlFc_bIiIiIb_aZUa_ZW_YX_ZW_aZUa_bEgUgEb_dDgCdEdCgDd_gBgAfCfAgBg/;:L;y/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy/*ABCDEFGHIJKLMNOPQRSTUVWXY abcdefghijklmnopqrstuvwx/;s/[A-Z]/&*/g;s/[a-z]/& /g;tL;s/_/\n/g

```

I don't think it's possible to run sed without giving it a file to read. This program ignores the contents of the file you pass it, and prints a Batman symbol for each line in the file. The easiest way to invoke it in Bash is by passing it an empty here-string, eg:

```
sed<<<'' -f batman.sed

```

Or don't bother saving it to a file, just run it directly in the CLI:

```
sed<<<'' 's/.*/kAyAk_gDjAeAjDg_eDlGlDe_cFlGlFc_bIiIiIb_aZUa_ZW_YX_ZW_aZUa_bEgUgEb_dDgCdEdCgDd_gBgAfCfAgBg/;:L;y/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy/*ABCDEFGHIJKLMNOPQRSTUVWXY abcdefghijklmnopqrstuvwx/;s/[A-Z]/&*/g;s/[a-z]/& /g;tL;s/_/\n/g'

```

The annotated version:

```
# The compressed data string.
# Uppercase letters encode stars, lower case  encode spaces, underscores encode newlines
# Convert the current input line to the data string.
s/.*/kAyAk_gDjAeAjDg_eDlGlDe_cFlGlFc_bIiIiIb_aZUa_ZW_ZW_ZW_aZUa_bEgUgEb_dDgCdEdCgDd_gBgAfCfAgBg/

# Interpret letters as string lengths
# Start the loop
:L

# Transliterate each letter to the previous letter in alphabetical order,
# except 'A' goes to star and 'a' goes to space
y/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy/*ABCDEFGHIJKLMNOPQRSTUVWXY abcdefghijklmnopqrstuvwx/

# Append a star to an uppercase string
s/[A-Z]/&*/g

# Append a space to a lowercase string
s/[a-z]/& /g

# Goto the 'L" label at the top of the loop unless no `s` substitution
# was performed since the last goto
tL

# Convert underscores to newlines
s/_/\n/g

# The result is now printed, and execution returns to the start of the script
# to process the next input line, if it exists.

```

---

Here's a version that *does* take advantage of the pattern's left-right symmetry. However, it's longer than the previous program, since it uses a rather complicated loop to split off each half-line and combine it with its reversed version.

### sed, 261 bytes.

Needs the `-r` option on the commandline (or in the shebang), since it uses extended Regular Expressions.

```
s/.*/kAm_gDjAc_eDlD_cFlD_bIiE_aX_Y_Y_Y_aX_bEgK_dDgCdC_gBgAfB_/;:L;y/ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklm/*ABCDEFGHIJKLMNOPQRSTUVWX abcdefghijkl/;s/[A-Z]/&*/g;s/[a-z]/& /g;tL;:a;h;s/_.*//;s/^(.*)(.)$/\1@&@/;:x;s/(@.)(.*)(.@)/\3\2\1/;tx;s/@//g;p;g;s/[^_]*_//;ta

```

This script shares some logic with the previous code, but here's an annotated version of the section that does the palindromisation, which was derived from the code for reversing a string given in the sed info pages.

```
# Palindromise a series of words.

# Start the outer loop
:a
# Save the current pattern
h

# Remove everything after the 1st word
s/_.*//

# Palindromise a line.

# Begin embedding the line between two markers
# Also insert the line, except for the last char, before the 1st marker
s/^(.*)(.)$/\1@&@/

# Loop to reverse the chars between the markers
:x;s/(@.)(.*)(.@)/\3\2\1/;tx

# Remove the markers
s/@//g

# Print the palindromised result and restore the pattern
p;g

# Remove the word we just processed
s/[^_]*_//

# Goto to the 'a' label unless no `s` substitution was
ta

```

# Answer
> 1 votes
**Scala (169 chars)** (Based on @snowman's answer)

Golfed:

```
var b=false;";1I1074:151:4054<7<4036<7<6029999901_10a10a10a01_0257E570447345437407271636172".foreach{a⇒print((if(b) "*" else " ")*(a-48));if(a < 49)println()else b = !b}

```

Ungolfed:

```
object Batman extends App {
var b = false
 ";1I1074:151:4054<7<4036<7<6029999901_10a10a10a01_0257E570447345437407271636172".foreach { a ⇒
    print((if (b) "*" else " ") * (a - 48))
    if (a < 49) println() else b = !b
  }
}

```

# Answer
> 1 votes
**C# (.NET Core), ~~312~~ 280 bytes**

An improvement (?) on **this by Carlos Alejo**.

Uses smaller (int32 instead of int64) constants for initial "bitmap", uses an int (z) on the redundant entries (5 wide bands in middle), uses reflection technique to mirror the partial output.

Downside: requires a *using System;* statement in the header.

```
()=>{var s="";int z=33554431;foreach(var i in new[]{8192,245768,983055,4128783,8372255,z/2,z,z,z,z/2,8128511,1966983,196867}){s+=Convert.ToString(i,2).PadLeft(25,' ').Replace('0',' ').Replace('1','*');for(int j=s.Length-2;j>=s.Length-49;j--)s+=s.Substring(j,1);s+='\n';}return s;}

```

Try it online!

The trick with using a var for the redundant lines is from this by **Hagen von Eitzen**. Problem with that answer is that the output is incorrect, only 47 chars wide instead of 49.

If **Carlos Alejo** used that trick on his answer, the score would go down to 278:

```
()=>{var s="";var z=(1L<<49)-1;foreach(var i in new[]{0x2000000800,0x3c008200780,0xf000fe001e0,0x3f000fe001f8,0x7fc01ff007fc,z/2-1,z,z,z,z/2-1,0x7c07ffffc07c,0x1e0387c380f0,0x30103810180})s+=Convert.ToString(i,2).PadLeft(49,'0').Replace('0',' ').Replace('1','*')+'\n';return s;}

```

Try it online!

# Answer
> 1 votes
# Self-modifying Brainfuck, 700 bytes

```
<<...........>.<.........................>.<<.>.......>....<..........>.<.....>.<..........>....<<.>.....>....<............>.......<............>....<<.>...>......<............>.......<............>......<<.>..>.........<.........>.........<.........>.........<<.>.>...............................................<<.>>.................................................<<.>>.................................................<<.>>.................................................<<.>.>...............................................<<.>..>.....<.......>.....................<.......>.....<<.>....>....<.......>...<....>.....<....>...<.......>....<<.>.......>..<.......>.<......>...<......>.<.......>..
 *

```

Try it online!

Yes. This can probably be golfed. Do I want to though? Oh please no.

# Answer
> 1 votes
# tcl, ~~325 317 303 302 300~~ 299

Still very long:

```
proc F {n\ 5} {format %$n\s *}
proc R {n\ 49} {string repe * $n}
puts "[F 12][F 26]
[set f [F 8]][set T ***][F 11][F 6][F 12]$T
[F 6][set M $T[F 13]$T$T[F 13]]$T
   $T$M[R 5]
  [R 9][set H [F 10][R 8]]$H
 [R 47]
[R]
[R]
[R]
 [R 47]
  [R 5]$f[R 20]$f*$T
[F]$T$f**[F]*$T[F]**$f$T
$f*$f[F 7]**[F 7]$f*"

```

# demo

# Answer
> 1 votes
# Bubblegum, 70 bytes

```
00000000: cd8b a501 c000 10c4 fc4d f13a fbef 574e  .........M.:..WN
00000010: 195d a30e 6b81 ba82 2880 ddc1 9b75 54e6  .]..k...(....uT.
00000020: fab3 2856 6fc6 10c5 d2de 2629 be11 f8e3  ..(Vo.....&)....
00000030: a33e 1fc6 478d 20b2 efa2 5a42 13c5 d210  .>..G. ...ZB....
00000040: 350a bdc2 9c16                           5.....

```

Try it online!

# Answer
> 1 votes
# C (gcc), ~~170~~ ~~169~~ 160 bytes

-9 bytes thanks to ceilingcat.

```
char*s="1Q111O19Q81ii81imP1mopppppppppppppppopppm2mpa4ia17AQ",o[50];main(i){for(;*s;s+=4,o[24]=o[23],puts(o))for(i=24;i--;)o[i]=o[48-i]=s[i/6]-49>>i%6&1?42:32;}

```

Try it online!

# Answer
> 1 votes
# Befunge, 139 bytes

I know this is a bit late now, but I wasn't around at the time the challenge was initially posted, and this looked like it would be a fun problem to solve in Befunge.

```
"YaA(!"***+"3{~X"7**+*"e~#"+*32223"a}|V"*+*v>,\2/34g1-:v:*55\+55\0-2<
_@#:*+** "+Ewn_"**+*"^iw/C"+*83:*9+**"+9_t"<^:g\8%2:p43_$$$>>:#,_$:#^

```

Try it online!

**Explanation**

We start by pushing thirteen integers onto the stack, whose bits represent half of the pattern of the bat (the other half being a reflection). Each of these integers is offset by two, since that makes their Befunge representations slightly more compact.
We then start the main loop, which will process one line/integer at a time. We subtract two to account for the offset, and we push push a null terminator and a newline onto the stack for later use when writing out the second half of the line.
Next we get to the inner loop which iterates over the 25 bits in the number, taking the value mod 2 to extract a bit, and performing a table lookup on column 8 of the source () to obtain the character to output. The character is also pushed onto the stack for later use.
Once this loop is complete, the first half of the line has been output, and the characters for the second half are in place on the stack in reverse order. We then simply output those characters with a standard string output sequence, and return to the start of the main loop.

# Answer
> 1 votes
# Taxi, 793 bytes

```
"           *                         *\n       ****          *     *          ****\n     ****            *******            ****\n   ******            *******            ******\n  *********         *********         *********\n ***********************************************\n*************************************************\n*************************************************\n*************************************************\n ***********************************************\n  *****       *********************       *****\n    ****       ***    *****    ***       ****\n       **       *      ***      *       **" is waiting at Writer's Depot.
Go to Writer's Depot:w 1 r 3 l 2 l.
Pickup a passenger going to Post Office.
Go to Post Office:n 1 r 2 r 1 l.
Go to Taxi Garage:n 1 r 1 l 1 r.

```

Try it online!

I would have hoped that something more fun than the naive solution would have been shorter.

# Answer
> 1 votes
# Vyxal `j`, 53 bytes

```
»&jṗ∧∴NżZ8D=→JβW↳z\T□≬'₴5≬≥ėĿwq`÷6bḭ⟑AjẎyt»‛* τ13/vøm

```

Try it Online!

# Answer
> 0 votes
# T-SQL, 212 bytes

I wonder if I get extra bonus for making my script unreadable

**Golfed:**

```
DECLARE @x
bit=0,@ varchar(max)='=3Ke96<373<h76>9>h58>9>j4;;;;m3adcdcdcdad2479G9i669567659h9493858394'WHILE'!'<@
SELECT @=stuff(@,1,1,'')+replicate(char(32+10*@x),ascii(@)%50)+iif(ascii(@)>99,'
',''),@x-=1PRINT @

```

The way this works. The script takes a varchar and loop it for each character. The result is appended to the end of the varchar. The bit gets flipped every time the loop runs. This bit determine which character gets chosen.

Every character represents a number and will also include a line change when the ascii value is above 100+. The ascii value of each character determine how many characters to repeat(maximum 49).

values explained

> 2=ascii-50 produce 0 char no linebreak
>
> 3=ascii-51 produce 1 char no linebreak
>
> :=ascii-60 produce 8 char no linebreak
>
> d=ascii-100 produce 0 char linebreak
>
> f=ascii-102 produce 2 char linebreak

**Ungolfed:**

```
DECLARE
  @x bit=0,
@ varchar(max)='=3Ke96<373<h76>9>h58>9>j4;;;;m3adcdcdcdad2479G9i669567659h9493858394'
WHILE @>'!'
  SELECT
    @=stuff(@,1,1,'')+
    replicate(char(32+10*@x),ascii(@)%50)+iif(ascii(@)>99,'
',''),
    @x-=1
PRINT @

```

**Try it online** ungolfed version

# Answer
> 0 votes
# Stax, 43 bytes

```
¬H∙☼ßú¶ε╥M9rx⌠ªÅ`Fm■♦▓dL∩BF╚3♣æ7~εåIZ▼•sÿ4ú

```

Run and debug it

It's just the left-half, run-length encoded and then mirrored.

# Answer
> 0 votes
# Python 3, 234 224 bytes

-10 bytes thanks to @Blue

```
for i in range(637):print(' *'[0x301038101800F01C3E1C0781F01FFFFF01F1FFFFFFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFFFFC7FC01FF007FC1F8007F000FC03C003F800780078010400F00002000000800>>i&1],end=['\n',''][(i+1)%49>0])

```

Try it online!

I made this version before searching through all the answers. It's different to all the other python answers, but definitely longer. As far as I can see, I'm using a different method to all of them, using bit shifting.

# Answer
> 0 votes
# Julia, 177 bytes

```
println.(prod(get.(" ",reshape([fill.((1:38).%2,[11,1,20,4,10,1,8,4,12,4,3,6,12,4,2,9,9,5,1,99,1,24,2,5,7,11,4,4,7,3,4,3,7,2,7,1,6,2])...;],25,:),'*')[[1:25;24:-1:1],:],dims=1))

```

Stores only the left half encoded as the numbers of chars until the char changes. Could probably be improved upon with a better encoding.

Try it online!

# Answer
> 0 votes
# Duocentehexaquinquagesimal, ~~523~~ 139 bytes

```
IŸcÓ|»lì8тï₃"—"šÙ‹çnFÙ}Xíâµ∞A!pβòΩž>qLqÖlŒηεÅBO&ô-}Ü˜āÅ„Å¢Úā´ÏΛ¯—¨ïAÚ∞·ÏÆµŸ9ße³āEΔëнj'`Ï×"ë‡LkYмâÿÒAE;ýäÇη¼ÉÊÌg¡θ’A(wBlΣ<–£¼–7₄:*Â3
Åö0δÂ¬ë

```

Try it online!

# Answer
> 0 votes
# Zsh (+coreutils basenc), 164 bytes

Try it online doesn't have `basenc`; but you can see how it works by passing the string to this site. Choose `text | decode:Ascii85:z85 | bytes:binary:none`.

Similar to my Arecibo answer; I first encoded the bat logo into binary then converted to z85. This yielded a string of length 101. The below script decodes the z85-encoded string and turns `1`,`0` into `*`, (space).

```
basenc -d --z85<<<'01Ybg1onC>0TF?+0Pj1R06ywM0r8%uGz>(JFiS8]%nSc0}#uY@%nSc0%nSc0%nS
c0%nSbl%nSc0%bRZg%m^aQ&5D9z4/^BL90=@M'|basenc --base2msbf -w49|head -13|tr 01 ' *'

```

code formatted slightly for readability

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