Skip to main content
added 8 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282
s9s€5Ẏa;⁶;⁶z⁶Z - Link 1, make some candle parts & topping: number, age; character, part
s9             - split (implicit range(age)) into chunks of 9 (or remainder)
  s€5          - split each chunk of 9 into chunks of 5 (a 5 and a 4 or remainder)
     Ẏ         - tighten (to a list of lists of length 5, 4, 5, 4, ..., remainder)
      a        - logical and with the part character (either | or * here)
       ;⁶      - concatenate a space (we all still want topping when no candles)
         ;⁶    - ...and another (we also want some extra topping below the last row)
           z⁶  - transpose with filler space (fill the top with topping!)
             Z - transpose (put it back around the right way again chef)

ç”|ṙ-ż"ç”*$U⁸RḤ’¤¦Ẏ€j@€“| “|”Zj@€⁾--Z”+®¦€0,1©¦;ṫ¥-Y - Main link: number, age
ç”|                                                  - call last link (1) as a dyad with '|'
   ṙ-                                                - rotate left by -1
          $                                          - last two links as a monad:
       ç”*                                           -   call (1) as a dyad with '*'
      "                                              - zip with the dyadic operation:
     ż                                               -   zip (interleave each)
                 ¦                                   - sparse application:
           U                                         - ...of: upend (reverse each)
                ¤                                    - ...to indexes: nilad+links as a nilad:
            ⁸                                        -   chain's left argument, age
             R                                       -   range
              Ḥ                                      -   double (vectorises)
               ’                                     -   increment
                  Ẏ€                                 - tighten €ach (from '|*' or '*|' pairs)
                       “| “|”                        - literal ["| ", "|"]
                    j@€                              - join (swap arguments) for €ach (add a little extra topping to the left, and add piping to the sides)
                             Z                       - transpose
                                 ⁾--                 - literal "--"
                              j@€                    - join (swap arguments) for €ach (add piping to the top and bottom edges)
                                    Z                - transpose (time to invest in a potters wheel!)
                                              ¦      - sparse application:
                                          0,1        - ...to indexes: [0,1] (both ends)
                                             ©       -   (copy that to the register)
                                         €           - ...of: for each:
                                        ¦            -   sparse application:
                                     ”+              -   ...of: '+' character
                                       ®             -   ...to indexes: recall from register (both ends)
                                                  -  - literal -1
                                                 ¥   - last two links as a dyad
                                                ṫ    -   tail from index (gets last two rows)
                                               ;     -   concatenate (repeats them underneath)
                                                   Y - join with newlines
                                                     - as a full program: implicit print
s9s€5Ẏa;⁶;⁶z⁶Z - Link 1, make some candle parts & topping: number, age; character, part
s9             - split (implicit range(age)) into chunks of 9 (or remainder)
  s€5          - split each chunk of 9 into chunks of 5 (a 5 and a 4 or remainder)
     Ẏ         - tighten (to a list of lists of length 5, 4, 5, 4, ..., remainder)
      a        - logical and with the part character (either | or * here)
       ;⁶      - concatenate a space (we all still want topping when no candles)
         ;⁶    - ...and another (we also want some extra topping below the last row)
           z⁶  - transpose with filler space (fill the top with topping!)
             Z - transpose (put it back around the right way again chef)

ç”|ṙ-ż"ç”*$U⁸RḤ’¤¦Ẏ€j@€“| “|”Zj@€⁾--Z”+®¦€0,1©¦;ṫ¥-Y - Main link: number, age
ç”|                                                  - call last link (1) as a dyad with '|'
   ṙ-                                                - rotate left by -1
          $                                          - last two links as a monad:
       ç”*                                           -   call (1) as a dyad with '*'
      "                                              - zip with the dyadic operation:
     ż                                               -   zip (interleave each)
                 ¦                                   - sparse application:
           U                                         - ...of: upend (reverse each)
                ¤                                    - ...to indexes: nilad+links as a nilad:
            ⁸                                        -   chain's left argument, age
             R                                       -   range
              Ḥ                                      -   double (vectorises)
               ’                                     -   increment
                  Ẏ€                                 - tighten €ach (from '|*' pairs)
                       “| “|”                        - literal ["| ", "|"]
                    j@€                              - join (swap arguments) for €ach (add a little extra topping to the left, and add piping to the sides)
                             Z                       - transpose
                                 ⁾--                 - literal "--"
                              j@€                    - join (swap arguments) for €ach (add piping to the top and bottom edges)
                                    Z                - transpose (time to invest in a potters wheel!)
                                              ¦      - sparse application:
                                          0,1        - ...to indexes: [0,1] (both ends)
                                             ©       -   (copy that to the register)
                                         €           - ...of: for each:
                                        ¦            -   sparse application:
                                     ”+              -   ...of: '+' character
                                       ®             -   ...to indexes: recall from register (both ends)
                                                  -  - literal -1
                                                 ¥   - last two links as a dyad
                                                ṫ    -   tail from index (gets last two rows)
                                               ;     -   concatenate (repeats them underneath)
                                                   Y - join with newlines
                                                     - as a full program: implicit print
