【JavaScript】お手軽？に循環Quineアートを作る

## 前回のやつ

https://qiita.com/mogamoga1337/items/27a49e164c8a17bd4f87

## 何がしたいのか？

通常のQuineはAを出力するA自身を出力する。
つまりこんな感じ。
A → A → A → A → …

これを以下のように循環するようなQuineを作りたい。
A → B → A → B → …

## というわけで作ってみた

![q.gif](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/649673/5cda8b8e-d055-1c35-f6dc-a028c8851776.gif)

```js
                                         /*sorehaboku
                               nozundamotinanodasorehabokunozun
                         damotinanodasorehabokunozundamotinanodasoreh
                     abokunozundamotinanodasorehabokunozundamotinanodasor
                  ehabokunozundamotinanodasorehabokunozundamotinanodasorehab
               okunozundamotinanodasorehabokunozundamotinanodasorehabokunozunda
             motinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasore
          habokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinan
         odasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamo
       tinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundam
      otinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamot
    inanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinano
   dasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasoreh
  abokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozu
 ndamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinano
 dasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabok
unozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotin
anodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabo
kunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamoti
nanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehab
okunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamot
inanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasoreha
bokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamo
tinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasorehabokunozundamotinanodasoreh
 abokunozundamotinan*/i=1;s=`cc=String.fromCharCode;bq=cc(96);bs=cc(92);nl=cc(10);sp=cc(32);s
  1="i="+(i+1)%2+";s="+bq+s;s2=bq+".replace(/("+bs+"s|"+bs+"n)+/g,'');eval(s)";cm="";d=[2908
  ,1204][i]-s1.length-s2.length;if(d>3){cm="/*";for(j=0;j<d-4;j++)cm+="sorehabokunozundamoti
   nanoda"[j%27];cm+="*/"}s=cm+s1+s2;a=[[41,12,-1,31,32,-1,25,44,-1,21,52,-1,18,58,-1,15,64
     ,-1,13,68,-1,10,74,-1,9,76,-1,7,80,-1,6,83,-1,4,86,-1,3,88,-1,2,90,-1,1,92,-1,1,92,-1
      ,0,94,-1,0,94,-1,0,94,-1,0,94,-1,0,94,-1,0,94,-1,0,94,-1,0,94,-1,1,92,-1,2,90,-1,2
       ,90,-1,3,88,-1,5,85,-1,6,82,-1,7,80,-1,9,76,-1,11,72,-1,13,68,-1,16,62,-1,19,56,
         -1,22,50,-1,27,41,-1,31,33,-1],[40,4,-1,39,6,-1,37,9,-1,35,13,-1,34,15,-1,33
           ,17,-1,31,21,-1,30,23,-1,28,27,-1,27,29,-1,25,33,-1,24,35,-1,22,39,-1,21
             ,41,-1,19,45,-1,18,47,-1,16,51,-1,15,53,-1,13,57,-1,12,59,-1,10,63,-
                1,9,65,-1,8,67,-1,6,71,-1,4,75,-1,3,77,-1,2,79,-1,0,83,-1]][i]
                   ;spf=true;t="";st=0;a.forEach(e=>{if(e<0){t+=nl;spf=true
                      ;}else{if(spf){t+=sp.repeat(e);}else{t+=s.slice(st
                           ,st+e);st+=e;}spf=!spf;}});console.log(t)
                               `.replace(/(\s|\n)+/g,'');eval(s)
```

これを実行すると以下が出力される。

