Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I was wondering, whether it makes a difference whether the constructor or the solve method throws the exception on invalid inputs. But that does not seem to be relevant: I tried to do all validations an calculations in either of both methods with still the same troubles (random tests failing, other tests green).

  • Custom User Avatar

    Only the random tests fail. The other tests all are consistently green (besides timeouts from time to time).

    Also my own, local test cases all are green:

    • grids with 10 rows
    • grids with 9 rows
    • grids with a row with 10 cells
    • grids with a row with 8 cells
    • grids with a number > 9
    • grids with a number < 0
    • unsolvable grids
    • grids with several solution
  • Custom User Avatar

    @Quark_Fox I double checked, that it is the correct grid: The test case's output AND my own System.out.printlns output the same grid right before the "random" test case fails.

  • Custom User Avatar

    Thanks @Blind4Basics and @Quark_Fox for your quick answers.
    I reset the trainer and tried again. Still the same issue...

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

    My code and https://www.sudokuwiki.org/sudoku.htm says, that there is only one, valid solution:

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

    use this string to import to sudokuwiki.org:

    2,8,6,1,5,9,7,4,3,0,5,0,0,4,8,9,1,2,0,1,0,0,0,0,0,0,0,8,0,0,0,0,5,0,0,0,0,0,0,8,0,4,0,0,0,0,0,0,3,0,0,0,0,6,0,0,0,0,0,0,0,7,0,0,3,0,5,0,0,0,8,0,9,7,2,4,0,0,0,5,0
    
  • Custom User Avatar

    I seem to have the same issue. From the description, I checked all these criteria:

    • it has 9 rows
    • it has 9 cells in each row
    • all values are either 0 or in the range 1-9
    • there is only one solution according to my code and also according to https://www.sudokuwiki.org/sudoku.htm
    • the puzzle is solvable
    [3, 2, 7, 1, 5, 6, 4, 9, 8],
    [9, 4, 5, 2, 3, 8, 6, 7, 1],
    [1, 6, 8, 4, 9, 7, 5, 2, 3],
    [8, 5, 3, 6, 7, 1, 9, 4, 2],
    [2, 7, 6, 3, 4, 9, 1, 8, 5],
    [4, 9, 1, 8, 2, 5, 7, 3, 6],
    [7, 8, 4, 5, 6, 3, 2, 1, 9],
    [5, 1, 2, 9, 8, 4, 3, 6, 7],
    [6, 3, 9, 7, 1, 2, 8, 5, 4]
    

    There seems to be something I am missing... Any hints?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    You could remove the first line (empty code comment)