mardi 25 juillet 2023

Samurai Sudoku Generator needs a clever blanking/masking technique [closed]

I have written a Samurai Sudoku Generator. It generates 5 Sudokos that overlap, this is an example output array using kronecker product as main matrix shuffler:

[[1 2 3 4 5 6 7 8 9 0 0 0 2 3 1 5 6 4 8 9 7]
 [4 5 6 7 8 9 1 2 3 0 0 0 5 6 4 8 9 7 2 3 1]
 [7 8 9 1 2 3 4 5 6 0 0 0 8 9 7 2 3 1 5 6 4]
 [2 3 1 5 6 4 8 9 7 0 0 0 9 7 8 6 4 5 3 1 2]
 [5 6 4 8 9 7 2 3 1 0 0 0 3 1 2 9 7 8 6 4 5]
 [8 9 7 2 3 1 5 6 4 0 0 0 6 4 5 3 1 2 9 7 8]
 [3 1 2 6 4 5 9 7 8 6 4 5 1 2 3 4 5 6 7 8 9]
 [6 4 5 9 7 8 3 1 2 9 7 8 4 5 6 7 8 9 1 2 3]
 [9 7 8 3 1 2 6 4 5 3 1 2 7 8 9 1 2 3 4 5 6]
 [0 0 0 0 0 0 7 8 9 4 5 6 2 3 1 0 0 0 0 0 0]
 [0 0 0 0 0 0 1 2 3 7 8 9 5 6 4 0 0 0 0 0 0]
 [0 0 0 0 0 0 4 5 6 1 2 3 8 9 7 0 0 0 0 0 0]
 [2 3 1 5 6 4 8 9 7 5 6 4 3 1 2 6 4 5 9 7 8]
 [5 6 4 8 9 7 2 3 1 8 9 7 6 4 5 9 7 8 3 1 2]
 [8 9 7 2 3 1 5 6 4 2 3 1 9 7 8 3 1 2 6 4 5]
 [3 1 2 6 4 5 9 7 8 0 0 0 1 2 3 4 5 6 7 8 9]
 [6 4 5 9 7 8 3 1 2 0 0 0 4 5 6 7 8 9 1 2 3]
 [9 7 8 3 1 2 6 4 5 0 0 0 7 8 9 1 2 3 4 5 6]
 [1 2 3 4 5 6 7 8 9 0 0 0 2 3 1 5 6 4 8 9 7]
 [4 5 6 7 8 9 1 2 3 0 0 0 5 6 4 8 9 7 2 3 1]
 [7 8 9 1 2 3 4 5 6 0 0 0 8 9 7 2 3 1 5 6 4]]

A better visual reprensentation is given by the pdf version: (https://i.stack.imgur.com/Vc6T1.png)

I dont know if it has been the long hours or what but i can't come up with a nice blanking / masking technique so that i generate the puzzle from the solution. How can i make sure each sudoko on its own remains solvable and how do i also control the difficulty. I'm completely out of ideas.

I have tried random deletion of numbers but that can lead to bad cases. I need a bullet proof solution that works each time and makes sure the samurai sudoku is always solvable (doesnt need to give only 1 unique solution).




Aucun commentaire:

Enregistrer un commentaire