Belarus rushnyk

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
19
down vote

favorite
1












We've got quite a few national flag challenges already:
AU
CH
FI
FR
GB
GB
IS
KR
NP
US...
Here's another, somewhat more advanced one:



Return or print the decorative pattern from Belarus's national flag as a matrix of two distinct values for red and white.



rushnyk



If your language doesn't support matrices, use a list of lists or the closest equivalent.
Extra whitespace is allowed on all sides.
The matrix can be transposed.
The elements can have a consistent separator, and so can the rows, e.g. output can be JSON.
You must use the 2012 version of the ornament pattern, not the 1951 or 1995 versions.
This is code-golf, so the shortest answer per language wins.



Sample output:



....###....#....###....
#..#####...#...#####..#
..###.###.....###.###..
.###...###...###...###.
###..#..###.###..#..###
.###...###...###...###.
..###.###.....###.###..
#..#####...#...#####..#
....###....#....###....
..#..#..#.....#..#..#..
.###...###...###...###.
##.##.##.##.##.##.##.##
.###...###...###...###.
..#..#..#.....#..#..#..
....###....#....###....
#..#####...#...#####..#
..#######.....#######..
.#########...#########.
#######################
####...#########...####
.#####..#######..#####.
..###....#####....###..
#..#....#######....#..#
.......####.####.......
#.....####...####.....#
##...####..#..####...##
###.####.......####.###
.######..#...#..######.
..####...##.##...####..
...###....###....###...
....##.#...#...#.##....
...###....###....###...
..####...##.##...####..
.######..#...#..######.
###.####.......####.###
##...####..#..####...##
#.....####...####.....#
.......####.####.......
#..#....#######....#..#
..###....#####....###..
.#####..#######..#####.
####...#########...####
#######################
.#########...#########.
..#######.....#######..
#..#####...#...#####..#
....###....#....###....
..#..#..#.....#..#..#..
.###...###...###...###.
##.##.##.##.##.##.##.##
.###...###...###...###.
..#..#..#.....#..#..#..
....###....#....###....
#..#####...#...#####..#
..###.###.....###.###..
.###...###...###...###.
###..#..###.###..#..###
.###...###...###...###.
..###.###.....###.###..
#..#####...#...#####..#
....###....#....###....