s9s€5Ẏa;⁶;⁶z⁶Z - Link 1, make some candle parts & topping: number, age; character, part
s9             - split (implicit range(age)) into chunks of 9 (or remainder)
  s€5          - split each chunk of 9 into chunks of 5 (a 5 and a 4 or remainder)
     Ẏ         - tighten (to a list of lists of length 5, 4, 5, 4, ..., remainder)
      a        - logical and with the part character (either | or * here)
       ;⁶      - concatenate a space (we all still want topping when no candles)
         ;⁶    - ...and another (we also want some extra topping below the last row)
           z⁶  - transpose with filler space (fill the top with topping!)
             Z - transpose (put it back around the right way again chef)

ç”|ṙ-ż"ç”*$U⁸RḤ’¤¦Ẏ€j@€“| “|”Zj@€⁾--Z”+®¦€0,1©¦;ṫ¥-Y - Main link: number, age
ç”|                                                  - call last link (1) as a dyad with '|'
   ṙ-                                                - rotate left by -1
          $                                          - last two links as a monad:
       ç”*                                           -   call (1) as a dyad with '*'
      "                                              - zip with the dyadic operation:
     ż                                               -   zip (interleave each)
                 ¦                                   - sparse application:
           U                                         - ...of: upend (reverse each)
                ¤                                    - ...to indexes: nilad+links as a nilad:
            ⁸                                        -   chain's left argument, age
             R                                       -   range
              Ḥ                                      -   double (vectorises)
               ’                                     -   increment
                  Ẏ€                                 - tighten €ach (from '|*' or '*|' pairs)
                       “| “|”                        - literal ["| ", "|"]
                    j@€                              - join (swap arguments) for €ach (add a little extra topping to the left, and add piping to the sides)
                             Z                       - transpose
                                 ⁾--                 - literal "--"
                              j@€                    - join (swap arguments) for €ach (add piping to the top and bottom edges)
                                    Z                - transpose (time to invest in a potters wheel!)
                                              ¦      - sparse application:
                                          0,1        - ...to indexes: [0,1] (both ends)
                                             ©       -   (copy that to the register)
                                         €           - ...of: for each:
                                        ¦            -   sparse application:
                                     ”+              -   ...of: '+' character
                                       ®             -   ...to indexes: recall from register (both ends)
                                                  -  - literal -1
                                                 ¥   - last two links as a dyad
                                                ṫ    -   tail from index (gets last two rows)
                                               ;     -   concatenate (repeats them underneath)
                                                   Y - join with newlines
                                                     - as a full program: implicit print
added 3829 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282
s9s€5Ẏa;⁶;⁶z⁶Z
ç”|ṙ-ż"ç”*$U⁸RḤ’¤¦j@€“|ż"ç”*$U⁸RḤ’¤¦Ẏ€j@€“| “|”Ẏ€Zj@€⁾“|”Zj@€⁾--Z”+®¦€0,1©¦;ṫ¥-Y

Try it online!Try it online!

How?

s9s€5Ẏa;⁶;⁶z⁶Z - Link 1, make some candle parts & topping: number, age; character, part
s9             - split (implicit range(age)) into chunks of 9 (or remainder)
  s€5          - split each chunk of 9 into chunks of 5 (a 5 and a 4 or remainder)
     Ẏ         - tighten (to a list of lists of length 5, 4, 5, 4, ..., remainder)
      a        - logical and with the part character (either | or * here)
       ;⁶      - concatenate a space (we all still want topping when no candles)
         ;⁶    - ...and another (we also want some extra topping below the last row)
           z⁶  - transpose with filler space (fill the top with topping!)
             Z - transpose (put it back around the right way again chef)

