A Diagonal Sudoku board is a special case of Latin squares. It has the following properties:
- The board is a 9-by-9 matrix
- Each row contains the numbers
1-9
- Each column contains the numbers
1-9
- Each 3-by-3 sub-region contains the numbers
1-9
- Both diagonals contains the numbers
1-9
Challenge:
Create a program or function that outputs a complete board with all 81 numbers that complies with the rules above.
The number in at least one position must be random, meaning the result should vary accross executions of the code. The distribution is optional, but it must be possible to obtain at least 9 structurally different boards. A board obtained from another by transliteration is not considered structurally different. Transliteration refers to substituting each number x by some other number y, consistently in all positions of number x.
Hardcoding 9 boards is not accepted either.
Rules:
- Output format is optional, as long as it's easy to understand (list of list is OK)
- The random number can be taken as input instead of being created in the script, but only if your language doesn't have a RNG.
This is code golf so the shortest code in bytes win!
Example boards:
7 2 5 | 8 9 3 | 4 6 1
8 4 1 | 6 5 7 | 3 9 2
3 9 6 | 1 4 2 | 7 5 8
-------------------------------------
4 7 3 | 5 1 6 | 8 2 9
1 6 8 | 4 2 9 | 5 3 7
9 5 2 | 3 7 8 | 1 4 6
-------------------------------------
2 3 4 | 7 6 1 | 9 8 5
6 8 7 | 9 3 5 | 2 1 4
5 1 9 | 2 8 4 | 6 7 3
4 7 8 | 1 9 5 | 3 2 6
5 2 6 | 4 8 3 | 7 1 9
9 3 1 | 6 7 2 | 4 5 8
-------------------------------------
2 5 9 | 8 6 7 | 1 3 4
3 6 4 | 2 5 1 | 9 8 7
1 8 7 | 3 4 9 | 5 6 2
-------------------------------------
7 1 2 | 9 3 8 | 6 4 5
6 9 3 | 5 2 4 | 8 7 1
8 4 5 | 7 1 6 | 2 9 3