Skip to main content
Commonmark migration
Source Link

#JavaScript (E6) 542 (572 - bonus 30) 553 564 576

JavaScript (E6) 542 (572 - bonus 30) 553 564 576

#JavaScript (E6) 542 (572 - bonus 30) 553 564 576

JavaScript (E6) 542 (572 - bonus 30) 553 564 576

added 57 characters in body
Source Link
edc65
  • 32.2k
  • 3
  • 36
  • 90

#JavaScript (E6) 553542 (572 - bonus 30) 564553 564 576

Bonus note The code for winning the 30 points bonus is 29 chars.

F=c=>(
    p='|',b=' ',d=b+b,t=d+b,l='------',
    S='substr',
    z="9X2X4XJ55O1-02Kz="9J2J4J55O102K |6|1E | J4|1R |1O3|3|2K2|3|3E1| J1|4R | O1|6| K2-01E55R"K201E55R".replace(/\d/g,n=>-nn=>n++?b.repeat(-~nn):ll='-------'),
    i=8i=7,
    console.log([c.split(b).map(c=>
      m==bm<d
        ?'b+l+l[S](1)+b -'+l+l+b
        :p+(c=='B'
          ?''* *''.repeat(7i)[S](i&1i,13)
          :c=='R'
            ?z[S](i,13)
            :(
               [,h,k]=c.match(/(.+)(.)/),
               k='♣♦♥♠'['CDHS'.search(k)], //uncommentcomment to showavoid the unicode symbols 
               n=h-1|0,
               s=t+t+t+(n>8?b:d),
               m-7
                ?m-8
                  ?m-9
                    ?d+p+(h>'A'
                      ?-m?m-6?m-3?t+b+t:t+h+t:t+t+k:k+t+t
                      :z[S](([64,1028,1092,8194,8258,8322,8326,9350,8802,9766][n]>>m*2&3)*7,7).replace(/XJ/g,k))+p+d
                    :t+'-'+l+t)+p+d
                  :s+k+ht+l+t
                :h+k+ss+k+h
              ):h+k+s
            )
       )+p
    ).join(b,i+=13)
  for(m of ' 79012345698 ')].join('\n'))
)

#JavaScript (E6) 553 564 576

F=c=>(
    p='|',b=' ',d=b+b,t=d+b,l='------',
    S='substr',
    z="9X2X4XJ55O1-02K |6|1E | J4|1R |1O3|3|2K2|3|3E1| J1|4R | O1|6| K2-01E55R".replace(/\d/g,n=>-n?b.repeat(-~n):l),
    i=8,
    console.log([c.split(b).map(c=>
      m==b
        ?' -'+l+l+b
        :p+(c=='B'
          ?' *'.repeat(7)[S](i&1,13)
          :c=='R'
            ?z[S](i,13)
            :(
               [,h,k]=c.match(/(.+)(.)/),
               k='♣♦♥♠'['CDHS'.search(k)], //uncomment to show the unicode symbols 
               n=h-1|0,
               s=t+t+t+(n>8?b:d),
               m-7
                ?m-8
                  ?m-9
                    ?d+p+(h>'A'
                      ?-m?m-6?m-3?t+b+t:t+h+t:t+t+k:k+t+t
                      :z[S](([64,1028,1092,8194,8258,8322,8326,9350,8802,9766][n]>>m*2&3)*7,7).replace(/X/g,k))+p+d
                    :t+'-'+l+t
                  :s+k+h
                :h+k+s
              )
         )+p
    ).join(b,i+=13)
  for(m of ' 79012345698 ')].join('\n'))
)

#JavaScript (E6) 542 (572 - bonus 30) 553 564 576

Bonus note The code for winning the 30 points bonus is 29 chars.

F=c=>(
  p='|',b=' ',d=b+b,t=d+b,
  S='substr',
  z="9J2J4J55O102K |6|1E | J4|1R |1O3|3|2K2|3|3E1| J1|4R | O1|6| K201E55R".replace(/\d/g,n=>n++?b.repeat(n):l='-------'),
  i=7,
  console.log([c.split(b).map(c=>
    m<d
      ?b+l+l[S](1)+b 
      :p+(c=='B'
        ?'* '.repeat(i)[S](i,13)
        :c=='R'
          ?z[S](i,13)
          :(
             [,h,k]=c.match(/(.+)(.)/),
             k='♣♦♥♠'['CDHS'.search(k)], //comment to avoid the unicode symbols 
             n=h-1|0,
             s=t+t+t+(n>8?b:d),
             m-7
              ?m-8
                ?m-9
                  ?d+p+(h>'A'
                     ?-m?m-6?m-3?t+b+t:t+h+t:t+t+k:k+t+t
                     :z[S](([64,1028,1092,8194,8258,8322,8326,9350,8802,9766][n]>>m*2&3)*7,7).replace(/J/g,k)
                   )+p+d
                  :t+l+t
                :s+k+h
              :h+k+s
            )
       )+p
    ).join(b,i+=13)
  for(m of ' 79012345698 ')].join('\n'))
)
deleted 42 characters in body
Source Link
edc65
  • 32.2k
  • 3
  • 36
  • 90