```js
                                        /*so
                                       rehabo
                                     kunozunda
                                   motinanodasor
                                  ehabokunozundam
                                 otinanodasorehabo
                               kunozundamotinanodaso
                              rehabokunozundamotinano
                            dasorehabokunozundamotinano
                           dasorehabokunozundamoti*/i=0;
                         s=`cc=String.fromCharCode;bq=cc(9
                        6);bs=cc(92);nl=cc(10);sp=cc(32);s1
                      ="i="+(i+1)%2+";s="+bq+s;s2=bq+".replac
                     e(/("+bs+"s|"+bs+"n)+/g,'');eval(s)";cm="
                   ";d=[2908,1204][i]-s1.length-s2.length;if(d>3
                  ){cm="/*";for(j=0;j<d-4;j++)cm+="sorehabokunozu
                ndamotinanoda"[j%27];cm+="*/"}s=cm+s1+s2;a=[[41,12,
               -1,31,32,-1,25,44,-1,21,52,-1,18,58,-1,15,64,-1,13,68
             ,-1,10,74,-1,9,76,-1,7,80,-1,6,83,-1,4,86,-1,3,88,-1,2,90
            ,-1,1,92,-1,1,92,-1,0,94,-1,0,94,-1,0,94,-1,0,94,-1,0,94,-1
          ,0,94,-1,0,94,-1,0,94,-1,1,92,-1,2,90,-1,2,90,-1,3,88,-1,5,85,-
         1,6,82,-1,7,80,-1,9,76,-1,11,72,-1,13,68,-1,16,62,-1,19,56,-1,22,
        50,-1,27,41,-1,31,33,-1],[40,4,-1,39,6,-1,37,9,-1,35,13,-1,34,15,-1
      ,33,17,-1,31,21,-1,30,23,-1,28,27,-1,27,29,-1,25,33,-1,24,35,-1,22,39,-
    1,21,41,-1,19,45,-1,18,47,-1,16,51,-1,15,53,-1,13,57,-1,12,59,-1,10,63,-1,9
   ,65,-1,8,67,-1,6,71,-1,4,75,-1,3,77,-1,2,79,-1,0,83,-1]][i];spf=true;t="";st=
  0;a.forEach(e=>{if(e<0){t+=nl;spf=true;}else{if(spf){t+=sp.repeat(e);}else{t+=s
.slice(st,st+e);st+=e;}spf=!spf;}});console.log(t)`.replace(/(\s|\n)+/g,'');eval(s)
```

さらにこれを実行すると最初の円形のプログラムが出力される。

https://wandbox.org/permlink/A9dNTygBHzQLroOz

https://wandbox.org/permlink/3h8MGrI17Pgyu15l

## 追記

replace(/(\s|\n)+/g,'')はreplace(/(\s|\n)/g,'')でいいです。
直すが面倒なのでメモだけしときます。

## 解説

```js
// 形状を切り替える変数
// 0だと円形、1だと三角形になる。
i = 0;

// evalで評価するプログラムの文字列
// アートにする都合でぐちゃぐちゃになるが、
// 最後のreplaceで半角スペースと改行を空文字に置換しているので問題ない。
s = `
/* 特殊文字とか */
cc = String.fromCharCode;
bq = cc(96);
bs = cc(92);
nl = cc(10);
sp = cc(32);

/* 実際に出力する文字列を作っている箇所 */
/* iを切り替えているところがミソ */
s1 = "i=" + (i + 1) % 2 + ";s=" + bq + s;
s2 = bq + ".replace(/(" + bs + "s|" + bs + "n)+/g,'');eval(s)";

/* アート用の文字数が足りないので、文字数埋め用のコメントを足しておく。*/
cm = "";
d = [2908,1204][i] - s1.length - s2.length;
if (d > 3) {
    cm = "/*";
    for (j = 0; j < d - 4; j++) cm += "sorehabokunozundamotinanoda"[j % 27];
    cm += "*/"
}
s = cm + s1 + s2;

/* アートの情報 */
/* 半角スペースと文字が連続する箇所の文字数の配列 */
/* -1は改行 */
a = [
        [
            41, 12, -1, 31, 32, -1, 25, 44, -1, 21, 52,
            -1, 18, 58, -1, 15, 64, -1, 13, 68, -1, 10,
            74, -1,  9, 76, -1,  7, 80, -1,  6, 83, -1,
             4, 86, -1,  3, 88, -1,  2, 90, -1,  1, 92,
            -1,  1, 92, -1,  0, 94, -1,  0, 94, -1,  0,
            94, -1,  0, 94, -1,  0, 94, -1,  0, 94, -1,
            0,  94, -1,  0, 94, -1,  1, 92, -1,  2, 90,
            -1,  2, 90, -1,  3, 88, -1,  5, 85, -1,  6,
            82, -1,  7, 80, -1,  9, 76, -1, 11, 72, -1,
            13, 68, -1, 16, 62, -1, 19, 56, -1, 22, 50,
            -1, 27, 41, -1, 31, 33, -1
        ],
        [
            40,  4, -1, 39,  6, -1, 37,  9, -1, 35, 13,
            -1, 34, 15, -1, 33, 17, -1, 31, 21, -1, 30,
            23, -1, 28, 27, -1, 27, 29, -1, 25, 33, -1,
            24, 35, -1, 22, 39, -1, 21, 41, -1, 19, 45,
            -1, 18, 47, -1, 16, 51, -1, 15, 53, -1, 13,
            57, -1, 12, 59, -1, 10, 63, -1,  9, 65, -1,
             8, 67, -1,  6, 71, -1,  4, 75, -1,  3, 77,
            -1,  2, 79, -1,  0, 83, -1
        ]
    ][i];