share|improve this question























    up vote
    19
    down vote

    favorite
    1












    We've got quite a few national flag challenges already:
    AU
    CH
    FI
    FR
    GB
    GB
    IS
    KR
    NP
    US...
    Here's another, somewhat more advanced one:



    Return or print the decorative pattern from Belarus's national flag as a matrix of two distinct values for red and white.



    rushnyk



    If your language doesn't support matrices, use a list of lists or the closest equivalent.
    Extra whitespace is allowed on all sides.
    The matrix can be transposed.
    The elements can have a consistent separator, and so can the rows, e.g. output can be JSON.
    You must use the 2012 version of the ornament pattern, not the 1951 or 1995 versions.
    This is code-golf, so the shortest answer per language wins.



    Sample output:



    ....###....#....###....
    #..#####...#...#####..#
    ..###.###.....###.###..
    .###...###...###...###.
    ###..#..###.###..#..###
    .###...###...###...###.
    ..###.###.....###.###..
    #..#####...#...#####..#
    ....###....#....###....
    ..#..#..#.....#..#..#..
    .###...###...###...###.
    ##.##.##.##.##.##.##.##
    .###...###...###...###.
    ..#..#..#.....#..#..#..
    ....###....#....###....
    #..#####...#...#####..#
    ..#######.....#######..
    .#########...#########.
    #######################
    ####...#########...####
    .#####..#######..#####.
    ..###....#####....###..
    #..#....#######....#..#
    .......####.####.......
    #.....####...####.....#
    ##...####..#..####...##
    ###.####.......####.###
    .######..#...#..######.
    ..####...##.##...####..
    ...###....###....###...
    ....##.#...#...#.##....
    ...###....###....###...
    ..####...##.##...####..
    .######..#...#..######.
    ###.####.......####.###
    ##...####..#..####...##
    #.....####...####.....#
    .......####.####.......
    #..#....#######....#..#
    ..###....#####....###..
    .#####..#######..#####.
    ####...#########...####
    #######################
    .#########...#########.
    ..#######.....#######..
    #..#####...#...#####..#
    ....###....#....###....
    ..#..#..#.....#..#..#..
    .###...###...###...###.
    ##.##.##.##.##.##.##.##
    .###...###...###...###.
    ..#..#..#.....#..#..#..
    ....###....#....###....
    #..#####...#...#####..#
    ..###.###.....###.###..
    .###...###...###...###.
    ###..#..###.###..#..###
    .###...###...###...###.
    ..###.###.....###.###..
    #..#####...#...#####..#
    ....###....#....###....






    share|improve this question





















      up vote
      19
      down vote

      favorite
      1









      up vote
      19
      down vote

      favorite
      1






      1





      We've got quite a few national flag challenges already:
      AU
      CH
      FI
      FR
      GB
      GB
      IS
      KR
      NP
      US...
      Here's another, somewhat more advanced one:



      Return or print the decorative pattern from Belarus's national flag as a matrix of two distinct values for red and white.



      rushnyk



      If your language doesn't support matrices, use a list of lists or the closest equivalent.
      Extra whitespace is allowed on all sides.
      The matrix can be transposed.
      The elements can have a consistent separator, and so can the rows, e.g. output can be JSON.
      You must use the 2012 version of the ornament pattern, not the 1951 or 1995 versions.
      This is code-golf, so the shortest answer per language wins.



      Sample output:



      ....###....#....###....
      #..#####...#...#####..#
      ..###.###.....###.###..
      .###...###...###...###.
      ###..#..###.###..#..###
      .###...###...###...###.
      ..###.###.....###.###..
      #..#####...#...#####..#
      ....###....#....###....
      ..#..#..#.....#..#..#..
      .###...###...###...###.
      ##.##.##.##.##.##.##.##
      .###...###...###...###.
      ..#..#..#.....#..#..#..
      ....###....#....###....
      #..#####...#...#####..#
      ..#######.....#######..
      .#########...#########.
      #######################
      ####...#########...####
      .#####..#######..#####.
      ..###....#####....###..
      #..#....#######....#..#
      .......####.####.......
      #.....####...####.....#
      ##...####..#..####...##
      ###.####.......####.###
      .######..#...#..######.
      ..####...##.##...####..
      ...###....###....###...
      ....##.#...#...#.##....
      ...###....###....###...
      ..####...##.##...####..
      .######..#...#..######.
      ###.####.......####.###
      ##...####..#..####...##
      #.....####...####.....#
      .......####.####.......
      #..#....#######....#..#
      ..###....#####....###..
      .#####..#######..#####.
      ####...#########...####
      #######################
      .#########...#########.
      ..#######.....#######..
      #..#####...#...#####..#
      ....###....#....###....
      ..#..#..#.....#..#..#..
      .###...###...###...###.
      ##.##.##.##.##.##.##.##
      .###...###...###...###.
      ..#..#..#.....#..#..#..
      ....###....#....###....
      #..#####...#...#####..#
      ..###.###.....###.###..
      .###...###...###...###.
      ###..#..###.###..#..###
      .###...###...###...###.
      ..###.###.....###.###..
      #..#####...#...#####..#
      ....###....#....###....






      share|improve this question











      We've got quite a few national flag challenges already:
      AU
      CH
      FI
      FR
      GB
      GB
      IS
      KR
      NP
      US...
      Here's another, somewhat more advanced one:



      Return or print the decorative pattern from Belarus's national flag as a matrix of two distinct values for red and white.



      rushnyk



      If your language doesn't support matrices, use a list of lists or the closest equivalent.
      Extra whitespace is allowed on all sides.
      The matrix can be transposed.
      The elements can have a consistent separator, and so can the rows, e.g. output can be JSON.
      You must use the 2012 version of the ornament pattern, not the 1951 or 1995 versions.
      This is code-golf, so the shortest answer per language wins.



      Sample output:



      ....###....#....###....
      #..#####...#...#####..#
      ..###.###.....###.###..
      .###...###...###...###.
      ###..#..###.###..#..###
      .###...###...###...###.
      ..###.###.....###.###..
      #..#####...#...#####..#
      ....###....#....###....
      ..#..#..#.....#..#..#..
      .###...###...###...###.
      ##.##.##.##.##.##.##.##
      .###...###...###...###.
      ..#..#..#.....#..#..#..
      ....###....#....###....
      #..#####...#...#####..#
      ..#######.....#######..
      .#########...#########.
      #######################
      ####...#########...####
      .#####..#######..#####.
      ..###....#####....###..
      #..#....#######....#..#
      .......####.####.......
      #.....####...####.....#
      ##...####..#..####...##
      ###.####.......####.###
      .######..#...#..######.
      ..####...##.##...####..
      ...###....###....###...
      ....##.#...#...#.##....
      ...###....###....###...
      ..####...##.##...####..
      .######..#...#..######.
      ###.####.......####.###
      ##...####..#..####...##
      #.....####...####.....#
      .......####.####.......
      #..#....#######....#..#
      ..###....#####....###..
      .#####..#######..#####.
      ####...#########...####
      #######################
      .#########...#########.
      ..#######.....#######..
      #..#####...#...#####..#
      ....###....#....###....
      ..#..#..#.....#..#..#..
      .###...###...###...###.
      ##.##.##.##.##.##.##.##
      .###...###...###...###.
      ..#..#..#.....#..#..#..
      ....###....#....###....
      #..#####...#...#####..#
      ..###.###.....###.###..
      .###...###...###...###.
      ###..#..###.###..#..###
      .###...###...###...###.
      ..###.###.....###.###..
      #..#####...#...#####..#
      ....###....#....###....








      share|improve this question










      share|improve this question




      share|improve this question









      asked Aug 6 at 11:11









      ngn

      6,59312154




      6,59312154




















          7 Answers
          7






          active

          oldest

          votes

















          up vote
          7
          down vote














          Stax, 68 bytes



          àÑΣ▒i╕7FF3xì¥╫Yb▌t╤y╡µåè0═↕h╗ΔDOü↔`◙■^>♀;∟Γ9→§Æ¼$ß⌡╫èj_┐;ø;¡²Ω☺┘4!P╛


          Run and debug it



          Outputs vertical version, 1 for white, 0 for red. Naive approach: compress top left quarter, then complete.






          share|improve this answer




























            up vote
            4
            down vote














            Python 2, 183 181 bytes





            S=[bin(int(''.join(w),36))[2:].rjust(31,'0')for w in zip(*[iter("RBRG5FDLAJ2O77MSE012OBJWJUSWDQ464UKNYZIE8JYGS0JRFOCIJY7U5F983X0LYW20WNTE")]*6)]
            for s in S[:0:-1]+S:print s[:0:-1]+s


            Try it online!



            Outputs transposed version, using 0 and 1 for white and red.






            share|improve this answer






























              up vote
              3
              down vote













              JavaScript (ES6), 164 bytes



              Transposed output. Uses 0 for white, 1 for red.





              f=(x=y=0)=>y<61?x>22?`
              `+f(!++y):(-~'o`xb[FMMf[MM[Fxbo`cCMMZZMMcCo`xbFN~~N}}{[wH?]@NbfvBH 













              up vote
              3
              down vote














              SOGL V0.12, 61 56 bytes



               №α⁶U-┼°jōIΤ$ΣΧρ←FVξÆ⅝ 






              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',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );








               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f170053%2fbelarus-rushnyk%23new-answer', 'question_page');

              );

              Post as a guest






























              7 Answers
              7






              active

              oldest

              votes








              7 Answers
              7






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              7
              down vote














              Stax, 68 bytes



              àÑΣ▒i╕7FF3xì¥╫Yb▌t╤y╡µåè0═↕h╗ΔDOü↔`◙■^>♀;∟Γ9→§Æ¼$ß⌡╫èj_┐;ø;¡²Ω☺┘4!P╛


              Run and debug it



              Outputs vertical version, 1 for white, 0 for red. Naive approach: compress top left quarter, then complete.






              share[wH?]@NbfvBHWwooa'.charCodeAt((y>30?60-y:y)*2+(X=x>11?22-x:x)/6)>>X%6&1)+f(x+1):''


              Try it online! (prettified output)



              Using Buffer() in Node.js saves 1 byte.






              share[wH?]@NbfvBH 








              up vote
              3
              down vote










              up vote
              3
              down vote









              JavaScript (ES6), 164 bytes



              Transposed output. Uses 0 for white, 1 for red.





              f=(x=y=0)=>y<61?x>22?`
              `+f(!++y):(-~'o`xb[FMMf[MM[Fxbo`cCMMZZMMcCo`xbFN~~N[wH?]@NbfvBHWwooa'.charCodeAt((y>30?60-y:y)*2+(X=x>11?22-x:x)/6)>>X%6&1)+f(x+1):''


              Try it online! (prettified output)



              Using Buffer() in Node.js saves 1 byte.






              share{[wH?]@NbfvBH{Wwooa'.charCodeAt((y>30?60-y:y)*2+(X=x>11?22-x:x)/6)>>X%6&1)+f(x+1):''


              Try it online! (prettified output)



              Using Buffer() in Node.js saves 1 byte.







              share|improve this answer















              share|improve this answer



              share|improve this answer








              edited Aug 6 at 19:01


























              answered Aug 6 at 12:00









              Arnauld

              61.7k575258




              61.7k575258




















                  up vote
                  3
                  down vote














                  SOGL V0.12, 61 56 bytes



                   №α⁶U-┼°jōIΤ$ΣΧρ←FVξÆ⅝{VqM┼οYΠ!↕οΩÆ.χg±└¶Σ,Cy′┌“2─±6«n╬,


                  Try it Here!






                  share|improve this answer



























                    up vote
                    3
                    down vote














                    SOGL V0.12, 61 56 bytes



                     №α⁶U-┼°jōIΤ$ΣΧρ←FVξÆ⅝{VqM┼οYΠ!↕οΩÆ.χg±└¶Σ,Cy′┌“2─±6«n╬,


                    Try it Here!






                    share|improve this answer

























                      up vote
                      3
                      down vote










                      up vote
                      3
                      down vote










                      SOGL V0.12, 61 56 bytes



                       №α⁶U-┼°jōIΤ$ΣΧρ←FVξÆ⅝{VqM┼οYΠ!↕οΩÆ.χg±└¶Σ,Cy′┌“2─±6«n╬,


                      Try it Here!






                      share|improve this answer
















                      SOGL V0.12, 61 56 bytes



                       №α⁶U-┼°jōIΤ$ΣΧρ←FVξÆ⅝{VqM┼οYΠ!↕οΩÆ.χg±└¶Σ,Cy′┌“2─±6«n╬,


                      Try it Here!







                      share|improve this answer















                      share|improve this answer



                      share|improve this answer








                      edited Aug 7 at 0:05


























                      answered Aug 6 at 23:48









                      dzaima

                      12.5k21450




                      12.5k21450




















                          up vote
                          3
                          down vote













                          Charcoal, 93 89 81 bytes



                          ”improve this answer























                          • ‖B accepts multiple operands, Some combinations even have a single-byte encoding (¬ and L for example).
                            – Neil
                            Aug 6 at 15:24










                          • Also, using spaces instead of .s should save you a few bytes as you don't need spaces at the end of a line.
                            – Neil
                            Aug 6 at 15:25










                          • (I don't know which of vertically or horizontally will result in more spaces at the ends of lines).
                            – Neil
                            Aug 6 at 15:27










                          • I tried ‖B¬ and it doesn't help because the reflected string literal costs an extra byte, but ‖BL does save a byte because the line-reversed string literal is the same byte count.
                            – Neil
                            Aug 7 at 10:53










                          • On the other hand, for vertical output, ‖BL gets me to 83 bytes, and ‖B¬ can be done in 81 bytes: Try it online!
                            – Neil
                            Aug 7 at 10:56










                          share|improve this answer













                          share|improve this answer



                          share|improve this answer











                          answered Aug 6 at 21:22









                          Lynn

                          47.9k694222




                          47.9k694222




















                              up vote
                              2
                              down vote














                              Perl 5, 121 bytes



                              Uses 1 for white pixels and 0 for red.





                              $_=unpack"B*",'ñæÄxããÄvñí·Ž2IŽ=·ñæÀxàƒxoá|3†øÞ<òà';say for(@a=maps/.$//r.reverse/.12/g),pop@a&&reverse@a


                              This script contains unprintable characters so a reversible hexdump is included in the verification link below.



                              Try it online!
                              Verification of code length.



                              Explanation



                              The top quarter of the pattern is stored within the binary blob. This just uses Perl's pack function with the original binary string (after replacing . and # with 1 and 0). This allows us to store 8 bits of the pattern in each byte. Once we've unpacked the data, we have the long binary string, which we break down into sections of length 12, concatenate with the reverse (except for the duplicated middle character) and then loop over the list of sections (concatenated with the reverse of the list, except for the duplicated middle element) and output them all using say, which adds in a newline.






                              share|improve this answer

























                                up vote
                                2
                                down vote














                                Perl 5, 121 bytes



                                Uses 1 for white pixels and 0 for red.





                                $_=unpack"B*",'ñæÄxããÄvñí·Ž2IŽ=·ñæÀxàƒxoá|3†øÞ<òà';say for(@a=maps/.$//r.reverse/.12/g),pop@a&&reverse@a


                                This script contains unprintable characters so a reversible hexdump is included in the verification link below.



                                Try it online!
                                Verification of code length.



                                Explanation



                                The top quarter of the pattern is stored within the binary blob. This just uses Perl's pack function with the original binary string (after replacing . and # with 1 and 0). This allows us to store 8 bits of the pattern in each byte. Once we've unpacked the data, we have the long binary string, which we break down into sections of length 12, concatenate with the reverse (except for the duplicated middle character) and then loop over the list of sections (concatenated with the reverse of the list, except for the duplicated middle element) and output them all using say, which adds in a newline.






                                share|improve this answer























                                  up vote
                                  2
                                  down vote










                                  up vote
                                  2
                                  down vote










                                  Perl 5, 121 bytes



                                  Uses 1 for white pixels and 0 for red.





                                  $_=unpack"B*",'ñæÄxããÄvñí·Ž2IŽ=·ñæÀxàƒxoá|3†øÞ<òà';say for(@a=maps/.$//r.reverse/.12/g),pop@a&&reverse@a


                                  This script contains unprintable characters so a reversible hexdump is included in the verification link below.



                                  Try it online!
                                  Verification of code length.



                                  Explanation



                                  The top quarter of the pattern is stored within the binary blob. This just uses Perl's pack function with the original binary string (after replacing . and # with 1 and 0). This allows us to store 8 bits of the pattern in each byte. Once we've unpacked the data, we have the long binary string, which we break down into sections of length 12, concatenate with the reverse (except for the duplicated middle character) and then loop over the list of sections (concatenated with the reverse of the list, except for the duplicated middle element) and output them all using say, which adds in a newline.






                                  share|improve this answer














                                  Perl 5, 121 bytes



                                  Uses 1 for white pixels and 0 for red.





                                  $_=unpack"B*",'ñæÄxããÄvñí·Ž2IŽ=·ñæÀxàƒxoá|3†øÞ<òà';say for(@a=maps/.$//r.reverse/.12/g),pop@a&&reverse@a


                                  This script contains unprintable characters so a reversible hexdump is included in the verification link below.



                                  Try it online!
                                  Verification of code length.



                                  Explanation



                                  The top quarter of the pattern is stored within the binary blob. This just uses Perl's pack function with the original binary string (after replacing . and # with 1 and 0). This allows us to store 8 bits of the pattern in each byte. Once we've unpacked the data, we have the long binary string, which we break down into sections of length 12, concatenate with the reverse (except for the duplicated middle character) and then loop over the list of sections (concatenated with the reverse of the list, except for the duplicated middle element) and output them all using say, which adds in a newline.







                                  share|improve this answer













                                  share|improve this answer



                                  share|improve this answer











                                  answered Aug 7 at 12:20









                                  Dom Hastings

                                  14.7k33070




                                  14.7k33070






















                                       

                                      draft saved


                                      draft discarded


























                                       


                                      draft saved


                                      draft discarded














                                      StackExchange.ready(
                                      function ()
                                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f170053%2fbelarus-rushnyk%23new-answer', 'question_page');

                                      );

                                      Post as a guest













































































                                      Comments

                                      Popular posts from this blog

                                      What does second last employer means? [closed]

                                      List of Gilmore Girls characters

                                      Confectionery