Skip to main content
deleted 7 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

(each byte saved involved fairly non-trivial changes, see the edit history if you're interested, although I just noticed that Link 1 is the same byte count as the more conventional concatenationrepeat and join: _2⁶ẋ“ ||“|”j)

(each byte saved involved fairly non-trivial changes, see the edit history if you're interested, although I just noticed that Link 1 is the same byte count as the more conventional concatenation and join: _2⁶ẋ“ ||“|”j)

(each byte saved involved fairly non-trivial changes, see the edit history if you're interested, although I just noticed that Link 1 is the same byte count as the more conventional repeat and join: _2⁶ẋ“ ||“|”j)

added 124 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

(each byte saved involved fairly non-trivial changes, see the edit history if you're interested, although I just noticed that Link 1 is the same byte count as the more conventional concatenation and join: _2⁶ẋ“ ||“|”j)

(each byte saved involved fairly non-trivial changes, see the edit history if you're interested)

(each byte saved involved fairly non-trivial changes, see the edit history if you're interested, although I just noticed that Link 1 is the same byte count as the more conventional concatenation and join: _2⁶ẋ“ ||“|”j)

added 4 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 36 35 34 33 3332 bytes

_3”-ẋ“|+“2*×5H_2Bị⁾ ||”j|
:©2⁶ẋ,`jÇŒḄḊṙ®sṁµY_3”-ẋ”+;;Çsẋ2U3¦ṁµY

TryItOnline!TryItOnline!

Builds a nighternighter™ the other way around to the examples like:

_3”-ẋ“|+“2*×5H_2Bị⁾ ||”j| - Link 1, walls+turn/exitpipes & spaces: n      e.g. 7
2*  ”-         - 2 -raised literalto ['-']
_3the nth power      e.g. 128
  ×5  - n - 3    - multiply by 5                  e.g. 4640
    H        - halve - repeat                        e.g. "----"320
     “|+“ ||”  - list of strings ["|+","_2 ||"]
     - subtract 2      j - join             e.g. 318
       B    e.g. "|+---- ||"

:©2⁶ẋ,`jÇŒḄḊṙ®sṁµY -convert Mainto link:binary n             e.g. 7[1,0,0,1,1,1,1,1,0]
            - index into (1-based)
   - literal [' ']
: 2   | - char list " |"        - integer divide n by 2    e.g. 3
" ©||     |"

_3”-ẋ”+;;Çsẋ2U3¦ṁµY - Main link: n          - save ine.g. register7
_3                  - repeatn - 3                   e.g. "   "4
  ”-    `            - repeat argument forchar thelist dyad:"-"
     ,             -   - repeat pair                 e.g. ["   ",----"   "]
     ”+   Ç          - call last link (1) aschar alist monad"+"
       j      ;     - join       - concatenate             e.g. "   |+"+---- ||   "
         ŒḄ        - bounce          Ç         e.g. "   |+---- ||   call last ||link ----+|(1) as a "monad
           ;       - dequeue    - concatenate             e.g. "  |+"+---- ||     || ----+|  |"" "
          s   ®      - readsplit registerinto chunks of n  e.g. ["+---- |","|     e.g. 3|"]
           ẋ2       - rotate left  repeat 2 times          e.g. "+---- ||     || ["+----+|     |",
              s    - split into chunks of length n
                            "|     |",
             e.g. ["+---- |",
                                 +-->  "+---- |",
                "|     |",
                         |     "|     |"]
                 "| ----+",
 apply to index 3:       |
             U      -    upend                +---  "|     |"]----+"
                ṁ   - mould like n (i.e. repeat to fill)
                 µ  - monadic chain separation
                  Y - join with line feeds

(each byte saved involved fairly non-trivial changes, see the edit history if you're interested)

Jelly, 36 35 34 33 bytes

_3”-ẋ“|+“ ||”j
:©2⁶ẋ,`jÇŒḄḊṙ®sṁµY

TryItOnline!

Builds a nighter the other way around to the examples like:

_3”-ẋ“|+“ ||”j - Link 1, walls+turn/exit: n   e.g. 7
  ”-           - literal ['-']
_3             - n - 3                        e.g. 4
              - repeat                       e.g. "----"
     “|+“ ||”  - list of strings ["|+"," ||"]
             j - join                         e.g. "|+---- ||"

:©2⁶ẋ,`jÇŒḄḊṙ®sṁµY - Main link: n             e.g. 7
                  - literal [' ']
: 2                - integer divide n by 2    e.g. 3
 ©                 - save in register
                  - repeat                   e.g. "   "
      `            - repeat argument for the dyad:
     ,             -     pair                 e.g. ["   ","   "]
        Ç          - call last link (1) as a monad
       j           - join                     e.g. "   |+---- ||   "
         ŒḄ        - bounce                   e.g. "   |+---- ||     || ----+|   "
                  - dequeue                  e.g. "  |+---- ||     || ----+|   "
             ®     - read register            e.g. 3
                  - rotate left              e.g. "+---- ||     || ----+|     |"
              s    - split into chunks of length n
                                              e.g. ["+---- |",
                                                    "|     |",
                                                    "| ----+",
                                                    "|     |"]
               ṁ   - mould like n (i.e. repeat to fill)
                µ  - monadic chain separation
                 Y - join with line feeds

Jelly, 36 35 34 33 32 bytes

2*×5H_2Bị⁾ |
_3”-ẋ”+;;Çsẋ2U3¦ṁµY

TryItOnline!

Builds a nighter™ the other way around to the examples like:

2*×5H_2Bị⁾ | - Link 1, pipes & spaces: n      e.g. 7
2*           - 2 raised to the nth power      e.g. 128
  ×5         - multiply by 5                  e.g. 640
    H        - halve                          e.g. 320
     _2      - subtract 2                     e.g. 318
       B     - convert to binary              e.g. [1,0,0,1,1,1,1,1,0]
            - index into (1-based)
          | - char list " |"                 e.g. " ||     |"

_3”-ẋ”+;;Çsẋ2U3¦ṁµY - Main link: n            e.g. 7
_3                  - n - 3                   e.g. 4
  ”-                - char list "-"
                   - repeat                  e.g. "----"
     ”+             - char list "+"
       ;            - concatenate             e.g. "+----"
         Ç          - call last link (1) as a monad
        ;           - concatenate             e.g. "+---- ||     |"" 
          s         - split into chunks of n  e.g. ["+---- |","|     |"]
           ẋ2       - repeat 2 times          e.g. ["+---- |",
                                                    "|     |",
                                              +-->  "+---- |",
                                              |     "|     |"]
                  - apply to index 3:       |
             U      -    upend                +---  "| ----+"
                ṁ   - mould like n (i.e. repeat to fill)
                 µ  - monadic chain separation
                  Y - join with line feeds

(each byte saved involved fairly non-trivial changes, see the edit history if you're interested)

deleted 31 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282
Loading
deleted 37 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282
Loading
deleted 49 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282
Loading
added 479 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282
Loading
added 1332 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282
Loading
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282
Loading