/* 上記のアートの情報から出力する文字列を加工する。*/
spf = true;
t = "";
st = 0;

a.forEach(e => {
    if (e < 0) {
        t += nl;
        spf = true;
    }
    else {
        if (spf) {
            t += sp.repeat(e);
        }
        else {
            t += s.slice(st, st + e);
            st += e;
        }
        spf = !spf;
    }
});

/* いざ、出力 */
console.log(t)
`.replace(/(\s|\n)+/g,'');

// 実行
eval(s)
```

## おまけ

![znd.gif](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/649673/84b18dc5-5232-c8ff-a30b-6715e0ad5494.gif)


```js
            /*so
           re  haboku*/i=1;s=`cc=Str
          in                        g.fr
          om      Ch     ar              Co                       de;bq=cc(
           96      );bs=c c(    92 );      nl                  =cc         (10);sp
            =c             c(32)   ;s  1=   "i               ="                   +(
             i+                     1)%     2+";s="+bq+s;s2=bq+"       .r  ep lace(/(
              "+b                              s+    "s        |"+bs+   "n) +/g,'') ;e
                 val(s)/                    /z       un           da  mo           n"
                      ;cm="";d=[31  42     ,3         18            1]  [i       ]-
                    s1 .l  en  gt h-     s2          .l               en   gth;i
                   f(    d>    3){       cm          ="                /*   ";                   for(j=0;
                  j<    d-    4;j       ++          )cm+               ="    so                  rehabok
                 un     oz   und        am          ot in              ano    da                 "[j%27
                 ];    cm   +="*        /"        }s=cm+s1+           s2 ;a   1=                 ["c4$b
                22     l$  a2o4        $a        26       25         2e2n9$b  26                 612421
                26     2i  397$        c2      d5          32       22     32 f2                 j2$d2
                l3     5k 72 22        17    $e 3u2428633   17    12$h7k27 2b 22                 2b2$m
                c2     25 29  2c       22272 $k2 12    22    22  1252    a2 f23                   5$j
                24      2437   2a       2g   23  2j    8$      i2   42   43 72
                 a4     f2 42   i7        $h 25   23   38            2a21  2e                    342
                  h6     $h 24    234      82 89   b2123                   2h                   6$g25
                  22      48 28    2729     72                             2h                    6$g
                   25      22  482  62 a27    25                            21
                     2h      5$   g252    121282              4219324       81
                       21    2h5     $g2                                 521
                        222   7513   12 42                           4224
                          42   13 j3 $g 26  432723           2224262
                            3232 12$h2  52  123   282123232c4 22 k3
                                $i2  521243  62          12  35j2
                                    j5$i262124452t       2k3
                                     $j2622322    1342s2$l2623446
                                  e77          2$  n2 43     53x3$o
3343212r4$q23212121226b7$s415222 33              b1   212$w3262  2a 22
4$#10e73$#1194f$y3a2221256$0w1 2e                23   92  212$0   u1 2g23
2253214$0u12a252322212321212$0 t1          2c     25   23  2a 21   22 2$ 0s
12d26232a2122215$0q12e27232b2 12            22     18   $0          q1 2e  28
232b212221b$0q12d29232c2141g $0             q1      2c   2b          23 2b  21 2221i
$0s1dc242b212321e1#1b$0p14 a2              b2       6f   22           22 1c  1# 1c$0m133
2b23635e312221a1#1d$0k1272 c3              95        e3   32           13 1p  1w $0j1293c2cl
23r31t$0i128323b534l2x21r$ 0i             12         62   82            e3 r2s7 1p$0i1252b2b2v2p
2341o$0j12j362y2n222331m$0 k1            2h           22   6i           g3 2m  21 2721k$121212121212
1312d2121212g3h212k212a21212 12121212$0o1d            17    12           d3 4f   22 12j212b21h$0#1 912d242f213j222b21h$0#1912c232i5j212c21h$0#1a12
b222k4i212e21g$0#1b12a222 k4i2          12           e2      1g$0#1c129222l2  k3  f2 1g$0#1d12922 2k2g512f21f$0#1e138222ji1412f21f$0#1h1ek21k12f21
e$0#1t12k21k12f21e$0#1 t12   k2           1k   12f21e   $0#1t              12k qf  h$ ","d4$b24c $a2ha#1z242$a272i3#1w21b$a27242124272#1t34242$b28
432421263kbs4123242$ c2       e6            426         2g4b8              p2$   e3 l45 hn2o2$h4r2c5722425o2$l4l2 h6323614n2$l3262372m232c2$j26232
82b2d23282$i2523392 b2         e23            9r            252$h2523392a3g232x25  2$g                           252 3392a212g232w252$f2523482a222
g233#122$f2522482a 41        2g2  42#           112$e   2621                     21                                 27 2a234d443w4$e2521222727292b
32224$e2521222725b 42      83        24              121                           2$                            e252123 272251242424a111472o2$e26
212326242134264222 11     21           21           28                               4j                         b$   e262 125252322242c22112121346
36f2$f2621253422236 d2                   211      22                                  31                       24  85   29c $g26222321422p41223123
212a2d2$h263122263u2 43                 72  66ab$j                  25324la823292641   28                      23 2$       k2 5343j26282e2b295$m32
 21 33 3j 66 4$ p4 523 7j             5m 3n 2$ q2                333                 42 26                    ft 3k          2$ r2 12 23 21 32 a2
1222#1bg$t21512122282z8j 2$yh35#122g6$ 0u13822 51             212    15w2h223$0s12c2  32 26                   22 12           s5 42b5$0r12e2422522
22o344g2$0r12f24212232224#1a2$0q12h242a22212u 3$             0p    12               i2 52b                   21  21           2s 3$0n12e25242c2122
215j3$0n12d26252c2122217e3$0m12d27252c2221218 c3            $0   l1                  5b282                   52 c2            25 17a3$0l123ca252c2
123216$0j15b2766f22321653$0e1542b23375f3123216 $0           c1  28                    3c4a                  5f 32              23 2141#1k$0b127222
c2#1223q1z$0b125252d2ig25r31v$0b124284b34bg2z31 s$          0b  12                    i3b5                  s2 w6              1q $0b12k3b3u2s2521
p$0c12j21353y3p2271o$121212121112f2121116hh42n22 26         31  21                     21                    212               12 1212$0g13661812g
3h322m212921k$0j161d12f25f2212l212b21j$0#1412e233 f2         12  12                    j2                22c21 i$               0# 1412d222j412i22
2e21h$0#1512c212l311j222e21h$0#1612b212m211j212f21 h$0        #1  71                   2a213l4k4f21h$0#18 1292 42               j3 l4g21g$0#1a1283
22j2k21112g21f$0#1c1383km1312g21f$0#1f1bl21n12g21e$0# 1o12l21n12g21e                    $0 #1o12l21rfh$"][i];a2 =[               ]; j=0;while(j<a1
.length){c=a1[j];if(c==="$"){a2.push(-1);}else{if(c==="#"){a2.pus h(                    pa rseInt(a1[++j]+a1[++ j]               ,3 6));}else{a2.p
ush(parseInt(c,36));}}j++;}spf=true;t="";st=0;a2.forEach(e=>{if(e <0                    ){ t+=nl;spf=true;}else {i               f( spf){t+=sp.rep
eat(e);}else{t+=s.slice(st,st+e);st+=e;}spf=!spf;}});console.log( t)                    `.replace(/(\s|\n)+/g,'');               eval(s)//zundamon
```