ç”|ṙ-ż"ç”*$U⁸RḤ’¤¦Ẏ€j@€“| “|”Zj@€⁾--Z”+®¦€0,1©¦;ṫ¥-Y - Main link: number, age
ç”|                                                  - call last link (1) as a dyad with '|'
   ṙ-                                                - rotate left by -1
          $                                          - last two links as a monad:
       ç”*                                           -   call (1) as a dyad with '*'
      "                                              - zip with the dyadic operation:
     ż                                               -   zip (interleave each)
                 ¦                                   - sparse application:
           U                                         - ...of: upend (reverse each)
                ¤                                    - ...to indexes: nilad+links as a nilad:
            ⁸                                        -   chain's left argument, age
             R                                       -   range
              Ḥ                                      -   double (vectorises)
               ’                                     -   increment
                  Ẏ€                                 - tighten €ach (from '|*' pairs)
                       “| “|”                        - literal ["| ", "|"]
                    j@€                              - join (swap arguments) for €ach (add a little extra topping to the left, and add piping to the sides)
                             Z                       - transpose
                                 ⁾--                 - literal "--"
                              j@€                    - join (swap arguments) for €ach (add piping to the top and bottom edges)
                                    Z                - transpose (time to invest in a potters wheel!)
                                              ¦      - sparse application:
                                          0,1        - ...to indexes: [0,1] (both ends)
                                             ©       -   (copy that to the register)
                                         €           - ...of: for each:
                                        ¦            -   sparse application:
                                     ”+              -   ...of: '+' character
                                       ®             -   ...to indexes: recall from register (both ends)
                                                  -  - literal -1
                                                 ¥   - last two links as a dyad
                                                ṫ    -   tail from index (gets last two rows)
                                               ;     -   concatenate (repeats them underneath)
                                                   Y - join with newlines
                                                     - as a full program: implicit print
s9s€5Ẏa;⁶;⁶z⁶Z
ç”|ṙ-ż"ç”*$U⁸RḤ’¤¦j@€“| “|”Ẏ€Zj@€⁾--Z”+®¦€0,1©¦;ṫ¥-Y

Try it online!

s9s€5Ẏa;⁶;⁶z⁶Z
ç”|ṙ-ż"ç”*$U⁸RḤ’¤¦Ẏ€j@€“| “|”Zj@€⁾--Z”+®¦€0,1©¦;ṫ¥-Y

Try it online!

How?

s9s€5Ẏa;⁶;⁶z⁶Z - Link 1, make some candle parts & topping: number, age; character, part
s9             - split (implicit range(age)) into chunks of 9 (or remainder)
  s€5          - split each chunk of 9 into chunks of 5 (a 5 and a 4 or remainder)
     Ẏ         - tighten (to a list of lists of length 5, 4, 5, 4, ..., remainder)
      a        - logical and with the part character (either | or * here)
       ;⁶      - concatenate a space (we all still want topping when no candles)
         ;⁶    - ...and another (we also want some extra topping below the last row)
           z⁶  - transpose with filler space (fill the top with topping!)
             Z - transpose (put it back around the right way again chef)

ç”|ṙ-ż"ç”*$U⁸RḤ’¤¦Ẏ€j@€“| “|”Zj@€⁾--Z”+®¦€0,1©¦;ṫ¥-Y - Main link: number, age
ç”|                                                  - call last link (1) as a dyad with '|'
   ṙ-                                                - rotate left by -1
          $                                          - last two links as a monad:
       ç”*                                           -   call (1) as a dyad with '*'
      "                                              - zip with the dyadic operation:
     ż                                               -   zip (interleave each)
                 ¦                                   - sparse application:
           U                                         - ...of: upend (reverse each)
                ¤                                    - ...to indexes: nilad+links as a nilad:
            ⁸                                        -   chain's left argument, age
             R                                       -   range
              Ḥ                                      -   double (vectorises)
               ’                                     -   increment
                  Ẏ€                                 - tighten €ach (from '|*' pairs)
                       “| “|”                        - literal ["| ", "|"]
                    j@€                              - join (swap arguments) for €ach (add a little extra topping to the left, and add piping to the sides)
                             Z                       - transpose
                                 ⁾--                 - literal "--"
                              j@€                    - join (swap arguments) for €ach (add piping to the top and bottom edges)
                                    Z                - transpose (time to invest in a potters wheel!)
                                              ¦      - sparse application:
                                          0,1        - ...to indexes: [0,1] (both ends)
                                             ©       -   (copy that to the register)
                                         €           - ...of: for each:
                                        ¦            -   sparse application:
                                     ”+              -   ...of: '+' character
                                       ®             -   ...to indexes: recall from register (both ends)
                                                  -  - literal -1
                                                 ¥   - last two links as a dyad
                                                ṫ    -   tail from index (gets last two rows)
                                               ;     -   concatenate (repeats them underneath)
                                                   Y - join with newlines
                                                     - as a full program: implicit print
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 67 bytes

s9s€5Ẏa;⁶;⁶z⁶Z
ç”|ṙ-ż"ç”*$U⁸RḤ’¤¦j@€“| “|”Ẏ€Zj@€⁾--Z”+®¦€0,1©¦;ṫ¥-Y

A monadic link taking a number and returning a list of characters or a full program printing the output.

Try it online!