Output visual diagram of pictureASCII-art logic gate diagramBooks on a ShelfDetermine the Dimensions of a Rotated RectangleDraw a Houndstooth PatternDraw and label an ASCII hexagonal gridGolf me an ASCII AlphabetASCII Jigsaw PuzzleOutput a pretty boxASCII-Art Venn DiagramASCII Exact Cover with Rectangles

Turning a hard to access nut?

Magento 2: Make category field required in product form in backend

Are hand made posters acceptable in Academia?

How do researchers send unsolicited emails asking for feedback on their works?

Why is indicated airspeed rather than ground speed used during the takeoff roll?

Perfect 4th is dissonant?

If I cast the Enlarge/Reduce spell on an arrow, what weapon could it count as?

What is it called when someone votes for an option that's not their first choice?

Is it okay for a cleric of life to use spells like Animate Dead and/or Contagion?

Would mining huge amounts of resources on the Moon change its orbit?

Creating points with attributes from coordinates in ArcPy

Box half filled color

Asserting that Atheism and Theism are both faith based positions

Why is "la Gestapo" feminine?

Recursively updating the MLE as new observations stream in

Why didn't Voldemort know what Grindelwald looked like?

Print last inputted byte

Does fire aspect on a sword, destroy mob drops?

PTIJ: Which Dr. Seuss books should one obtain?

Exposing a company lying about themselves in a tightly knit industry (videogames) : Is my career at risk on the long run?

What is the tangent at a sharp point on a curve?

Hot air balloons as primitive bombers

categorizing a variable turns it from insignificant to significant

Parts of mini page are not placed properly



Output visual diagram of picture


ASCII-art logic gate diagramBooks on a ShelfDetermine the Dimensions of a Rotated RectangleDraw a Houndstooth PatternDraw and label an ASCII hexagonal gridGolf me an ASCII AlphabetASCII Jigsaw PuzzleOutput a pretty boxASCII-Art Venn DiagramASCII Exact Cover with Rectangles













14












$begingroup$


Write a program that inputs the dimensions of a painting, the matting width, and the frame width for a framed portrait. The program should output a diagram using the symbol ‘X ’ for the painting, ‘+’ for the matting, and ‘# ’ for the framing. The symbols must be space-separated.



INPUT: 3 2 1 2
(Width, Height, Matte Width, Frame Width)



OUTPUT:



First 3 and 2 are painting width and height. 1 is the matte width around it. 2 is the frame width around the whole thing.



In text form:



# # # # # # # # #
# # # # # # # # #
# # + + + + + # #
# # + X X X + # #
# # + X X X + # #
# # + + + + + # #
# # # # # # # # #
# # # # # # # # #


The winning code completes the following conditions in the least possible bytes.










share|improve this question









New contributor




George Harris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$











  • $begingroup$
    Nice challenge! For future challenges you may want to use The Sandbox
    $endgroup$
    – MilkyWay90
    10 hours ago










  • $begingroup$
    Also, will the frame height be given?
    $endgroup$
    – MilkyWay90
    10 hours ago










  • $begingroup$
    MilkyWay90, the frame is a constant width around the portrait so only one value is needed.
    $endgroup$
    – George Harris
    10 hours ago










  • $begingroup$
    Thanks! Is the constant width always 2 (or is it the height of the frame)?
    $endgroup$
    – MilkyWay90
    10 hours ago







  • 1




    $begingroup$
    do you mind if the input is in a different order?
    $endgroup$
    – zevee
    10 hours ago















14












$begingroup$


Write a program that inputs the dimensions of a painting, the matting width, and the frame width for a framed portrait. The program should output a diagram using the symbol ‘X ’ for the painting, ‘+’ for the matting, and ‘# ’ for the framing. The symbols must be space-separated.



INPUT: 3 2 1 2
(Width, Height, Matte Width, Frame Width)



OUTPUT:



First 3 and 2 are painting width and height. 1 is the matte width around it. 2 is the frame width around the whole thing.



In text form:



# # # # # # # # #
# # # # # # # # #
# # + + + + + # #
# # + X X X + # #
# # + X X X + # #
# # + + + + + # #
# # # # # # # # #
# # # # # # # # #


The winning code completes the following conditions in the least possible bytes.










share|improve this question









New contributor




George Harris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$











  • $begingroup$
    Nice challenge! For future challenges you may want to use The Sandbox
    $endgroup$
    – MilkyWay90
    10 hours ago










  • $begingroup$
    Also, will the frame height be given?
    $endgroup$
    – MilkyWay90
    10 hours ago










  • $begingroup$
    MilkyWay90, the frame is a constant width around the portrait so only one value is needed.
    $endgroup$
    – George Harris
    10 hours ago










  • $begingroup$
    Thanks! Is the constant width always 2 (or is it the height of the frame)?
    $endgroup$
    – MilkyWay90
    10 hours ago







  • 1




    $begingroup$
    do you mind if the input is in a different order?
    $endgroup$
    – zevee
    10 hours ago













14












14








14


3



$begingroup$


Write a program that inputs the dimensions of a painting, the matting width, and the frame width for a framed portrait. The program should output a diagram using the symbol ‘X ’ for the painting, ‘+’ for the matting, and ‘# ’ for the framing. The symbols must be space-separated.



INPUT: 3 2 1 2
(Width, Height, Matte Width, Frame Width)



OUTPUT:



First 3 and 2 are painting width and height. 1 is the matte width around it. 2 is the frame width around the whole thing.



In text form:



# # # # # # # # #
# # # # # # # # #
# # + + + + + # #
# # + X X X + # #
# # + X X X + # #
# # + + + + + # #
# # # # # # # # #
# # # # # # # # #


The winning code completes the following conditions in the least possible bytes.










share|improve this question









New contributor




George Harris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




Write a program that inputs the dimensions of a painting, the matting width, and the frame width for a framed portrait. The program should output a diagram using the symbol ‘X ’ for the painting, ‘+’ for the matting, and ‘# ’ for the framing. The symbols must be space-separated.



INPUT: 3 2 1 2
(Width, Height, Matte Width, Frame Width)



OUTPUT:



First 3 and 2 are painting width and height. 1 is the matte width around it. 2 is the frame width around the whole thing.



In text form:



# # # # # # # # #
# # # # # # # # #
# # + + + + + # #
# # + X X X + # #
# # + X X X + # #
# # + + + + + # #
# # # # # # # # #
# # # # # # # # #


The winning code completes the following conditions in the least possible bytes.







code-golf ascii-art






share|improve this question









New contributor




George Harris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




George Harris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago









Laikoni

20.2k438102




20.2k438102






New contributor




George Harris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 10 hours ago









George HarrisGeorge Harris

712




712




New contributor




George Harris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





George Harris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






George Harris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • $begingroup$
    Nice challenge! For future challenges you may want to use The Sandbox
    $endgroup$
    – MilkyWay90
    10 hours ago










  • $begingroup$
    Also, will the frame height be given?
    $endgroup$
    – MilkyWay90
    10 hours ago










  • $begingroup$
    MilkyWay90, the frame is a constant width around the portrait so only one value is needed.
    $endgroup$
    – George Harris
    10 hours ago










  • $begingroup$
    Thanks! Is the constant width always 2 (or is it the height of the frame)?
    $endgroup$
    – MilkyWay90
    10 hours ago







  • 1




    $begingroup$
    do you mind if the input is in a different order?
    $endgroup$
    – zevee
    10 hours ago
















  • $begingroup$
    Nice challenge! For future challenges you may want to use The Sandbox
    $endgroup$
    – MilkyWay90
    10 hours ago










  • $begingroup$
    Also, will the frame height be given?
    $endgroup$
    – MilkyWay90
    10 hours ago










  • $begingroup$
    MilkyWay90, the frame is a constant width around the portrait so only one value is needed.
    $endgroup$
    – George Harris
    10 hours ago










  • $begingroup$
    Thanks! Is the constant width always 2 (or is it the height of the frame)?
    $endgroup$
    – MilkyWay90
    10 hours ago







  • 1




    $begingroup$
    do you mind if the input is in a different order?
    $endgroup$
    – zevee
    10 hours ago















$begingroup$
Nice challenge! For future challenges you may want to use The Sandbox
$endgroup$
– MilkyWay90
10 hours ago




$begingroup$
Nice challenge! For future challenges you may want to use The Sandbox
$endgroup$
– MilkyWay90
10 hours ago












$begingroup$
Also, will the frame height be given?
$endgroup$
– MilkyWay90
10 hours ago




$begingroup$
Also, will the frame height be given?
$endgroup$
– MilkyWay90
10 hours ago












$begingroup$
MilkyWay90, the frame is a constant width around the portrait so only one value is needed.
$endgroup$
– George Harris
10 hours ago




$begingroup$
MilkyWay90, the frame is a constant width around the portrait so only one value is needed.
$endgroup$
– George Harris
10 hours ago












$begingroup$
Thanks! Is the constant width always 2 (or is it the height of the frame)?
$endgroup$
– MilkyWay90
10 hours ago





$begingroup$
Thanks! Is the constant width always 2 (or is it the height of the frame)?
$endgroup$
– MilkyWay90
10 hours ago





1




1




$begingroup$
do you mind if the input is in a different order?
$endgroup$
– zevee
10 hours ago




$begingroup$
do you mind if the input is in a different order?
$endgroup$
– zevee
10 hours ago










9 Answers
9






active

oldest

votes


















3