```js
             /*so
           re    habokunozund
          am                 otinanodas                                                                       or    eh
          ab       ok                  uno                                                                    zu ndamotin*/i
          =0       ;s    =` cc    =S       tr                                                                 ing    .f    ro
           mC        harC   od    e; bq      =cc                    (96);bs=cc(                            92); nl   =c    c(
            10              );sp=c    c(      32                );s1           ="i="+(i                         +1
              )%2                     +";s     ="+bq+s;s2=bq+".r                       ep                        la
                 ce(/                           ("            +bs+"       s|  "+bs  +"n)+                        /g
                     ,'')                     ;e                 val(s)   //   zundam on";                       cm
                     =""  ;d=[31  42,       31                      81   ][            i]
                   -s      1.   le        ng           th             -s   2.        le
                  ng     th   ;if         (d           >3              ){   cm="/*";f                           or     (j
                 =0     ;j   <d-         4;          j++                )c   m+                                 ="     so
                re     ha   bok         un          oz un                da   mo                                ti     na
               no     da   "[j%        27          ];  cm                +=   "*/                                      "}
               s=     cm  +s1+        s2          ;a1= ["                c4    $b                                     22
              l$      a2 o4 $a       26          25   2e2n             9$b2    661                                2421
              26     2i 39  7$       c2       d5         32           223  2f  2j2$
              d2     l3 5k  72       22     17$e3u24286    33        171  2$h7 k2 72
              b2     22 b2   $m       c2  25292 c2    22    72    $k21222221 2 52a2       f2                        35
              $j      24 24   37      2a    2g 232    j8      $i24  24  3 72 a4 f2        42i7                   $h2523382a2
              12      e3 42     h6     $h   24  23    48            28  9 b2 12 32h    6$g252   248282               72
               97      22 h6     $g2    52  24   8262a2             72  5 21  2h5 $g    25212128     24         21932481212h
                5$      g2  52   12 2275  13                         1242 42  244 21   3j 3$          g2             64
                 32      723 22  24      262                              32    321       2$      h25212          3282123232c
                   42     2k3  $i25                     2124362123        5j   2j         5$      i262 12        44   52
                    t2     k3$    j26                   22      32        21              34           2s         2$l26
                      234  46 e77   2$n                   24353x      3$o3
                         3432     12   r4$q232                   12121                      226                       b7
                          $s   415   2223  3b      1212$w32622a224                             $#1                    0e
                           73 $#  119  4   f$          y3 a2  22                                               1256$0w12e239221
                             2$ 0u12g 23 22  53        21                                   4$0u12a2                   52
                                  322212321212$0t12   c2523                                      2a                21222$
0s12d26232a2122215$0q12e27232b 212        22  18$0q 12 e2 8232b                                21                 22  21b
$0q12d29232c2141g$0q12c2b232 b2            12   22  1i$0s1  dc 24                            2b212    32           1e1#1
b$0p14a2b26f22221c1#1c$0m13 32              b2    36  35e31  22  21                        a1#    1d$0                k1
272c395e332131p1w$0j1293c2c l2               3r    31 t$  0i1  28  323b                                              53
4l2x21r$0i126282e3r2s71p$0 i1                 25    2b          2b  2v 2p                              234
1o$0j12j362y2n222331m$0k1 2h                  22     6i           g3 2m 21                            272
1k$1212121212121312d212 12              12     g3    h2            12 k2  12 a2121                   212
121212$0o1d1712d34f2212 j2             12      b2     1h            $0 #1  91 2d242f2              13j
222b21h$0#1912c232i5j2 12             c2       1h     $0            #1  a1 2b 222k4i21            2e2
1g$0#1b12a222k4i212e2 1g$0#           1c        12     92            22  l2k3f 21g$0#1          d12
9222k2g512f21f$0#1e13 82   22ji1412f21f          $0     #1            h1 ek   21 k12f21
e$0#1t12k21k12f21e$ 0#1t1           2k       21k12f      21e$0#1t12kqfh$  ",   "d 4$b24c     $a2
ha#1z242$a272i 3#1w2    1b           $a   272       42124               272 #1   t3 4242$b
28432421263k bs        412            3242          $c2e6               426  2g   4b 8p2$ e3l45hn2o2$h4r2c5722425o2$l4l2h6323614n2$l3262372m232c2$
j2623282b2d 23       28  2$            i2                                      52   3392b2e239r252$h2523392a3g 232x252$g2523392a212g232w252$f25234
82a222g233# 12     2$     f2             52                  2482a412g242#112  $e262                           121 272a234d443w4$e2521222727292b32
224$e252122 27    25        b428           324    1212$e25212                32                                   722 51242424a111472o2$e262123262
42134264222 11                  212           1284j                            b$                                e26212 5252322242c2211212134636f2
$f262125342 22                    36d           221                              12                            23     12 48529c$g26222321422p41223
123212a2d2$h 26                   31 222     63u                                  243                         72  66ab$j2 5324la82329264128232$k25
 34 3j 26 28 2 e2               b2 95 $ m32213                 33j664$p45237j5m3    n2                       $q  23      334 22 6f t3 k2 $r 21 22
32132a21222#1bg$ t21      512122 282z8j2$ yh                35#                 122  g6                      $0 u1         38 225121215w2h223$0s12
c232262212s542b5$0r 12e242 252222o344g2$ 0r               12     f24212232224#1a  2$ 0q                     12 h2           42 a22212u3$0p12i252b2
1212s3$0n12e25242c2122215j3$0n12d26252c2 12              22   17e               3$ 0m 12                   d2  72            52 c2221218c3$0l15b28
252c22517a3$0l123ca252c2123216$0j15b2766 f2             23  21                   653$ 0e                  15  42              b2 3375f3123216$0c12
83c4a5f32232141#1k$0b127222c2#1223q1z$0b1 25            25 2d                     2ig 2                   5r  31              v$ 0b124284b34bg2z31
s$0b12i3b5s2w61q$0b12k3b3u2s2521p$0c12j213 53           y3 p2                      27 1                   o$ 12               12 12121112f2121116h
h42n2226312121212121212$0g13661812g3h322m21 29          21 k$0                     j161                    d12f               25 f2212l212b21j$0#1
412e233f21212j222c21i$0#1412d222j412i222e21h $0         #1    51                   2c2                     12l3                11 j222e21h$0#1612b
212m211j212f21h$0#1712a213l4k4f21h$0#18129242j 3l        4g2  1g                   $0                    #1 a 12                83 22j2k21112g21f$
0#1c1383km1312g21f$0#1f1bl21n12g21e$0#1o12l21n12 g21        e$0                    #1o12l21rfh$"][i];a2=[ ];j =0                ;w hile(j<a1.lengt
h){c=a1[j];if(c==="$"){a2.push(-1);}else{if(c==="#" ){a2.push(p                     ar seInt(a1[++j]+a1[++j],3 6)                ); }else{a2.push(
parseInt(c,36));}}j++;}spf=true;t="";st=0;a2.forEach(e=>{if( e<                     0) {t+=nl;spf=true;}else{i f(                sp f){t+=sp.repea
t(e);}else{t+=s.slice(st,st+e);st+=e;}spf=!spf;}});console.l og                     (t )`.replace(/(\s|\n)+/g,'');               eval(s)//zundamon
```

https://wandbox.org/permlink/zRtG8CGHMCPJkLBO

https://wandbox.org/permlink/aLZfySIYTEcSIWhE

文字数埋めに一役買ってくれるソファ君ほんとすこ

一応、きれいなコードが読みたい人用に整形したソースを貼っておく。

```js
i = 0;
s = `
cc = String.fromCharCode;
bq = cc(96);
bs = cc(92);
nl = cc(10);
sp = cc(32);

s1 = "i=" + (i + 1) % 2 + ";s=" + bq + s;
s2 = bq + ".replace(/(" + bs + "s|" + bs + "n)+/g,'');eval(s)//zundamon";
cm = "";
d=[3142, 3181][i] - s1.length - s2.length;
if (d > 3) {
    cm = "/*";
    for(j = 0; j < d - 4; j++) cm += "sorehabokunozundamotinanoda"[j % 27];
    cm += "*/"
}
s = cm + s1 + s2;

a1 = [
    "c4$b22l$a2o4$a26252e2n9$b26612421262i397$c2d5322232f2j2$d2l35k722217$e3u24286331712$h7k272b222b2$mc225292c22272$k21222221252a2f235$j2424372a2g232j8$i2424372a4f242i7$h2523382a212e342h6$h242348289b21232h6$g252248282729722h6$g252248262a2725212h5$g252121282421932481212h5$g25212227513124242244213j3$g264327232224262323212$h252123282123232c422k3$i2521243621235j2j5$i262124452t2k3$j26223221342s2$l2623446e772$n24353x3$o3343212r4$q23212121226b7$s41522233b1212$w32622a224$#10e73$#1194f$y3a2221256$0w12e2392212$0u12g232253214$0u12a252322212321212$0t12c25232a21222$0s12d26232a2122215$0q12e27232b2122218$0q12e28232b212221b$0q12d29232c2141g$0q12c2b232b212221i$0s1dc242b212321e1#1b$0p14a2b26f22221c1#1c$0m1332b23635e312221a1#1d$0k1272c395e332131p1w$0j1293c2cl23r31t$0i128323b534l2x21r$0i126282e3r2s71p$0i1252b2b2v2p2341o$0j12j362y2n222331m$0k12h226ig32m212721k$1212121212121312d2121212g3h212k212a2121212121212$0o1d1712d34f2212j212b21h$0#1912d242f213j222b21h$0#1912c232i5j212c21h$0#1a12b222k4i212e21g$0#1b12a222k4i212e21g$0#1c129222l2k3f21g$0#1d129222k2g512f21f$0#1e138222ji1412f21f$0#1h1ek21k12f21e$0#1t12k21k12f21e$0#1t12k21k12f21e$0#1t12kqfh$"
    ,"d4$b24c$a2ha#1z242$a272i3#1w21b$a27242124272#1t34242$b28432421263kbs4123242$c2e64262g4b8p2$e3l45hn2o2$h4r2c5722425o2$l4l2h6323614n2$l3262372m232c2$j2623282b2d23282$i2523392b2e239r252$h2523392a3g232x252$g2523392a212g232w252$f2523482a222g233#122$f2522482a412g242#112$e262121272a234d443w4$e2521222727292b32224$e2521222725b4283241212$e252123272251242424a111472o2$e26212326242134264222112121284jb$e262125252322242c2211212134636f2$f2621253422236d22112231248529c$g26222321422p41223123212a2d2$h263122263u2437266ab$j25324la82329264128232$k25343j26282e2b295$m3221333j664$p45237j5m3n2$q23334226ft3k2$r212232132a21222#1bg$t21512122282z8j2$yh35#122g6$0u138225121215w2h223$0s12c232262212s542b5$0r12e242252222o344g2$0r12f24212232224#1a2$0q12h242a22212u3$0p12i252b21212s3$0n12e25242c2122215j3$0n12d26252c2122217e3$0m12d27252c2221218c3$0l15b28252c22517a3$0l123ca252c2123216$0j15b2766f22321653$0e1542b23375f3123216$0c1283c4a5f32232141#1k$0b127222c2#1223q1z$0b125252d2ig25r31v$0b124284b34bg2z31s$0b12i3b5s2w61q$0b12k3b3u2s2521p$0c12j21353y3p2271o$121212121112f2121116hh42n2226312121212121212$0g13661812g3h322m212921k$0j161d12f25f2212l212b21j$0#1412e233f21212j222c21i$0#1412d222j412i222e21h$0#1512c212l311j222e21h$0#1612b212m211j212f21h$0#1712a213l4k4f21h$0#18129242j3l4g21g$0#1a128322j2k21112g21f$0#1c1383km1312g21f$0#1f1bl21n12g21e$0#1o12l21n12g21e$0#1o12l21rfh$"
][i];

a2 = [];
j = 0;
while (j < a1.length) {
    c = a1[j];
    if (c === "$") {
        a2.push(-1);
    }
    else {
        if (c === "#") {
            a2.push(parseInt(a1[++j] + a1[++j], 36));
        }
        else {
            a2.push(parseInt(c, 36));
        }
    }
    j++;
}

spf = true;
t = "";
st = 0;

a2.forEach(e => {
    if (e < 0) {
        t += nl;
        spf = true;
    }
    else {
        if (spf) {
            t += sp.repeat(e);
        }
        else {
            t += s.slice(st, st + e);
            st += e;
        }
        spf = !spf;
    }
});

console.log(t)
`.replace(/(\s|\n)+/g,'');
eval(s)
```

## 発展記事

https://qiita.com/mogamoga1337/items/0b211a90f39149ae12dc