Output a Sudoku board

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











up vote
5
down vote

favorite












Today's challenge is simple: Without taking any input, output any valid sudoku board.



In case you are unfamiliar with sudoku, Wikipedia describes what a valid board should look like:




The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 subgrids that compose the grid (also called "boxes", "blocks", or "regions") contains all of the digits from 1 to 9.




Now here's the thing... There are 6,670,903,752,021,072,936,960 different valid sudoku boards. Some of them may be very difficult to compress and output in fewer bytes. Others of them may be easier. Part of this challenge is to figure out which boards will be most compressible and could be outputted in the fewest bytes.



Your submission does not necessarily have to output the same board every time. But if multiple outputs are possible, you'll have to prove that every possible output is a valid board.



You can use this script (thanks to Magic Octopus Urn) or any of these answers to verify if a particular grid is a valid solution. It will output a [1] for a valid board, and anything else for an invalid board.



I'm not too picky about what format you output your answer in, as long as it's clearly 2-dimensional. For example, you could output a 9x9 matrix, nine 3x3 matrices, a string, an array of strings, an array of 9-digit integers, or nine 9-digit numbers with a separator. Outputting 81 digits in 1 dimension would not be permitted. If you would like to know about a particular output format, feel free to ask me in the comments.



As usual, this is code-golf, so write the shortest answer you can come up with in the language(s) of your choosing!










