Generating minimal/irreducible Sudokus

前端 未结 2 1273
悲哀的现实
悲哀的现实 2021-01-05 08:15

A Sudoku puzzle is minimal (also called irreducible) if it has a unique solution, but removing any digit would yield a puzzle with multiple solutions. In other words, every

2条回答
  •  隐瞒了意图╮
    2021-01-05 08:48

    I have an idea on the 2nd option your had suggested will be better for that provided you add 3 extra checks for the 1st 17 numbers

    • find a list of 17 random numbers between 1-9
    • add each item at random location provided

      1. these new number added dont fail the 3 basic criteria of sudoku

        • there is no same number in same row
        • there is no same number in same column
        • there is no same number in same 3x3 matrix
      2. if condition 1 fails move to the next column or row and check for the 3 basic criteria again.

      3. if there is no next row (ie at 9th column or 9th row) add to the 1st column once the 17 characters are filled, run you solver logic on this and look for your unique solution.

提交回复
热议问题