#JavaScript (E6) 564553 576564 576

F=c=>console.logF=c=>(
  (  p='|',b=' ',d=b+b,t=d+b,l='------',
    S='substr',  
    z="9X2X4XJ55O1-02K |6|1E | J4|1R |1O3|3|2K2|3|3E1| J1|4R | O1|6| K2-01E55R".replace(/\d/g,n=>-n?b.repeat(-~n):l),
    i=w=13i=8, 
    c=cconsole.log([c.split(b),
    [c.map(c=>
      m!=bm==b
        ?' -'+l+l+b
        :p+(c=='B'
            ?' *'.repeat(7)[S](i&1,w13)
             :c=='R'
             ?z[S](i-5,w13)
             :(
                [,h,k]=c.match(/(.+)(.)/),
                // k='♣♦♥♠'['CDHS'.search(k)], //uncomment to show the unicode symbols 
                n=h-1|0,
                s=t+t+t+(n>8?b:d),
                m-7
                ?m-8
                  ?m-9
                    ?d+p+(h>'A'
                      ?-m?m-6?m-3?t+b+t:t+h+t:t+t+k:k+t+t
                      :z[S](([64,1028,1092,8194,8258,8322,8326,9350,8802,9766][n]>>m*2&3)*7,7).replace(/X/g,k))+p+d
                    :t+'-'+l+t
                  :s+k+h
                :h+k+s
              )
            )+p
        :' -'+l+l+b
    ).join(' 'b,i+=wi+=13)
    for(m of ' 79012345698 ')].join('\n')
  ) 
)
 -------------   -------------   -------------   -------------   -------------   -------------   ------------- 
|10♣          | |J♦           | |Q♥           | |K♠           | |A♣           | | *|* * * * * * |*| |J            |
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |*| * * * * * *|* | |O  -------   |
|  |♣     ♣|  | |  |♦      |  | |  |♥      |  | |  |♠      |  | |  |       |  | | *|* * * * * * |*| |K |       |  |
|  |   ♣   |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |*| * * * * * *|* | |E | J     |  |
|  |♣     ♣|  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | | *|* * * * * * |*| |R |  O    |  |
|  |       |  | |  |   J   |  | |  |   Q   |  | |  |   K   |  | |  |   ♣   |  | |*| * * * * * *|* | |  |   K   |  |
|  |♣     ♣|  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | | *|* * * * * * |*| |  |    E  | J|
|  |   ♣   |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |*| * * * * * *|* | |  |     R | O|
|  |♣     ♣|  | |  |      ♦|  | |  |      ♥|  | |  |      ♠|  | |  |       |  | | *|* * * * * * |*| |  |       | K|
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |*| * * * * * *|* | |   -------  E|
|          ♣10| |           ♦J| |           ♥Q| |           ♠K| |           ♣A| | *|* * * * * * |*| |            R|
 -------------   -------------   -------------   -------------   -------------   -------------   ------------- 

 -------------   -------------   -------------   -------------   -------------   -------------   -------------   ------------- 
|2♣           | |3♦           | |4♥           | |5♠           | |6♣           | |7♦           | |8♥           | |9♠           |
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   |
|  |       |  | |  |       |  | |  |♥     ♥|  | |  |♠     ♠|  | |  |♣     ♣|  | |  |♦     ♦|  | |  |♥     ♥|  | |  |♠     ♠|  |
|  |   ♣   |  | |  |   ♦   |  | |  |       |  | |  |       |  | |  |       |  | |  |   ♦   |  | |  |   ♥   |  | |  |       |  |
|  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |♠     ♠|  |
|  |       |  | |  |   ♦   |  | |  |       |  | |  |   ♠   |  | |  |♣     ♣|  | |  |♦     ♦|  | |  |♥     ♥|  | |  |   ♠   |  |
|  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |♠     ♠|  |
|  |   ♣   |  | |  |   ♦   |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |   ♥   |  | |  |       |  |
|  |       |  | |  |       |  | |  |♥     ♥|  | |  |♠     ♠|  | |  |♣     ♣|  | |  |♦     ♦|  | |  |♥     ♥|  | |  |♠     ♠|  |
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   |
|           ♣2| |           ♦3| |           ♥4| |           ♠5| |           ♣6| |           ♦7| |           ♥8| |           ♠9|
 -------------   -------------   -------------   -------------   -------------   -------------   -------------   ------------- 

#JavaScript (E6) 564 576

F=c=>console.log(
  (p='|',b=' ',d=b+b,t=d+b,l='------',
    S='substr',  
    z="9X2X4XJ55O1-02K |6|1E | J4|1R |1O3|3|2K2|3|3E1| J1|4R | O1|6| K2-01E55R".replace(/\d/g,n=>-n?b.repeat(-~n):l),
    i=w=13, 
    c=c.split(b),
    [c.map(c=>
      m!=b
        ?p+(c=='B'
            ?' *'.repeat(7)[S](i&1,w)
             :c=='R'
             ?z[S](i-5,w)
             :(
                [,h,k]=c.match(/(.+)(.)/),
                // k='♣♦♥♠'['CDHS'.search(k)], uncomment to show the unicode symbols 
                n=h-1|0,
                s=t+t+t+(n>8?b:d),
                m-7
                ?m-8
                  ?m-9
                    ?d+p+(h>'A'
                      ?-m?m-6?m-3?t+b+t:t+h+t:t+t+k:k+t+t
                      :z[S](([64,1028,1092,8194,8258,8322,8326,9350,8802,9766][n]>>m*2&3)*7,7).replace(/X/g,k))+p+d
                    :t+'-'+l+t
                  :s+k+h
                :h+k+s
              )
            )+p
        :' -'+l+l+b
    ).join(' ',i+=w)
    for(m of ' 79012345698 ')].join('\n')
  ) 
)
 -------------   -------------   -------------   -------------   -------------   -------------   ------------- 
|10♣          | |J♦           | |Q♥           | |K♠           | |A♣           | | * * * * * * | |J            |
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |* * * * * * *| |O  -------   |
|  |♣     ♣|  | |  |♦      |  | |  |♥      |  | |  |♠      |  | |  |       |  | | * * * * * * | |K |       |  |
|  |   ♣   |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |* * * * * * *| |E | J     |  |
|  |♣     ♣|  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | | * * * * * * | |R |  O    |  |
|  |       |  | |  |   J   |  | |  |   Q   |  | |  |   K   |  | |  |   ♣   |  | |* * * * * * *| |  |   K   |  |
|  |♣     ♣|  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | | * * * * * * | |  |    E  | J|
|  |   ♣   |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |* * * * * * *| |  |     R | O|
|  |♣     ♣|  | |  |      ♦|  | |  |      ♥|  | |  |      ♠|  | |  |       |  | | * * * * * * | |  |       | K|
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |* * * * * * *| |   -------  E|
|          ♣10| |           ♦J| |           ♥Q| |           ♠K| |           ♣A| | * * * * * * | |            R|
 -------------   -------------   -------------   -------------   -------------   -------------   ------------- 

 -------------   -------------   -------------   -------------   -------------   -------------   -------------   ------------- 
|2♣           | |3♦           | |4♥           | |5♠           | |6♣           | |7♦           | |8♥           | |9♠           |
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   |
|  |       |  | |  |       |  | |  |♥     ♥|  | |  |♠     ♠|  | |  |♣     ♣|  | |  |♦     ♦|  | |  |♥     ♥|  | |  |♠     ♠|  |
|  |   ♣   |  | |  |   ♦   |  | |  |       |  | |  |       |  | |  |       |  | |  |   ♦   |  | |  |   ♥   |  | |  |       |  |
|  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |♠     ♠|  |
|  |       |  | |  |   ♦   |  | |  |       |  | |  |   ♠   |  | |  |♣     ♣|  | |  |♦     ♦|  | |  |♥     ♥|  | |  |   ♠   |  |
|  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |♠     ♠|  |
|  |   ♣   |  | |  |   ♦   |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |   ♥   |  | |  |       |  |
|  |       |  | |  |       |  | |  |♥     ♥|  | |  |♠     ♠|  | |  |♣     ♣|  | |  |♦     ♦|  | |  |♥     ♥|  | |  |♠     ♠|  |
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   |
|           ♣2| |           ♦3| |           ♥4| |           ♠5| |           ♣6| |           ♦7| |           ♥8| |           ♠9|
 -------------   -------------   -------------   -------------   -------------   -------------   -------------   ------------- 

#JavaScript (E6) 553 564 576

F=c=>(
    p='|',b=' ',d=b+b,t=d+b,l='------',
    S='substr',
    z="9X2X4XJ55O1-02K |6|1E | J4|1R |1O3|3|2K2|3|3E1| J1|4R | O1|6| K2-01E55R".replace(/\d/g,n=>-n?b.repeat(-~n):l),
    i=8,
    console.log([c.split(b).map(c=>
      m==b
        ?' -'+l+l+b
        :p+(c=='B'
          ?' *'.repeat(7)[S](i&1,13)
          :c=='R'
            ?z[S](i,13)
            :(
               [,h,k]=c.match(/(.+)(.)/),
               k='♣♦♥♠'['CDHS'.search(k)], //uncomment to show the unicode symbols 
               n=h-1|0,
               s=t+t+t+(n>8?b:d),
               m-7
                ?m-8
                  ?m-9
                    ?d+p+(h>'A'
                      ?-m?m-6?m-3?t+b+t:t+h+t:t+t+k:k+t+t
                      :z[S](([64,1028,1092,8194,8258,8322,8326,9350,8802,9766][n]>>m*2&3)*7,7).replace(/X/g,k))+p+d
                    :t+'-'+l+t
                  :s+k+h
                :h+k+s
              )
         )+p
    ).join(b,i+=13)
  for(m of ' 79012345698 ')].join('\n'))
)
 -------------   -------------   -------------   -------------   -------------   -------------   ------------- 
|10♣          | |J♦           | |Q♥           | |K♠           | |A♣           | |* * * * * * *| |J            |
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | | * * * * * * | |O  -------   |
|  |♣     ♣|  | |  |♦      |  | |  |♥      |  | |  |♠      |  | |  |       |  | |* * * * * * *| |K |       |  |
|  |   ♣   |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | | * * * * * * | |E | J     |  |
|  |♣     ♣|  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |* * * * * * *| |R |  O    |  |
|  |       |  | |  |   J   |  | |  |   Q   |  | |  |   K   |  | |  |   ♣   |  | | * * * * * * | |  |   K   |  |
|  |♣     ♣|  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |* * * * * * *| |  |    E  | J|
|  |   ♣   |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | | * * * * * * | |  |     R | O|
|  |♣     ♣|  | |  |      ♦|  | |  |      ♥|  | |  |      ♠|  | |  |       |  | |* * * * * * *| |  |       | K|
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | | * * * * * * | |   -------  E|
|          ♣10| |           ♦J| |           ♥Q| |           ♠K| |           ♣A| |* * * * * * *| |            R|
 -------------   -------------   -------------   -------------   -------------   -------------   ------------- 

 -------------   -------------   -------------   -------------   -------------   -------------   -------------   ------------- 
|2♣           | |3♦           | |4♥           | |5♠           | |6♣           | |7♦           | |8♥           | |9♠           |
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   |
|  |       |  | |  |       |  | |  |♥     ♥|  | |  |♠     ♠|  | |  |♣     ♣|  | |  |♦     ♦|  | |  |♥     ♥|  | |  |♠     ♠|  |
|  |   ♣   |  | |  |   ♦   |  | |  |       |  | |  |       |  | |  |       |  | |  |   ♦   |  | |  |   ♥   |  | |  |       |  |
|  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |♠     ♠|  |
|  |       |  | |  |   ♦   |  | |  |       |  | |  |   ♠   |  | |  |♣     ♣|  | |  |♦     ♦|  | |  |♥     ♥|  | |  |   ♠   |  |
|  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |♠     ♠|  |
|  |   ♣   |  | |  |   ♦   |  | |  |       |  | |  |       |  | |  |       |  | |  |       |  | |  |   ♥   |  | |  |       |  |
|  |       |  | |  |       |  | |  |♥     ♥|  | |  |♠     ♠|  | |  |♣     ♣|  | |  |♦     ♦|  | |  |♥     ♥|  | |  |♠     ♠|  |
|   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   | |   -------   |
|           ♣2| |           ♦3| |           ♥4| |           ♠5| |           ♣6| |           ♦7| |           ♥8| |           ♠9|
 -------------   -------------   -------------   -------------   -------------   -------------   -------------   ------------- 
deleted 29 characters in body
Source Link
edc65
  • 32.2k
  • 3
  • 36
  • 90
Loading
added 4660 characters in body
Source Link
edc65
  • 32.2k
  • 3
  • 36
  • 90
Loading
added 512 characters in body
Source Link
edc65
  • 32.2k
  • 3
  • 36
  • 90
Loading
Source Link
edc65
  • 32.2k
  • 3
  • 36
  • 90
Loading