Output a Sudoku board
Clash 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!
code-golf kolmogorov-complexity grid sudoku
add a comment |Â
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!
code-golf kolmogorov-complexity grid sudoku
add a comment |Â
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!
code-golf kolmogorov-complexity grid sudoku
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
code-golf kolmogorov-complexity grid sudoku
asked 39 mins ago
DJMcMayhemâ¦
40.1k11140305
40.1k11140305
add a comment |Â
add a comment |Â
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.
11:m.<S9d%D3 9
.
â Mr. Xcoder
3 mins ago
Cross that out, 10:.<LS9%D3 9
.
â Mr. Xcoder
1 min ago
add a comment |Â
up vote
2
down vote
Jelly, 9 bytes
9Rá¹Â`â½/áºÂÃ
Â?
Try it online!
add a comment |Â
up vote
2
down vote
Jelly, 8 bytes
9Rá¹Â%3$ÃÂ$
Try it online!
And a little bit of this...
add a comment |Â
up vote
1
down vote
Canvas, 13 11 bytes
âÂÂï½Âï¼Â[ëï¼Â[Tï¼Â[ë
Try it here!
add a comment |Â
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.
11:m.<S9d%D3 9
.
â Mr. Xcoder
3 mins ago
Cross that out, 10:.<LS9%D3 9
.
â Mr. Xcoder
1 min ago
add a comment |Â
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.
11:m.<S9d%D3 9
.
â Mr. Xcoder
3 mins ago
Cross that out, 10:.<LS9%D3 9
.
â Mr. Xcoder
1 min ago
add a comment |Â
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.
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.
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
add a comment |Â
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
add a comment |Â
up vote
2
down vote
Jelly, 9 bytes
9Rá¹Â`â½/áºÂÃ
Â?
Try it online!
add a comment |Â
up vote
2
down vote
Jelly, 9 bytes
9Rá¹Â`â½/áºÂÃ
Â?
Try it online!
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Jelly, 9 bytes
9Rá¹Â`â½/áºÂÃ
Â?
Try it online!
Jelly, 9 bytes
9Rá¹Â`â½/áºÂÃ
Â?
Try it online!
answered 6 mins ago
dylnan
3,6682528
3,6682528
add a comment |Â
add a comment |Â
up vote
2
down vote
Jelly, 8 bytes
9Rá¹Â%3$ÃÂ$
Try it online!
And a little bit of this...
add a comment |Â
up vote
2
down vote
Jelly, 8 bytes
9Rá¹Â%3$ÃÂ$
Try it online!
And a little bit of this...
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Jelly, 8 bytes
9Rá¹Â%3$ÃÂ$
Try it online!
And a little bit of this...
Jelly, 8 bytes
9Rá¹Â%3$ÃÂ$
Try it online!
And a little bit of this...
edited 4 mins ago
answered 22 mins ago
Erik the Outgolfer
29.5k42798
29.5k42798
add a comment |Â
add a comment |Â
up vote
1
down vote
Canvas, 13 11 bytes
âÂÂï½Âï¼Â[ëï¼Â[Tï¼Â[ë
Try it here!
add a comment |Â
up vote
1
down vote
Canvas, 13 11 bytes
âÂÂï½Âï¼Â[ëï¼Â[Tï¼Â[ë
Try it here!
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Canvas, 13 11 bytes
âÂÂï½Âï¼Â[ëï¼Â[Tï¼Â[ë
Try it here!
Canvas, 13 11 bytes
âÂÂï½Âï¼Â[ëï¼Â[Tï¼Â[ë
Try it here!
answered 12 mins ago
dzaima
13.1k21652
13.1k21652
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password