share|improve this question

























    up vote
    5
    down vote

    favorite












    Today's challenge is simple: Without taking any input, output any valid sudoku board.



    In case you are unfamiliar with sudoku, Wikipedia describes what a valid board should look like:




    The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 subgrids that compose the grid (also called "boxes", "blocks", or "regions") contains all of the digits from 1 to 9.




    Now here's the thing... There are 6,670,903,752,021,072,936,960 different valid sudoku boards. Some of them may be very difficult to compress and output in fewer bytes. Others of them may be easier. Part of this challenge is to figure out which boards will be most compressible and could be outputted in the fewest bytes.



    Your submission does not necessarily have to output the same board every time. But if multiple outputs are possible, you'll have to prove that every possible output is a valid board.



    You can use this script (thanks to Magic Octopus Urn) or any of these answers to verify if a particular grid is a valid solution. It will output a [1] for a valid board, and anything else for an invalid board.



    I'm not too picky about what format you output your answer in, as long as it's clearly 2-dimensional. For example, you could output a 9x9 matrix, nine 3x3 matrices, a string, an array of strings, an array of 9-digit integers, or nine 9-digit numbers with a separator. Outputting 81 digits in 1 dimension would not be permitted. If you would like to know about a particular output format, feel free to ask me in the comments.



    As usual, this is code-golf, so write the shortest answer you can come up with in the language(s) of your choosing!










    share|improve this question























      up vote
      5
      down vote

      favorite









      up vote
      5
      down vote

      favorite











      Today's challenge is simple: Without taking any input, output any valid sudoku board.



      In case you are unfamiliar with sudoku, Wikipedia describes what a valid board should look like:




      The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 subgrids that compose the grid (also called "boxes", "blocks", or "regions") contains all of the digits from 1 to 9.




      Now here's the thing... There are 6,670,903,752,021,072,936,960 different valid sudoku boards. Some of them may be very difficult to compress and output in fewer bytes. Others of them may be easier. Part of this challenge is to figure out which boards will be most compressible and could be outputted in the fewest bytes.



      Your submission does not necessarily have to output the same board every time. But if multiple outputs are possible, you'll have to prove that every possible output is a valid board.



      You can use this script (thanks to Magic Octopus Urn) or any of these answers to verify if a particular grid is a valid solution. It will output a [1] for a valid board, and anything else for an invalid board.



      I'm not too picky about what format you output your answer in, as long as it's clearly 2-dimensional. For example, you could output a 9x9 matrix, nine 3x3 matrices, a string, an array of strings, an array of 9-digit integers, or nine 9-digit numbers with a separator. Outputting 81 digits in 1 dimension would not be permitted. If you would like to know about a particular output format, feel free to ask me in the comments.



      As usual, this is code-golf, so write the shortest answer you can come up with in the language(s) of your choosing!










      share|improve this question













      Today's challenge is simple: Without taking any input, output any valid sudoku board.



      In case you are unfamiliar with sudoku, Wikipedia describes what a valid board should look like:




      The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 subgrids that compose the grid (also called "boxes", "blocks", or "regions") contains all of the digits from 1 to 9.




      Now here's the thing... There are 6,670,903,752,021,072,936,960 different valid sudoku boards. Some of them may be very difficult to compress and output in fewer bytes. Others of them may be easier. Part of this challenge is to figure out which boards will be most compressible and could be outputted in the fewest bytes.



      Your submission does not necessarily have to output the same board every time. But if multiple outputs are possible, you'll have to prove that every possible output is a valid board.



      You can use this script (thanks to Magic Octopus Urn) or any of these answers to verify if a particular grid is a valid solution. It will output a [1] for a valid board, and anything else for an invalid board.



      I'm not too picky about what format you output your answer in, as long as it's clearly 2-dimensional. For example, you could output a 9x9 matrix, nine 3x3 matrices, a string, an array of strings, an array of 9-digit integers, or nine 9-digit numbers with a separator. Outputting 81 digits in 1 dimension would not be permitted. If you would like to know about a particular output format, feel free to ask me in the comments.



      As usual, this is code-golf, so write the shortest answer you can come up with in the language(s) of your choosing!







      code-golf kolmogorov-complexity grid sudoku






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 39 mins ago









      DJMcMayhem♦

      40.1k11140305




      40.1k11140305




















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          4
          down vote













          Pyth, 22 14 12 bytes



          m.<S9do%N3U9


          Try it here



          m.<S9do%N3U9
          o%N3U9 Order the range [0, ..., 8] mod 3.
          m d For each, ...
          .<S9 ... Rotate the list [1, ..., 9] that many times.





          share|improve this answer






















          • 11: m.<S9d%D3 9.
            – Mr. Xcoder
            3 mins ago










          • Cross that out, 10: .<LS9%D3 9.
            – Mr. Xcoder
            1 min ago

















          up vote
          2
          down vote














          Jelly, 9 bytes



          9Rṙ`⁽/ẇœ?


          Try it online!





          share



























            up vote
            2
            down vote














            Jelly, 8 bytes



            9Rṙ%3$Þ$


            Try it online!



            And a little bit of this...






            share|improve this answer





























              up vote
              1
              down vote














              Canvas, 13 11 bytes



              ◂j3[«3[T3[«


              Try it here!






              share|improve this answer




















                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%2f172474%2foutput-a-sudoku-board%23new-answer', 'question_page');

                );

                Post as a guest






























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                4
                down vote













                Pyth, 22 14 12 bytes



                m.<S9do%N3U9


                Try it here



                m.<S9do%N3U9
                o%N3U9 Order the range [0, ..., 8] mod 3.
                m d For each, ...
                .<S9 ... Rotate the list [1, ..., 9] that many times.





                share|improve this answer






















                • 11: m.<S9d%D3 9.
                  – Mr. Xcoder
                  3 mins ago










                • Cross that out, 10: .<LS9%D3 9.
                  – Mr. Xcoder
                  1 min ago














                up vote
                4
                down vote













                Pyth, 22 14 12 bytes



                m.<S9do%N3U9


                Try it here



                m.<S9do%N3U9
                o%N3U9 Order the range [0, ..., 8] mod 3.
                m d For each, ...
                .<S9 ... Rotate the list [1, ..., 9] that many times.





                share|improve this answer






















                • 11: m.<S9d%D3 9.
                  – Mr. Xcoder
                  3 mins ago










                • Cross that out, 10: .<LS9%D3 9.
                  – Mr. Xcoder
                  1 min ago












                up vote
                4
                down vote










                up vote
                4
                down vote









                Pyth, 22 14 12 bytes



                m.<S9do%N3U9


                Try it here



                m.<S9do%N3U9
                o%N3U9 Order the range [0, ..., 8] mod 3.
                m d For each, ...
                .<S9 ... Rotate the list [1, ..., 9] that many times.





                share|improve this answer














                Pyth, 22 14 12 bytes



                m.<S9do%N3U9


                Try it here



                m.<S9do%N3U9
                o%N3U9 Order the range [0, ..., 8] mod 3.
                m d For each, ...
                .<S9 ... Rotate the list [1, ..., 9] that many times.






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 21 mins ago

























                answered 34 mins ago









                Mnemonic

                4,2371427




                4,2371427











                • 11: m.<S9d%D3 9.
                  – Mr. Xcoder
                  3 mins ago










                • Cross that out, 10: .<LS9%D3 9.
                  – Mr. Xcoder
                  1 min ago
















                • 11: m.<S9d%D3 9.
                  – Mr. Xcoder
                  3 mins ago










                • Cross that out, 10: .<LS9%D3 9.
                  – Mr. Xcoder
                  1 min ago















                11: m.<S9d%D3 9.
                – Mr. Xcoder
                3 mins ago




                11: m.<S9d%D3 9.
                – Mr. Xcoder
                3 mins ago












                Cross that out, 10: .<LS9%D3 9.
                – Mr. Xcoder
                1 min ago




                Cross that out, 10: .<LS9%D3 9.
                – Mr. Xcoder
                1 min ago










                up vote
                2
                down vote














                Jelly, 9 bytes



                9Rṙ`⁽/ẇœ?


                Try it online!





                share
























                  up vote
                  2
                  down vote














                  Jelly, 9 bytes



                  9Rṙ`⁽/ẇœ?


                  Try it online!





                  share






















                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote










                    Jelly, 9 bytes



                    9Rṙ`⁽/ẇœ?


                    Try it online!





                    share













                    Jelly, 9 bytes



                    9Rṙ`⁽/ẇœ?


                    Try it online!






                    share











                    share


                    share










                    answered 6 mins ago









                    dylnan

                    3,6682528




                    3,6682528




















                        up vote
                        2
                        down vote














                        Jelly, 8 bytes



                        9Rṙ%3$Þ$


                        Try it online!



                        And a little bit of this...






                        share|improve this answer


























                          up vote
                          2
                          down vote














                          Jelly, 8 bytes



                          9Rṙ%3$Þ$


                          Try it online!



                          And a little bit of this...






                          share|improve this answer
























                            up vote
                            2
                            down vote










                            up vote
                            2
                            down vote










                            Jelly, 8 bytes



                            9Rṙ%3$Þ$


                            Try it online!



                            And a little bit of this...






                            share|improve this answer















                            Jelly, 8 bytes



                            9Rṙ%3$Þ$


                            Try it online!



                            And a little bit of this...







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited 4 mins ago

























                            answered 22 mins ago









                            Erik the Outgolfer

                            29.5k42798




                            29.5k42798




















                                up vote
                                1
                                down vote














                                Canvas, 13 11 bytes



                                ◂j3[«3[T3[«


                                Try it here!






                                share|improve this answer
























                                  up vote
                                  1
                                  down vote














                                  Canvas, 13 11 bytes



                                  ◂j3[«3[T3[«


                                  Try it here!






                                  share|improve this answer






















                                    up vote
                                    1
                                    down vote










                                    up vote
                                    1
                                    down vote










                                    Canvas, 13 11 bytes



                                    ◂j3[«3[T3[«


                                    Try it here!






                                    share|improve this answer













                                    Canvas, 13 11 bytes



                                    ◂j3[«3[T3[«


                                    Try it here!







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered 12 mins ago









                                    dzaima

                                    13.1k21652




                                    13.1k21652



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














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

                                        );

                                        Post as a guest













































































                                        Comments

                                        Popular posts from this blog

                                        Long meetings (6-7 hours a day): Being “babysat” by supervisor

                                        Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                                        Confectionery