$begingroup$

JavaScript (ES6),  118  113 bytes





(w,h,M,F)=>(g=(c,n)=>'01210'.replace(/./g,i=>c(+i).repeat([F,M,n][i])))(y=>g(x=>'###+X#++'[y+x*5&7]+' ',w)+`
`,h)


Try it online!



Commented



(w, h, M, F) => ( // given the 4 input variables
g = ( // g = helper function taking:
c, // c = callback function returning a string to repeat
n // n = number of times the painting part must be repeated
) => //
'01210' // string describing the picture structure, with:
.replace( // 0 = frame, 1 = matte, 2 = painting
/./g, // for each character in the above string:
i => // i = identifier of the current area
c(+i) // invoke the callback function
.repeat // and repeat it ...
([F, M, n][i]) // ... either F, M or n times
) // end of replace()
)( // outer call to g:
y => // callback function taking y:
g( // inner call to g:
x => // callback function taking x:
'###+X#++' // figure out which character to use
[y + x * 5 & 7] // by applying a small hash function to (x, y)
+ ' ', // append a space
w // repeat the painting part w times
) // end of inner call
+ 'n', // append a line feed
h // repeat the painting part h times
) // end of outer call





share|improve this answer











$endgroup$




















    3












    $begingroup$


    Python 2, 98 bytes





    w,h,a,b=input()
    a*='+'
    b*='#'
    for c in b+a+h*'X'+a+b:print' '.join(min(c,d)for d in b+a+w*'X'+a+b)


    Try it online!



    Prints a space-separated grid, strictly following the spec. I'm amused that *= is used to convert a and b from numbers to strings.



    Python 3 can save some bytes by avoiding ' '.join, maybe more by using f-strings and assignment expressions.



    Python 3, 95 bytes





    def f(w,h,a,b):
    a*='+';b*='#'
    for c in b+a+h*'X'+a+b:print(*[min(c,d)for d in b+a+w*'X'+a+b])


    Try it online!






    share|improve this answer









    $endgroup$












    • $begingroup$
      93 bytes for Python 3
      $endgroup$
      – Jo King
      7 hours ago


















    2












    $begingroup$


    Charcoal, 48 47 44 bytes



    ≔×NXθ≔×NXηFE+#×Nι«≔⁺ι⁺θιθ≔⁺ι⁺ηιη»Eη⪫⭆θ⌊⟦ιλ⟧ 


    Try it online! Link is to verbose version of code. Note: Trailing space. Edit: Now uses @xnor's algorithm. Explanation:



    ≔×NXθ≔×NXη


    Input the width and height and convert them into strings of Xs.



    FE+#×Nι


    Loop over the characters + and #, converting them into strings of length given by the remaining two inputs. Then loop over those two strings.



    «≔⁺ι⁺θιθ≔⁺ι⁺ηιη»


    Prefix and suffix the painting with the strings for the matting and framing.



    Eη⪫⭆θ⌊⟦ιλ⟧ 


    Loop over the strings, taking the minimum of the horizontal and vertical characters, and then double-spacing the rows, implicitly printing each row on its own line.






    share|improve this answer











    $endgroup$




















      1












      $begingroup$


      Python 3.8 (pre-release), 116 115 bytes





      lambda a,b,c,d,e='#',f='+':"n".join((g:=[e*(a+2*c+2*d)]*d+[(h:=e*d)+f*(a+c*2)+h]*c)+[h+f*c+'X'*a+f*c+h]*b+g[::-1])


      Try it online!



      First attempt at golfing, will be improved soon.
      a is width, b is height, c is matte width, and d is frame width.



      -1 bytes using the := operator to define h as e * d



      EXPLANATION:



      lambda a,b,c,d,e='#',f='+': Define a lambda which takes in arguments a, b, c, and d (The width of the painting, the height of the painting, the padding of the matte, and the padding of the frame width, respectively). It also defines variables e and f as '#' and '+', respectively.
      "n".join( Turn the list into a string, where each element is separated by newlines
      (g:= Define g as (while still evaling the lists)...
      [e*(a+2*c+2*d)]*d+ Form the top rows (the ones filled with hashtags)
      [(h:=e*d)+f*(a+c*2)+h]*c Form the middle-top rows (uses := to golf this section)
      )+
      [h+f*c+'X'*a+f*c+h]*b+ Form the middle row
      g[::-1] Uses g to golf the code (forms the entire middle-bottom-to-bottom)
      )





      share|improve this answer











      $endgroup$












      • $begingroup$
        Removing the e assignment saves you two bytes, the f assignment isn't saving you anything
        $endgroup$
        – Jo King
        7 hours ago


















      1












      $begingroup$


      Wolfram Language (Mathematica), 142 bytes



      (t=(p=Table)["# ",2(c=#4+#3)+#2,2c+#];p[t[[i,j]]="+ ",j,z=#4+1,c+#3+#,i,z,c+#3+#2];p[t[[i,j]]="X ",j,#3+z,c+#,i,#3+z,c+#2];""<>#&/@t)&


      Try it online!






      share|improve this answer











      $endgroup$




















        1












        $begingroup$


        05AB1E (legacy), 32 31 bytes



        и'Xׄ+#vyI©×UεX.ø}®FDнgy×.ø]€S»


        Takes the input in the order height, width, matte, frame. If the input order specified in the challenge is strict (still waiting on OP for verification), a leading s (swap) can be added for +1 byte.



        Uses the legacy version of 05AB1E instead of the new version, because there seems to be a weird bug with the surround in a map and loop..



        Try it online.



        Explanation:





        и # Repeat the second (implicit) input the first (implicit) input amount of
        # times as list
        'X× '# Repeat "X" that many times
        „+#v # Loop `y` over the characters ["+","#"]:
        y # Push character `y`
        I # Push the next input (matte in the first iteration; frame in the second)
        © # And store it in the register (without popping)
        × # Repeat character `y` that input amount of times
        U # Pop and store that string in variable `X`
        εX.ø} # Surround each string in the list with string `X`
        ®F # Inner loop the value from the register amount of times:
        Dнg # Get the new width by taking the length of the first string
        y× # Repeat character `y` that many times
        .ø # And surround the list with this leading and trailing string
        ] # Close both the inner and outer loops
        €S # Convert each inner string to a list of characters
        » # Join every list of characters by spaces, and then every string by newlines
        # (and output the result implicitly)





        share|improve this answer











        $endgroup$




















          0












          $begingroup$

          Javascript, 158 bytes



          (w,h,m,f)=>(q="repeat",(z=("#"[q](w+2*(m+f)))+`
          `)[q](f))+(x=((e="#"[q](f))+(r="+"[q](m))+(t="+"[q](w))+r+e+`
          `)[q](m))+(e+r+"X"[q](w)+r+e+`
          `)[q](h)+x+z)


          Can probably be trimmed down a little bit






          f=

          (w,h,m,f)=>(q="repeat",(z=("# "[q](w+2*(m+f))+`
          `)[q](f))+(x=((e="# "[q](f))+(r="+ "[q](m))+(t="+ "[q](w))+r+e+`
          `)[q](m))+(e+r+"X "[q](w)+r+e+`
          `)[q](h)+x+z)

          console.log(f(3,2,1,2))








          share|improve this answer









          $endgroup$




















            0












            $begingroup$


            Perl 6, 98 bytes





            map(&min,[X] map (($_='#'x$^d~'+'x$^c)~'X'x*~.flip).comb,$^a,$^b).rotor($b+2*($c+$d)).join("n")


            Try it online!



            This is a port of xnor's Python answer.




            Perl 6, 115 bytes





            ->a,b,c,d$_=['#'xx$!*2+a]xx($!=c+d)*2+b;.[d..^*-d;d..^a+$!+c]='+'xx*;.[$!..^*-$!;$!..^a+$!]='X'xx*;.join("
            ")


            Try it online!



            Roughly golfed anonymous codeblock utilising Perl 6's multi-dimensional list assignment. For example, @a[1;2] = 'X'; will assign 'X' to the element with index 2 from the list with index 1, and @a[1,2,3;3,4,5]='X'xx 9; will replace all the elements with indexes 3,4,5 of the lists with indexes 1,2,3 with 'X'.



            Explanation:



            First, we initialise the list as a a+2*(c+d) by b+2*(c+d) rectangle of #s.



            $_=['#'xx$!*2+a]xx($!=c+d)*2+a;
            State:
            # # # # # # # # #
            # # # # # # # # #
            # # # # # # # # #
            # # # # # # # # #
            # # # # # # # # #
            # # # # # # # # #
            # # # # # # # # #
            # # # # # # # # #


            Then we assign the inner rectangle of +s



            .[d..^*-d;d..^a+$!+c]='+'xx*;
            State:
            # # # # # # # # #
            # # # # # # # # #
            # # + + + + + # #
            # # + + + + + # #
            # # + + + + + # #
            # # + + + + + # #
            # # # # # # # # #
            # # # # # # # # #


            Finally, the innermost rectangle of Xs.



            .[$!..^*-$!;$!..^a+$!]='X'xx*;
            # # # # # # # # #
            # # # # # # # # #
            # # + + + + + # #
            # # + X X X + # #
            # # + X X X + # #
            # # + + + + + # #
            # # # # # # # # #
            # # # # # # # # #





            share|improve this answer











            $endgroup$




















              0












              $begingroup$


              Jelly, 35 31 bytes



              ⁽Q=,⁽QƙDị€x@€⁽-FD¤«þƝẎị“#+X”K€Y


              Try it online!



              Takes the input in the order matte, frame, width, height; comma separated. Outputs the ASCII-art picture with frame and matte. If the input order is strict I’d need to add 4 bytes (as per my original post).






              share|improve this answer











              $endgroup$












              • $begingroup$
                I never program in Jelly, but surely 43134,43234 can be compressed? EDIT: I need to learn to read, you mention they can indeed be encoded in 4 bytes each. But what has the input-order to do with whether these numbers can be encoded or not? :S
                $endgroup$
                – Kevin Cruijssen
                32 mins ago











              • $begingroup$
                @KevinCruijssen the maximum integer that can be encoded using the two byte syntax is 32250; since both exceed that I can’t save the bytes. For now I’ll assume I can swap things around and revert if it’s not allowed!
                $endgroup$
                – Nick Kennedy
                29 mins ago










              • $begingroup$
                Ah ok, I see. 43134 will need 3 encoding characters, which including a leading/trailing character to indicate it's encoded will be 5 bytes as well. And does Jelly perhaps have a duplicate of some sort, since the second number is 100 larger than the first? Not sure if the actions push 43134, duplicate, push 100, plus, pair is possible and shorter in Jelly?
                $endgroup$
                – Kevin Cruijssen
                21 mins ago











              • $begingroup$
                @KevinCruijssen I originally tried that using +0,100 which doesn’t save any. I think I could use a nilad chain to use the fact that in a nilad ³ is 100, but if I’m allowed to reorder inputs the base 250 integers are better
                $endgroup$
                – Nick Kennedy
                16 mins ago










              Your Answer





              StackExchange.ifUsing("editor", function ()
              return StackExchange.using("mathjaxEditing", function ()
              StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
              StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
              );
              );
              , "mathjax-editing");

              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "200"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );






              George Harris is a new contributor. Be nice, and check out our Code of Conduct.









              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f181763%2foutput-visual-diagram-of-picture%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              9 Answers
              9






              active

              oldest

              votes








              9 Answers
              9






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3












              $begingroup$

              JavaScript (ES6),  118  113 bytes





              (w,h,M,F)=>(g=(c,n)=>'01210'.replace(/./g,i=>c(+i).repeat([F,M,n][i])))(y=>g(x=>'###+X#++'[y+x*5&7]+' ',w)+`
              `,h)


              Try it online!



              Commented



              (w, h, M, F) => ( // given the 4 input variables
              g = ( // g = helper function taking:
              c, // c = callback function returning a string to repeat
              n // n = number of times the painting part must be repeated
              ) => //
              '01210' // string describing the picture structure, with:
              .replace( // 0 = frame, 1 = matte, 2 = painting
              /./g, // for each character in the above string:
              i => // i = identifier of the current area
              c(+i) // invoke the callback function
              .repeat // and repeat it ...
              ([F, M, n][i]) // ... either F, M or n times
              ) // end of replace()
              )( // outer call to g:
              y => // callback function taking y:
              g( // inner call to g:
              x => // callback function taking x:
              '###+X#++' // figure out which character to use
              [y + x * 5 & 7] // by applying a small hash function to (x, y)
              + ' ', // append a space
              w // repeat the painting part w times
              ) // end of inner call
              + 'n', // append a line feed
              h // repeat the painting part h times
              ) // end of outer call





              share|improve this answer











              $endgroup$

















                3












                $begingroup$

                JavaScript (ES6),  118  113 bytes





                (w,h,M,F)=>(g=(c,n)=>'01210'.replace(/./g,i=>c(+i).repeat([F,M,n][i])))(y=>g(x=>'###+X#++'[y+x*5&7]+' ',w)+`
                `,h)


                Try it online!



                Commented



                (w, h, M, F) => ( // given the 4 input variables
                g = ( // g = helper function taking:
                c, // c = callback function returning a string to repeat
                n // n = number of times the painting part must be repeated
                ) => //
                '01210' // string describing the picture structure, with:
                .replace( // 0 = frame, 1 = matte, 2 = painting
                /./g, // for each character in the above string:
                i => // i = identifier of the current area
                c(+i) // invoke the callback function
                .repeat // and repeat it ...
                ([F, M, n][i]) // ... either F, M or n times
                ) // end of replace()
                )( // outer call to g:
                y => // callback function taking y:
                g( // inner call to g:
                x => // callback function taking x:
                '###+X#++' // figure out which character to use
                [y + x * 5 & 7] // by applying a small hash function to (x, y)
                + ' ', // append a space
                w // repeat the painting part w times
                ) // end of inner call
                + 'n', // append a line feed
                h // repeat the painting part h times
                ) // end of outer call





                share|improve this answer











                $endgroup$















                  3












                  3








                  3





                  $begingroup$

                  JavaScript (ES6),  118  113 bytes





                  (w,h,M,F)=>(g=(c,n)=>'01210'.replace(/./g,i=>c(+i).repeat([F,M,n][i])))(y=>g(x=>'###+X#++'[y+x*5&7]+' ',w)+`
                  `,h)


                  Try it online!



                  Commented



                  (w, h, M, F) => ( // given the 4 input variables
                  g = ( // g = helper function taking:
                  c, // c = callback function returning a string to repeat
                  n // n = number of times the painting part must be repeated
                  ) => //
                  '01210' // string describing the picture structure, with:
                  .replace( // 0 = frame, 1 = matte, 2 = painting
                  /./g, // for each character in the above string:
                  i => // i = identifier of the current area
                  c(+i) // invoke the callback function
                  .repeat // and repeat it ...
                  ([F, M, n][i]) // ... either F, M or n times
                  ) // end of replace()
                  )( // outer call to g:
                  y => // callback function taking y:
                  g( // inner call to g:
                  x => // callback function taking x:
                  '###+X#++' // figure out which character to use
                  [y + x * 5 & 7] // by applying a small hash function to (x, y)
                  + ' ', // append a space
                  w // repeat the painting part w times
                  ) // end of inner call
                  + 'n', // append a line feed
                  h // repeat the painting part h times
                  ) // end of outer call





                  share|improve this answer











                  $endgroup$



                  JavaScript (ES6),  118  113 bytes





                  (w,h,M,F)=>(g=(c,n)=>'01210'.replace(/./g,i=>c(+i).repeat([F,M,n][i])))(y=>g(x=>'###+X#++'[y+x*5&7]+' ',w)+`
                  `,h)


                  Try it online!



                  Commented



                  (w, h, M, F) => ( // given the 4 input variables
                  g = ( // g = helper function taking:
                  c, // c = callback function returning a string to repeat
                  n // n = number of times the painting part must be repeated
                  ) => //
                  '01210' // string describing the picture structure, with:
                  .replace( // 0 = frame, 1 = matte, 2 = painting
                  /./g, // for each character in the above string:
                  i => // i = identifier of the current area
                  c(+i) // invoke the callback function
                  .repeat // and repeat it ...
                  ([F, M, n][i]) // ... either F, M or n times
                  ) // end of replace()
                  )( // outer call to g:
                  y => // callback function taking y:
                  g( // inner call to g:
                  x => // callback function taking x:
                  '###+X#++' // figure out which character to use
                  [y + x * 5 & 7] // by applying a small hash function to (x, y)
                  + ' ', // append a space
                  w // repeat the painting part w times
                  ) // end of inner call
                  + 'n', // append a line feed
                  h // repeat the painting part h times
                  ) // end of outer call






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 7 hours ago

























                  answered 8 hours ago









                  ArnauldArnauld

                  79.1k795328




                  79.1k795328





















                      3












                      $begingroup$


                      Python 2, 98 bytes





                      w,h,a,b=input()
                      a*='+'
                      b*='#'
                      for c in b+a+h*'X'+a+b:print' '.join(min(c,d)for d in b+a+w*'X'+a+b)


                      Try it online!



                      Prints a space-separated grid, strictly following the spec. I'm amused that *= is used to convert a and b from numbers to strings.



                      Python 3 can save some bytes by avoiding ' '.join, maybe more by using f-strings and assignment expressions.



                      Python 3, 95 bytes





                      def f(w,h,a,b):
                      a*='+';b*='#'
                      for c in b+a+h*'X'+a+b:print(*[min(c,d)for d in b+a+w*'X'+a+b])


                      Try it online!






                      share|improve this answer









                      $endgroup$












                      • $begingroup$
                        93 bytes for Python 3
                        $endgroup$
                        – Jo King
                        7 hours ago















                      3












                      $begingroup$


                      Python 2, 98 bytes





                      w,h,a,b=input()
                      a*='+'
                      b*='#'
                      for c in b+a+h*'X'+a+b:print' '.join(min(c,d)for d in b+a+w*'X'+a+b)


                      Try it online!



                      Prints a space-separated grid, strictly following the spec. I'm amused that *= is used to convert a and b from numbers to strings.



                      Python 3 can save some bytes by avoiding ' '.join, maybe more by using f-strings and assignment expressions.



                      Python 3, 95 bytes





                      def f(w,h,a,b):
                      a*='+';b*='#'
                      for c in b+a+h*'X'+a+b:print(*[min(c,d)for d in b+a+w*'X'+a+b])


                      Try it online!






                      share|improve this answer









                      $endgroup$












                      • $begingroup$
                        93 bytes for Python 3
                        $endgroup$
                        – Jo King
                        7 hours ago













                      3












                      3








                      3





                      $begingroup$


                      Python 2, 98 bytes





                      w,h,a,b=input()
                      a*='+'
                      b*='#'
                      for c in b+a+h*'X'+a+b:print' '.join(min(c,d)for d in b+a+w*'X'+a+b)


                      Try it online!



                      Prints a space-separated grid, strictly following the spec. I'm amused that *= is used to convert a and b from numbers to strings.



                      Python 3 can save some bytes by avoiding ' '.join, maybe more by using f-strings and assignment expressions.



                      Python 3, 95 bytes





                      def f(w,h,a,b):
                      a*='+';b*='#'
                      for c in b+a+h*'X'+a+b:print(*[min(c,d)for d in b+a+w*'X'+a+b])


                      Try it online!






                      share|improve this answer









                      $endgroup$




                      Python 2, 98 bytes





                      w,h,a,b=input()
                      a*='+'
                      b*='#'
                      for c in b+a+h*'X'+a+b:print' '.join(min(c,d)for d in b+a+w*'X'+a+b)


                      Try it online!



                      Prints a space-separated grid, strictly following the spec. I'm amused that *= is used to convert a and b from numbers to strings.



                      Python 3 can save some bytes by avoiding ' '.join, maybe more by using f-strings and assignment expressions.



                      Python 3, 95 bytes





                      def f(w,h,a,b):
                      a*='+';b*='#'
                      for c in b+a+h*'X'+a+b:print(*[min(c,d)for d in b+a+w*'X'+a+b])


                      Try it online!







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered 7 hours ago









                      xnorxnor

                      92.5k18188447




                      92.5k18188447











                      • $begingroup$
                        93 bytes for Python 3
                        $endgroup$
                        – Jo King
                        7 hours ago
















                      • $begingroup$
                        93 bytes for Python 3
                        $endgroup$
                        – Jo King
                        7 hours ago















                      $begingroup$
                      93 bytes for Python 3
                      $endgroup$
                      – Jo King
                      7 hours ago




                      $begingroup$
                      93 bytes for Python 3
                      $endgroup$
                      – Jo King
                      7 hours ago











                      2












                      $begingroup$


                      Charcoal, 48 47 44 bytes



                      ≔×NXθ≔×NXηFE+#×Nι«≔⁺ι⁺θιθ≔⁺ι⁺ηιη»Eη⪫⭆θ⌊⟦ιλ⟧ 


                      Try it online! Link is to verbose version of code. Note: Trailing space. Edit: Now uses @xnor's algorithm. Explanation:



                      ≔×NXθ≔×NXη


                      Input the width and height and convert them into strings of Xs.



                      FE+#×Nι


                      Loop over the characters + and #, converting them into strings of length given by the remaining two inputs. Then loop over those two strings.



                      «≔⁺ι⁺θιθ≔⁺ι⁺ηιη»


                      Prefix and suffix the painting with the strings for the matting and framing.



                      Eη⪫⭆θ⌊⟦ιλ⟧ 


                      Loop over the strings, taking the minimum of the horizontal and vertical characters, and then double-spacing the rows, implicitly printing each row on its own line.






                      share|improve this answer











                      $endgroup$

















                        2












                        $begingroup$


                        Charcoal, 48 47 44 bytes



                        ≔×NXθ≔×NXηFE+#×Nι«≔⁺ι⁺θιθ≔⁺ι⁺ηιη»Eη⪫⭆θ⌊⟦ιλ⟧ 


                        Try it online! Link is to verbose version of code. Note: Trailing space. Edit: Now uses @xnor's algorithm. Explanation:



                        ≔×NXθ≔×NXη


                        Input the width and height and convert them into strings of Xs.



                        FE+#×Nι


                        Loop over the characters + and #, converting them into strings of length given by the remaining two inputs. Then loop over those two strings.



                        «≔⁺ι⁺θιθ≔⁺ι⁺ηιη»


                        Prefix and suffix the painting with the strings for the matting and framing.



                        Eη⪫⭆θ⌊⟦ιλ⟧ 


                        Loop over the strings, taking the minimum of the horizontal and vertical characters, and then double-spacing the rows, implicitly printing each row on its own line.






                        share|improve this answer











                        $endgroup$















                          2












                          2








                          2





                          $begingroup$


                          Charcoal, 48 47 44 bytes



                          ≔×NXθ≔×NXηFE+#×Nι«≔⁺ι⁺θιθ≔⁺ι⁺ηιη»Eη⪫⭆θ⌊⟦ιλ⟧ 


                          Try it online! Link is to verbose version of code. Note: Trailing space. Edit: Now uses @xnor's algorithm. Explanation:



                          ≔×NXθ≔×NXη


                          Input the width and height and convert them into strings of Xs.



                          FE+#×Nι


                          Loop over the characters + and #, converting them into strings of length given by the remaining two inputs. Then loop over those two strings.



                          «≔⁺ι⁺θιθ≔⁺ι⁺ηιη»


                          Prefix and suffix the painting with the strings for the matting and framing.



                          Eη⪫⭆θ⌊⟦ιλ⟧ 


                          Loop over the strings, taking the minimum of the horizontal and vertical characters, and then double-spacing the rows, implicitly printing each row on its own line.






                          share|improve this answer











                          $endgroup$




                          Charcoal, 48 47 44 bytes



                          ≔×NXθ≔×NXηFE+#×Nι«≔⁺ι⁺θιθ≔⁺ι⁺ηιη»Eη⪫⭆θ⌊⟦ιλ⟧ 


                          Try it online! Link is to verbose version of code. Note: Trailing space. Edit: Now uses @xnor's algorithm. Explanation:



                          ≔×NXθ≔×NXη


                          Input the width and height and convert them into strings of Xs.



                          FE+#×Nι


                          Loop over the characters + and #, converting them into strings of length given by the remaining two inputs. Then loop over those two strings.



                          «≔⁺ι⁺θιθ≔⁺ι⁺ηιη»


                          Prefix and suffix the painting with the strings for the matting and framing.



                          Eη⪫⭆θ⌊⟦ιλ⟧ 


                          Loop over the strings, taking the minimum of the horizontal and vertical characters, and then double-spacing the rows, implicitly printing each row on its own line.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 16 mins ago

























                          answered 10 hours ago









                          NeilNeil

                          81.8k745178




                          81.8k745178





















                              1












                              $begingroup$


                              Python 3.8 (pre-release), 116 115 bytes





                              lambda a,b,c,d,e='#',f='+':"n".join((g:=[e*(a+2*c+2*d)]*d+[(h:=e*d)+f*(a+c*2)+h]*c)+[h+f*c+'X'*a+f*c+h]*b+g[::-1])


                              Try it online!



                              First attempt at golfing, will be improved soon.
                              a is width, b is height, c is matte width, and d is frame width.



                              -1 bytes using the := operator to define h as e * d



                              EXPLANATION:



                              lambda a,b,c,d,e='#',f='+': Define a lambda which takes in arguments a, b, c, and d (The width of the painting, the height of the painting, the padding of the matte, and the padding of the frame width, respectively). It also defines variables e and f as '#' and '+', respectively.
                              "n".join( Turn the list into a string, where each element is separated by newlines
                              (g:= Define g as (while still evaling the lists)...
                              [e*(a+2*c+2*d)]*d+ Form the top rows (the ones filled with hashtags)
                              [(h:=e*d)+f*(a+c*2)+h]*c Form the middle-top rows (uses := to golf this section)
                              )+
                              [h+f*c+'X'*a+f*c+h]*b+ Form the middle row
                              g[::-1] Uses g to golf the code (forms the entire middle-bottom-to-bottom)
                              )





                              share|improve this answer











                              $endgroup$












                              • $begingroup$
                                Removing the e assignment saves you two bytes, the f assignment isn't saving you anything
                                $endgroup$
                                – Jo King
                                7 hours ago















                              1












                              $begingroup$


                              Python 3.8 (pre-release), 116 115 bytes





                              lambda a,b,c,d,e='#',f='+':"n".join((g:=[e*(a+2*c+2*d)]*d+[(h:=e*d)+f*(a+c*2)+h]*c)+[h+f*c+'X'*a+f*c+h]*b+g[::-1])


                              Try it online!



                              First attempt at golfing, will be improved soon.
                              a is width, b is height, c is matte width, and d is frame width.



                              -1 bytes using the := operator to define h as e * d



                              EXPLANATION:



                              lambda a,b,c,d,e='#',f='+': Define a lambda which takes in arguments a, b, c, and d (The width of the painting, the height of the painting, the padding of the matte, and the padding of the frame width, respectively). It also defines variables e and f as '#' and '+', respectively.
                              "n".join( Turn the list into a string, where each element is separated by newlines
                              (g:= Define g as (while still evaling the lists)...
                              [e*(a+2*c+2*d)]*d+ Form the top rows (the ones filled with hashtags)
                              [(h:=e*d)+f*(a+c*2)+h]*c Form the middle-top rows (uses := to golf this section)
                              )+
                              [h+f*c+'X'*a+f*c+h]*b+ Form the middle row
                              g[::-1] Uses g to golf the code (forms the entire middle-bottom-to-bottom)
                              )





                              share|improve this answer











                              $endgroup$












                              • $begingroup$
                                Removing the e assignment saves you two bytes, the f assignment isn't saving you anything
                                $endgroup$
                                – Jo King
                                7 hours ago













                              1












                              1








                              1





                              $begingroup$


                              Python 3.8 (pre-release), 116 115 bytes





                              lambda a,b,c,d,e='#',f='+':"n".join((g:=[e*(a+2*c+2*d)]*d+[(h:=e*d)+f*(a+c*2)+h]*c)+[h+f*c+'X'*a+f*c+h]*b+g[::-1])


                              Try it online!



                              First attempt at golfing, will be improved soon.
                              a is width, b is height, c is matte width, and d is frame width.



                              -1 bytes using the := operator to define h as e * d



                              EXPLANATION:



                              lambda a,b,c,d,e='#',f='+': Define a lambda which takes in arguments a, b, c, and d (The width of the painting, the height of the painting, the padding of the matte, and the padding of the frame width, respectively). It also defines variables e and f as '#' and '+', respectively.
                              "n".join( Turn the list into a string, where each element is separated by newlines
                              (g:= Define g as (while still evaling the lists)...
                              [e*(a+2*c+2*d)]*d+ Form the top rows (the ones filled with hashtags)
                              [(h:=e*d)+f*(a+c*2)+h]*c Form the middle-top rows (uses := to golf this section)
                              )+
                              [h+f*c+'X'*a+f*c+h]*b+ Form the middle row
                              g[::-1] Uses g to golf the code (forms the entire middle-bottom-to-bottom)
                              )





                              share|improve this answer











                              $endgroup$




                              Python 3.8 (pre-release), 116 115 bytes





                              lambda a,b,c,d,e='#',f='+':"n".join((g:=[e*(a+2*c+2*d)]*d+[(h:=e*d)+f*(a+c*2)+h]*c)+[h+f*c+'X'*a+f*c+h]*b+g[::-1])


                              Try it online!



                              First attempt at golfing, will be improved soon.
                              a is width, b is height, c is matte width, and d is frame width.



                              -1 bytes using the := operator to define h as e * d



                              EXPLANATION:



                              lambda a,b,c,d,e='#',f='+': Define a lambda which takes in arguments a, b, c, and d (The width of the painting, the height of the painting, the padding of the matte, and the padding of the frame width, respectively). It also defines variables e and f as '#' and '+', respectively.
                              "n".join( Turn the list into a string, where each element is separated by newlines
                              (g:= Define g as (while still evaling the lists)...
                              [e*(a+2*c+2*d)]*d+ Form the top rows (the ones filled with hashtags)
                              [(h:=e*d)+f*(a+c*2)+h]*c Form the middle-top rows (uses := to golf this section)
                              )+
                              [h+f*c+'X'*a+f*c+h]*b+ Form the middle row
                              g[::-1] Uses g to golf the code (forms the entire middle-bottom-to-bottom)
                              )






                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited 9 hours ago

























                              answered 10 hours ago









                              MilkyWay90MilkyWay90

                              533212




                              533212











                              • $begingroup$
                                Removing the e assignment saves you two bytes, the f assignment isn't saving you anything
                                $endgroup$
                                – Jo King
                                7 hours ago
















                              • $begingroup$
                                Removing the e assignment saves you two bytes, the f assignment isn't saving you anything
                                $endgroup$
                                – Jo King
                                7 hours ago















                              $begingroup$
                              Removing the e assignment saves you two bytes, the f assignment isn't saving you anything
                              $endgroup$
                              – Jo King
                              7 hours ago




                              $begingroup$
                              Removing the e assignment saves you two bytes, the f assignment isn't saving you anything
                              $endgroup$
                              – Jo King
                              7 hours ago











                              1












                              $begingroup$


                              Wolfram Language (Mathematica), 142 bytes



                              (t=(p=Table)["# ",2(c=#4+#3)+#2,2c+#];p[t[[i,j]]="+ ",j,z=#4+1,c+#3+#,i,z,c+#3+#2];p[t[[i,j]]="X ",j,#3+z,c+#,i,#3+z,c+#2];""<>#&/@t)&


                              Try it online!






                              share|improve this answer











                              $endgroup$

















                                1












                                $begingroup$


                                Wolfram Language (Mathematica), 142 bytes



                                (t=(p=Table)["# ",2(c=#4+#3)+#2,2c+#];p[t[[i,j]]="+ ",j,z=#4+1,c+#3+#,i,z,c+#3+#2];p[t[[i,j]]="X ",j,#3+z,c+#,i,#3+z,c+#2];""<>#&/@t)&


                                Try it online!






                                share|improve this answer











                                $endgroup$















                                  1












                                  1








                                  1





                                  $begingroup$


                                  Wolfram Language (Mathematica), 142 bytes



                                  (t=(p=Table)["# ",2(c=#4+#3)+#2,2c+#];p[t[[i,j]]="+ ",j,z=#4+1,c+#3+#,i,z,c+#3+#2];p[t[[i,j]]="X ",j,#3+z,c+#,i,#3+z,c+#2];""<>#&/@t)&


                                  Try it online!






                                  share|improve this answer











                                  $endgroup$




                                  Wolfram Language (Mathematica), 142 bytes



                                  (t=(p=Table)["# ",2(c=#4+#3)+#2,2c+#];p[t[[i,j]]="+ ",j,z=#4+1,c+#3+#,i,z,c+#3+#2];p[t[[i,j]]="X ",j,#3+z,c+#,i,#3+z,c+#2];""<>#&/@t)&


                                  Try it online!







                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited 1 hour ago

























                                  answered 9 hours ago









                                  J42161217J42161217

                                  13.3k21251




                                  13.3k21251





















                                      1












                                      $begingroup$


                                      05AB1E (legacy), 32 31 bytes



                                      и'Xׄ+#vyI©×UεX.ø}®FDнgy×.ø]€S»


                                      Takes the input in the order height, width, matte, frame. If the input order specified in the challenge is strict (still waiting on OP for verification), a leading s (swap) can be added for +1 byte.



                                      Uses the legacy version of 05AB1E instead of the new version, because there seems to be a weird bug with the surround in a map and loop..



                                      Try it online.



                                      Explanation:





                                      и # Repeat the second (implicit) input the first (implicit) input amount of
                                      # times as list
                                      'X× '# Repeat "X" that many times
                                      „+#v # Loop `y` over the characters ["+","#"]:
                                      y # Push character `y`
                                      I # Push the next input (matte in the first iteration; frame in the second)
                                      © # And store it in the register (without popping)
                                      × # Repeat character `y` that input amount of times
                                      U # Pop and store that string in variable `X`
                                      εX.ø} # Surround each string in the list with string `X`
                                      ®F # Inner loop the value from the register amount of times:
                                      Dнg # Get the new width by taking the length of the first string
                                      y× # Repeat character `y` that many times
                                      .ø # And surround the list with this leading and trailing string
                                      ] # Close both the inner and outer loops
                                      €S # Convert each inner string to a list of characters
                                      » # Join every list of characters by spaces, and then every string by newlines
                                      # (and output the result implicitly)





                                      share|improve this answer











                                      $endgroup$

















                                        1












                                        $begingroup$


                                        05AB1E (legacy), 32 31 bytes



                                        и'Xׄ+#vyI©×UεX.ø}®FDнgy×.ø]€S»


                                        Takes the input in the order height, width, matte, frame. If the input order specified in the challenge is strict (still waiting on OP for verification), a leading s (swap) can be added for +1 byte.



                                        Uses the legacy version of 05AB1E instead of the new version, because there seems to be a weird bug with the surround in a map and loop..



                                        Try it online.



                                        Explanation:





                                        и # Repeat the second (implicit) input the first (implicit) input amount of
                                        # times as list
                                        'X× '# Repeat "X" that many times
                                        „+#v # Loop `y` over the characters ["+","#"]:
                                        y # Push character `y`
                                        I # Push the next input (matte in the first iteration; frame in the second)
                                        © # And store it in the register (without popping)
                                        × # Repeat character `y` that input amount of times
                                        U # Pop and store that string in variable `X`
                                        εX.ø} # Surround each string in the list with string `X`
                                        ®F # Inner loop the value from the register amount of times:
                                        Dнg # Get the new width by taking the length of the first string
                                        y× # Repeat character `y` that many times
                                        .ø # And surround the list with this leading and trailing string
                                        ] # Close both the inner and outer loops
                                        €S # Convert each inner string to a list of characters
                                        » # Join every list of characters by spaces, and then every string by newlines
                                        # (and output the result implicitly)





                                        share|improve this answer











                                        $endgroup$















                                          1












                                          1








                                          1





                                          $begingroup$


                                          05AB1E (legacy), 32 31 bytes



                                          и'Xׄ+#vyI©×UεX.ø}®FDнgy×.ø]€S»


                                          Takes the input in the order height, width, matte, frame. If the input order specified in the challenge is strict (still waiting on OP for verification), a leading s (swap) can be added for +1 byte.



                                          Uses the legacy version of 05AB1E instead of the new version, because there seems to be a weird bug with the surround in a map and loop..



                                          Try it online.



                                          Explanation:





                                          и # Repeat the second (implicit) input the first (implicit) input amount of
                                          # times as list
                                          'X× '# Repeat "X" that many times
                                          „+#v # Loop `y` over the characters ["+","#"]:
                                          y # Push character `y`
                                          I # Push the next input (matte in the first iteration; frame in the second)
                                          © # And store it in the register (without popping)
                                          × # Repeat character `y` that input amount of times
                                          U # Pop and store that string in variable `X`
                                          εX.ø} # Surround each string in the list with string `X`
                                          ®F # Inner loop the value from the register amount of times:
                                          Dнg # Get the new width by taking the length of the first string
                                          y× # Repeat character `y` that many times
                                          .ø # And surround the list with this leading and trailing string
                                          ] # Close both the inner and outer loops
                                          €S # Convert each inner string to a list of characters
                                          » # Join every list of characters by spaces, and then every string by newlines
                                          # (and output the result implicitly)





                                          share|improve this answer











                                          $endgroup$




                                          05AB1E (legacy), 32 31 bytes



                                          и'Xׄ+#vyI©×UεX.ø}®FDнgy×.ø]€S»


                                          Takes the input in the order height, width, matte, frame. If the input order specified in the challenge is strict (still waiting on OP for verification), a leading s (swap) can be added for +1 byte.



                                          Uses the legacy version of 05AB1E instead of the new version, because there seems to be a weird bug with the surround in a map and loop..



                                          Try it online.



                                          Explanation:





                                          и # Repeat the second (implicit) input the first (implicit) input amount of
                                          # times as list
                                          'X× '# Repeat "X" that many times
                                          „+#v # Loop `y` over the characters ["+","#"]:
                                          y # Push character `y`
                                          I # Push the next input (matte in the first iteration; frame in the second)
                                          © # And store it in the register (without popping)
                                          × # Repeat character `y` that input amount of times
                                          U # Pop and store that string in variable `X`
                                          εX.ø} # Surround each string in the list with string `X`
                                          ®F # Inner loop the value from the register amount of times:
                                          Dнg # Get the new width by taking the length of the first string
                                          y× # Repeat character `y` that many times
                                          .ø # And surround the list with this leading and trailing string
                                          ] # Close both the inner and outer loops
                                          €S # Convert each inner string to a list of characters
                                          » # Join every list of characters by spaces, and then every string by newlines
                                          # (and output the result implicitly)






                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited 37 mins ago

























                                          answered 56 mins ago









                                          Kevin CruijssenKevin Cruijssen

                                          40.7k566210




                                          40.7k566210





















                                              0












                                              $begingroup$

                                              Javascript, 158 bytes



                                              (w,h,m,f)=>(q="repeat",(z=("#"[q](w+2*(m+f)))+`
                                              `)[q](f))+(x=((e="#"[q](f))+(r="+"[q](m))+(t="+"[q](w))+r+e+`
                                              `)[q](m))+(e+r+"X"[q](w)+r+e+`
                                              `)[q](h)+x+z)


                                              Can probably be trimmed down a little bit






                                              f=

                                              (w,h,m,f)=>(q="repeat",(z=("# "[q](w+2*(m+f))+`
                                              `)[q](f))+(x=((e="# "[q](f))+(r="+ "[q](m))+(t="+ "[q](w))+r+e+`
                                              `)[q](m))+(e+r+"X "[q](w)+r+e+`
                                              `)[q](h)+x+z)

                                              console.log(f(3,2,1,2))








                                              share|improve this answer









                                              $endgroup$

















                                                0












                                                $begingroup$

                                                Javascript, 158 bytes



                                                (w,h,m,f)=>(q="repeat",(z=("#"[q](w+2*(m+f)))+`
                                                `)[q](f))+(x=((e="#"[q](f))+(r="+"[q](m))+(t="+"[q](w))+r+e+`
                                                `)[q](m))+(e+r+"X"[q](w)+r+e+`
                                                `)[q](h)+x+z)


                                                Can probably be trimmed down a little bit






                                                f=

                                                (w,h,m,f)=>(q="repeat",(z=("# "[q](w+2*(m+f))+`
                                                `)[q](f))+(x=((e="# "[q](f))+(r="+ "[q](m))+(t="+ "[q](w))+r+e+`
                                                `)[q](m))+(e+r+"X "[q](w)+r+e+`
                                                `)[q](h)+x+z)

                                                console.log(f(3,2,1,2))








                                                share|improve this answer









                                                $endgroup$















                                                  0












                                                  0








                                                  0





                                                  $begingroup$

                                                  Javascript, 158 bytes



                                                  (w,h,m,f)=>(q="repeat",(z=("#"[q](w+2*(m+f)))+`
                                                  `)[q](f))+(x=((e="#"[q](f))+(r="+"[q](m))+(t="+"[q](w))+r+e+`
                                                  `)[q](m))+(e+r+"X"[q](w)+r+e+`
                                                  `)[q](h)+x+z)


                                                  Can probably be trimmed down a little bit






                                                  f=

                                                  (w,h,m,f)=>(q="repeat",(z=("# "[q](w+2*(m+f))+`
                                                  `)[q](f))+(x=((e="# "[q](f))+(r="+ "[q](m))+(t="+ "[q](w))+r+e+`
                                                  `)[q](m))+(e+r+"X "[q](w)+r+e+`
                                                  `)[q](h)+x+z)

                                                  console.log(f(3,2,1,2))








                                                  share|improve this answer









                                                  $endgroup$



                                                  Javascript, 158 bytes



                                                  (w,h,m,f)=>(q="repeat",(z=("#"[q](w+2*(m+f)))+`
                                                  `)[q](f))+(x=((e="#"[q](f))+(r="+"[q](m))+(t="+"[q](w))+r+e+`
                                                  `)[q](m))+(e+r+"X"[q](w)+r+e+`
                                                  `)[q](h)+x+z)


                                                  Can probably be trimmed down a little bit






                                                  f=

                                                  (w,h,m,f)=>(q="repeat",(z=("# "[q](w+2*(m+f))+`
                                                  `)[q](f))+(x=((e="# "[q](f))+(r="+ "[q](m))+(t="+ "[q](w))+r+e+`
                                                  `)[q](m))+(e+r+"X "[q](w)+r+e+`
                                                  `)[q](h)+x+z)

                                                  console.log(f(3,2,1,2))








                                                  f=

                                                  (w,h,m,f)=>(q="repeat",(z=("# "[q](w+2*(m+f))+`
                                                  `)[q](f))+(x=((e="# "[q](f))+(r="+ "[q](m))+(t="+ "[q](w))+r+e+`
                                                  `)[q](m))+(e+r+"X "[q](w)+r+e+`
                                                  `)[q](h)+x+z)

                                                  console.log(f(3,2,1,2))





                                                  f=

                                                  (w,h,m,f)=>(q="repeat",(z=("# "[q](w+2*(m+f))+`
                                                  `)[q](f))+(x=((e="# "[q](f))+(r="+ "[q](m))+(t="+ "[q](w))+r+e+`
                                                  `)[q](m))+(e+r+"X "[q](w)+r+e+`
                                                  `)[q](h)+x+z)

                                                  console.log(f(3,2,1,2))






                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered 9 hours ago









                                                  zeveezevee

                                                  57029




                                                  57029





















                                                      0












                                                      $begingroup$


                                                      Perl 6, 98 bytes





                                                      map(&min,[X] map (($_='#'x$^d~'+'x$^c)~'X'x*~.flip).comb,$^a,$^b).rotor($b+2*($c+$d)).join("n")


                                                      Try it online!



                                                      This is a port of xnor's Python answer.




                                                      Perl 6, 115 bytes





                                                      ->a,b,c,d$_=['#'xx$!*2+a]xx($!=c+d)*2+b;.[d..^*-d;d..^a+$!+c]='+'xx*;.[$!..^*-$!;$!..^a+$!]='X'xx*;.join("
                                                      ")


                                                      Try it online!



                                                      Roughly golfed anonymous codeblock utilising Perl 6's multi-dimensional list assignment. For example, @a[1;2] = 'X'; will assign 'X' to the element with index 2 from the list with index 1, and @a[1,2,3;3,4,5]='X'xx 9; will replace all the elements with indexes 3,4,5 of the lists with indexes 1,2,3 with 'X'.



                                                      Explanation:



                                                      First, we initialise the list as a a+2*(c+d) by b+2*(c+d) rectangle of #s.



                                                      $_=['#'xx$!*2+a]xx($!=c+d)*2+a;
                                                      State:
                                                      # # # # # # # # #
                                                      # # # # # # # # #
                                                      # # # # # # # # #
                                                      # # # # # # # # #
                                                      # # # # # # # # #
                                                      # # # # # # # # #
                                                      # # # # # # # # #
                                                      # # # # # # # # #


                                                      Then we assign the inner rectangle of +s



                                                      .[d..^*-d;d..^a+$!+c]='+'xx*;
                                                      State:
                                                      # # # # # # # # #
                                                      # # # # # # # # #
                                                      # # + + + + + # #
                                                      # # + + + + + # #
                                                      # # + + + + + # #
                                                      # # + + + + + # #
                                                      # # # # # # # # #
                                                      # # # # # # # # #


                                                      Finally, the innermost rectangle of Xs.



                                                      .[$!..^*-$!;$!..^a+$!]='X'xx*;
                                                      # # # # # # # # #
                                                      # # # # # # # # #
                                                      # # + + + + + # #
                                                      # # + X X X + # #
                                                      # # + X X X + # #
                                                      # # + + + + + # #
                                                      # # # # # # # # #
                                                      # # # # # # # # #





                                                      share|improve this answer











                                                      $endgroup$

















                                                        0












                                                        $begingroup$


                                                        Perl 6, 98 bytes





                                                        map(&min,[X] map (($_='#'x$^d~'+'x$^c)~'X'x*~.flip).comb,$^a,$^b).rotor($b+2*($c+$d)).join("n")


                                                        Try it online!



                                                        This is a port of xnor's Python answer.




                                                        Perl 6, 115 bytes





                                                        ->a,b,c,d$_=['#'xx$!*2+a]xx($!=c+d)*2+b;.[d..^*-d;d..^a+$!+c]='+'xx*;.[$!..^*-$!;$!..^a+$!]='X'xx*;.join("
                                                        ")


                                                        Try it online!



                                                        Roughly golfed anonymous codeblock utilising Perl 6's multi-dimensional list assignment. For example, @a[1;2] = 'X'; will assign 'X' to the element with index 2 from the list with index 1, and @a[1,2,3;3,4,5]='X'xx 9; will replace all the elements with indexes 3,4,5 of the lists with indexes 1,2,3 with 'X'.



                                                        Explanation:



                                                        First, we initialise the list as a a+2*(c+d) by b+2*(c+d) rectangle of #s.



                                                        $_=['#'xx$!*2+a]xx($!=c+d)*2+a;
                                                        State:
                                                        # # # # # # # # #
                                                        # # # # # # # # #
                                                        # # # # # # # # #
                                                        # # # # # # # # #
                                                        # # # # # # # # #
                                                        # # # # # # # # #
                                                        # # # # # # # # #
                                                        # # # # # # # # #


                                                        Then we assign the inner rectangle of +s



                                                        .[d..^*-d;d..^a+$!+c]='+'xx*;
                                                        State:
                                                        # # # # # # # # #
                                                        # # # # # # # # #
                                                        # # + + + + + # #
                                                        # # + + + + + # #
                                                        # # + + + + + # #
                                                        # # + + + + + # #
                                                        # # # # # # # # #
                                                        # # # # # # # # #


                                                        Finally, the innermost rectangle of Xs.



                                                        .[$!..^*-$!;$!..^a+$!]='X'xx*;
                                                        # # # # # # # # #
                                                        # # # # # # # # #
                                                        # # + + + + + # #
                                                        # # + X X X + # #
                                                        # # + X X X + # #
                                                        # # + + + + + # #
                                                        # # # # # # # # #
                                                        # # # # # # # # #





                                                        share|improve this answer











                                                        $endgroup$















                                                          0












                                                          0








                                                          0





                                                          $begingroup$


                                                          Perl 6, 98 bytes





                                                          map(&min,[X] map (($_='#'x$^d~'+'x$^c)~'X'x*~.flip).comb,$^a,$^b).rotor($b+2*($c+$d)).join("n")


                                                          Try it online!



                                                          This is a port of xnor's Python answer.




                                                          Perl 6, 115 bytes





                                                          ->a,b,c,d$_=['#'xx$!*2+a]xx($!=c+d)*2+b;.[d..^*-d;d..^a+$!+c]='+'xx*;.[$!..^*-$!;$!..^a+$!]='X'xx*;.join("
                                                          ")


                                                          Try it online!



                                                          Roughly golfed anonymous codeblock utilising Perl 6's multi-dimensional list assignment. For example, @a[1;2] = 'X'; will assign 'X' to the element with index 2 from the list with index 1, and @a[1,2,3;3,4,5]='X'xx 9; will replace all the elements with indexes 3,4,5 of the lists with indexes 1,2,3 with 'X'.



                                                          Explanation:



                                                          First, we initialise the list as a a+2*(c+d) by b+2*(c+d) rectangle of #s.



                                                          $_=['#'xx$!*2+a]xx($!=c+d)*2+a;
                                                          State:
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #


                                                          Then we assign the inner rectangle of +s



                                                          .[d..^*-d;d..^a+$!+c]='+'xx*;
                                                          State:
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # + + + + + # #
                                                          # # + + + + + # #
                                                          # # + + + + + # #
                                                          # # + + + + + # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #


                                                          Finally, the innermost rectangle of Xs.



                                                          .[$!..^*-$!;$!..^a+$!]='X'xx*;
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # + + + + + # #
                                                          # # + X X X + # #
                                                          # # + X X X + # #
                                                          # # + + + + + # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #





                                                          share|improve this answer











                                                          $endgroup$




                                                          Perl 6, 98 bytes





                                                          map(&min,[X] map (($_='#'x$^d~'+'x$^c)~'X'x*~.flip).comb,$^a,$^b).rotor($b+2*($c+$d)).join("n")


                                                          Try it online!



                                                          This is a port of xnor's Python answer.




                                                          Perl 6, 115 bytes





                                                          ->a,b,c,d$_=['#'xx$!*2+a]xx($!=c+d)*2+b;.[d..^*-d;d..^a+$!+c]='+'xx*;.[$!..^*-$!;$!..^a+$!]='X'xx*;.join("
                                                          ")


                                                          Try it online!



                                                          Roughly golfed anonymous codeblock utilising Perl 6's multi-dimensional list assignment. For example, @a[1;2] = 'X'; will assign 'X' to the element with index 2 from the list with index 1, and @a[1,2,3;3,4,5]='X'xx 9; will replace all the elements with indexes 3,4,5 of the lists with indexes 1,2,3 with 'X'.



                                                          Explanation:



                                                          First, we initialise the list as a a+2*(c+d) by b+2*(c+d) rectangle of #s.



                                                          $_=['#'xx$!*2+a]xx($!=c+d)*2+a;
                                                          State:
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #


                                                          Then we assign the inner rectangle of +s



                                                          .[d..^*-d;d..^a+$!+c]='+'xx*;
                                                          State:
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # + + + + + # #
                                                          # # + + + + + # #
                                                          # # + + + + + # #
                                                          # # + + + + + # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #


                                                          Finally, the innermost rectangle of Xs.



                                                          .[$!..^*-$!;$!..^a+$!]='X'xx*;
                                                          # # # # # # # # #
                                                          # # # # # # # # #
                                                          # # + + + + + # #
                                                          # # + X X X + # #
                                                          # # + X X X + # #
                                                          # # + + + + + # #
                                                          # # # # # # # # #
                                                          # # # # # # # # #






                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited 7 hours ago

























                                                          answered 7 hours ago









                                                          Jo KingJo King

                                                          25k359128




                                                          25k359128





















                                                              0












                                                              $begingroup$


                                                              Jelly, 35 31 bytes



                                                              ⁽Q=,⁽QƙDị€x@€⁽-FD¤«þƝẎị“#+X”K€Y


                                                              Try it online!



                                                              Takes the input in the order matte, frame, width, height; comma separated. Outputs the ASCII-art picture with frame and matte. If the input order is strict I’d need to add 4 bytes (as per my original post).






                                                              share|improve this answer











                                                              $endgroup$












                                                              • $begingroup$
                                                                I never program in Jelly, but surely 43134,43234 can be compressed? EDIT: I need to learn to read, you mention they can indeed be encoded in 4 bytes each. But what has the input-order to do with whether these numbers can be encoded or not? :S
                                                                $endgroup$
                                                                – Kevin Cruijssen
                                                                32 mins ago











                                                              • $begingroup$
                                                                @KevinCruijssen the maximum integer that can be encoded using the two byte syntax is 32250; since both exceed that I can’t save the bytes. For now I’ll assume I can swap things around and revert if it’s not allowed!
                                                                $endgroup$
                                                                – Nick Kennedy
                                                                29 mins ago










                                                              • $begingroup$
                                                                Ah ok, I see. 43134 will need 3 encoding characters, which including a leading/trailing character to indicate it's encoded will be 5 bytes as well. And does Jelly perhaps have a duplicate of some sort, since the second number is 100 larger than the first? Not sure if the actions push 43134, duplicate, push 100, plus, pair is possible and shorter in Jelly?
                                                                $endgroup$
                                                                – Kevin Cruijssen
                                                                21 mins ago











                                                              • $begingroup$
                                                                @KevinCruijssen I originally tried that using +0,100 which doesn’t save any. I think I could use a nilad chain to use the fact that in a nilad ³ is 100, but if I’m allowed to reorder inputs the base 250 integers are better
                                                                $endgroup$
                                                                – Nick Kennedy
                                                                16 mins ago















                                                              0












                                                              $begingroup$


                                                              Jelly, 35 31 bytes



                                                              ⁽Q=,⁽QƙDị€x@€⁽-FD¤«þƝẎị“#+X”K€Y


                                                              Try it online!



                                                              Takes the input in the order matte, frame, width, height; comma separated. Outputs the ASCII-art picture with frame and matte. If the input order is strict I’d need to add 4 bytes (as per my original post).






                                                              share|improve this answer











                                                              $endgroup$












                                                              • $begingroup$
                                                                I never program in Jelly, but surely 43134,43234 can be compressed? EDIT: I need to learn to read, you mention they can indeed be encoded in 4 bytes each. But what has the input-order to do with whether these numbers can be encoded or not? :S
                                                                $endgroup$
                                                                – Kevin Cruijssen
                                                                32 mins ago











                                                              • $begingroup$
                                                                @KevinCruijssen the maximum integer that can be encoded using the two byte syntax is 32250; since both exceed that I can’t save the bytes. For now I’ll assume I can swap things around and revert if it’s not allowed!
                                                                $endgroup$
                                                                – Nick Kennedy
                                                                29 mins ago










                                                              • $begingroup$
                                                                Ah ok, I see. 43134 will need 3 encoding characters, which including a leading/trailing character to indicate it's encoded will be 5 bytes as well. And does Jelly perhaps have a duplicate of some sort, since the second number is 100 larger than the first? Not sure if the actions push 43134, duplicate, push 100, plus, pair is possible and shorter in Jelly?
                                                                $endgroup$
                                                                – Kevin Cruijssen
                                                                21 mins ago











                                                              • $begingroup$
                                                                @KevinCruijssen I originally tried that using +0,100 which doesn’t save any. I think I could use a nilad chain to use the fact that in a nilad ³ is 100, but if I’m allowed to reorder inputs the base 250 integers are better
                                                                $endgroup$
                                                                – Nick Kennedy
                                                                16 mins ago













                                                              0












                                                              0








                                                              0





                                                              $begingroup$


                                                              Jelly, 35 31 bytes



                                                              ⁽Q=,⁽QƙDị€x@€⁽-FD¤«þƝẎị“#+X”K€Y


                                                              Try it online!



                                                              Takes the input in the order matte, frame, width, height; comma separated. Outputs the ASCII-art picture with frame and matte. If the input order is strict I’d need to add 4 bytes (as per my original post).






                                                              share|improve this answer











                                                              $endgroup$




                                                              Jelly, 35 31 bytes



                                                              ⁽Q=,⁽QƙDị€x@€⁽-FD¤«þƝẎị“#+X”K€Y


                                                              Try it online!



                                                              Takes the input in the order matte, frame, width, height; comma separated. Outputs the ASCII-art picture with frame and matte. If the input order is strict I’d need to add 4 bytes (as per my original post).







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited 19 mins ago

























                                                              answered 2 hours ago









                                                              Nick KennedyNick Kennedy

                                                              77137




                                                              77137











                                                              • $begingroup$
                                                                I never program in Jelly, but surely 43134,43234 can be compressed? EDIT: I need to learn to read, you mention they can indeed be encoded in 4 bytes each. But what has the input-order to do with whether these numbers can be encoded or not? :S
                                                                $endgroup$
                                                                – Kevin Cruijssen
                                                                32 mins ago











                                                              • $begingroup$
                                                                @KevinCruijssen the maximum integer that can be encoded using the two byte syntax is 32250; since both exceed that I can’t save the bytes. For now I’ll assume I can swap things around and revert if it’s not allowed!
                                                                $endgroup$
                                                                – Nick Kennedy
                                                                29 mins ago










                                                              • $begingroup$
                                                                Ah ok, I see. 43134 will need 3 encoding characters, which including a leading/trailing character to indicate it's encoded will be 5 bytes as well. And does Jelly perhaps have a duplicate of some sort, since the second number is 100 larger than the first? Not sure if the actions push 43134, duplicate, push 100, plus, pair is possible and shorter in Jelly?
                                                                $endgroup$
                                                                – Kevin Cruijssen
                                                                21 mins ago











                                                              • $begingroup$
                                                                @KevinCruijssen I originally tried that using +0,100 which doesn’t save any. I think I could use a nilad chain to use the fact that in a nilad ³ is 100, but if I’m allowed to reorder inputs the base 250 integers are better
                                                                $endgroup$
                                                                – Nick Kennedy
                                                                16 mins ago
















                                                              • $begingroup$
                                                                I never program in Jelly, but surely 43134,43234 can be compressed? EDIT: I need to learn to read, you mention they can indeed be encoded in 4 bytes each. But what has the input-order to do with whether these numbers can be encoded or not? :S
                                                                $endgroup$
                                                                – Kevin Cruijssen
                                                                32 mins ago











                                                              • $begingroup$
                                                                @KevinCruijssen the maximum integer that can be encoded using the two byte syntax is 32250; since both exceed that I can’t save the bytes. For now I’ll assume I can swap things around and revert if it’s not allowed!
                                                                $endgroup$
                                                                – Nick Kennedy
                                                                29 mins ago










                                                              • $begingroup$
                                                                Ah ok, I see. 43134 will need 3 encoding characters, which including a leading/trailing character to indicate it's encoded will be 5 bytes as well. And does Jelly perhaps have a duplicate of some sort, since the second number is 100 larger than the first? Not sure if the actions push 43134, duplicate, push 100, plus, pair is possible and shorter in Jelly?
                                                                $endgroup$
                                                                – Kevin Cruijssen
                                                                21 mins ago











                                                              • $begingroup$
                                                                @KevinCruijssen I originally tried that using +0,100 which doesn’t save any. I think I could use a nilad chain to use the fact that in a nilad ³ is 100, but if I’m allowed to reorder inputs the base 250 integers are better
                                                                $endgroup$
                                                                – Nick Kennedy
                                                                16 mins ago















                                                              $begingroup$
                                                              I never program in Jelly, but surely 43134,43234 can be compressed? EDIT: I need to learn to read, you mention they can indeed be encoded in 4 bytes each. But what has the input-order to do with whether these numbers can be encoded or not? :S
                                                              $endgroup$
                                                              – Kevin Cruijssen
                                                              32 mins ago





                                                              $begingroup$
                                                              I never program in Jelly, but surely 43134,43234 can be compressed? EDIT: I need to learn to read, you mention they can indeed be encoded in 4 bytes each. But what has the input-order to do with whether these numbers can be encoded or not? :S
                                                              $endgroup$
                                                              – Kevin Cruijssen
                                                              32 mins ago













                                                              $begingroup$
                                                              @KevinCruijssen the maximum integer that can be encoded using the two byte syntax is 32250; since both exceed that I can’t save the bytes. For now I’ll assume I can swap things around and revert if it’s not allowed!
                                                              $endgroup$
                                                              – Nick Kennedy
                                                              29 mins ago




                                                              $begingroup$
                                                              @KevinCruijssen the maximum integer that can be encoded using the two byte syntax is 32250; since both exceed that I can’t save the bytes. For now I’ll assume I can swap things around and revert if it’s not allowed!
                                                              $endgroup$
                                                              – Nick Kennedy
                                                              29 mins ago












                                                              $begingroup$
                                                              Ah ok, I see. 43134 will need 3 encoding characters, which including a leading/trailing character to indicate it's encoded will be 5 bytes as well. And does Jelly perhaps have a duplicate of some sort, since the second number is 100 larger than the first? Not sure if the actions push 43134, duplicate, push 100, plus, pair is possible and shorter in Jelly?
                                                              $endgroup$
                                                              – Kevin Cruijssen
                                                              21 mins ago





                                                              $begingroup$
                                                              Ah ok, I see. 43134 will need 3 encoding characters, which including a leading/trailing character to indicate it's encoded will be 5 bytes as well. And does Jelly perhaps have a duplicate of some sort, since the second number is 100 larger than the first? Not sure if the actions push 43134, duplicate, push 100, plus, pair is possible and shorter in Jelly?
                                                              $endgroup$
                                                              – Kevin Cruijssen
                                                              21 mins ago













                                                              $begingroup$
                                                              @KevinCruijssen I originally tried that using +0,100 which doesn’t save any. I think I could use a nilad chain to use the fact that in a nilad ³ is 100, but if I’m allowed to reorder inputs the base 250 integers are better
                                                              $endgroup$
                                                              – Nick Kennedy
                                                              16 mins ago




                                                              $begingroup$
                                                              @KevinCruijssen I originally tried that using +0,100 which doesn’t save any. I think I could use a nilad chain to use the fact that in a nilad ³ is 100, but if I’m allowed to reorder inputs the base 250 integers are better
                                                              $endgroup$
                                                              – Nick Kennedy
                                                              16 mins ago










                                                              George Harris is a new contributor. Be nice, and check out our Code of Conduct.









                                                              draft saved

                                                              draft discarded


















                                                              George Harris is a new contributor. Be nice, and check out our Code of Conduct.












                                                              George Harris is a new contributor. Be nice, and check out our Code of Conduct.











                                                              George Harris is a new contributor. Be nice, and check out our Code of Conduct.














                                                              If this is an answer to a challenge…



                                                              • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                              • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                Explanations of your answer make it more interesting to read and are very much encouraged.


                                                              • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


                                                              More generally…



                                                              • …Please make sure to answer the question and provide sufficient detail.


                                                              • …Avoid asking for help, clarification or responding to other answers (use comments instead).




                                                              draft saved


                                                              draft discarded














                                                              StackExchange.ready(
                                                              function ()
                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f181763%2foutput-visual-diagram-of-picture%23new-answer', 'question_page');

                                                              );

                                                              Post as a guest















                                                              Required, but never shown





















































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown

































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown







                                                              Popular posts from this blog

                                                              The Calvary Singular or Plural The 2019 Stack Overflow Developer Survey Results Are InAre collective nouns always plural, or are certain ones singular?Is “audience” singular or plural?“Wasn't” vs. “weren't” in a vernacular sentence“My last couple of years” — singular or plural?Is 'rest' singular or plural?Is “all but one” singular or plural?Whether to use the singular or plural form of basis?Singular and Plural for numbersIs there a plural form of teeth?performance: plural vs singular?singular or plural nouns?Singular and Plural

                                                              How does one intimidate enemies without having the capacity for violence?Ideas for how aliens would approach this fight?How to convey the scale of my humanoid without science or units?How does the “space drive” conserve momentum?Planet Vanishes - How does this affect the orbiting starships?How does a community of a Universe Simulator have the same language as its creator?How would US Presidential elections be affected if voters could choose the state their vote for President was counted in?How Does One Ensures the Immortality of Their ConsciousnessHow do I retain national independence while also having a one world government?How can Ganymede have an Earth-like gravity without us having realized it?How would one make a lion mount for a fantasy world?