Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • Profile pic

    Oh, I am so careless about the condition, yes, it is a necessary but not enough condition. Thanks! It is really a hard kata

  • 9571508?v=3

    That condition is necessary but not enough. You can be sure that with less than 17 you can't have unique solutions, but as you see, with 29 givens you still can have multiple solutions.

  • Profile pic

    according to kata description:
    Note: The minimum of givens required to create a unique (with no multiple solutions) sudoku game is 17.

    so the first one should have unique solution, for it has 29 givens (>17), why there are multiple solutions?

    original puzzle is valid, and solvable, and > 17 givens, so it should pass the test. maybe the description is somewhere wrong

  • 9571508?v=3

    The first solution is not unique, this one works too:

    [[8, 2, 1, 5, 7, 4, 6, 9, 3], 
     [3, 4, 5, 2, 6, 9, 1, 7, 8], 
     [7, 9, 6, 8, 3, 1, 5, 2, 4], 
     [2, 5, 9, 4, 8, 7, 3, 6, 1], // In these 2 files we swapped 9 and 4 of the 3rd and 4th columns
     [1, 3, 4, 9, 5, 6, 2, 8, 7], 
     [6, 8, 7, 1, 2, 3, 9, 4, 5], 
     [5, 7, 8, 3, 9, 2, 4, 1, 6], 
     [9, 1, 3, 6, 4, 8, 7, 5, 2], 
     [4, 6, 2, 7, 1, 5, 8, 3, 9]]
    

    Or it should raise an error in cases of: invalid grid (not 9x9, cell with values not in the range 1~9); multiple solutions for the same puzzle or the puzzle is unsolvable

    I suspect the other may be the same case.

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

    ruby random test:
    puzzle:
    [[8, 0, 0, 5, 0, 0, 0, 0, 3], [0, 0, 5, 0, 6, 0, 1, 0, 0], [7, 0, 0, 0, 0, 1, 0, 2, 4], [0, 5, 0, 0, 8, 0, 3, 0, 0], [1, 0, 0, 0, 0, 0, 2, 0, 7], [0, 0, 7, 0, 2, 0, 0, 4, 0], [5, 7, 0, 3, 0, 0, 0, 0, 6], [0, 0, 3, 0, 4, 0, 7, 0, 0], [4, 0, 0, 0, 0, 5, 0, 0, 9]]
    my solved:
    [[8, 2, 1, 5, 7, 4, 6, 9, 3], [3, 4, 5, 2, 6, 9, 1, 7, 8], [7, 9, 6, 8, 3, 1, 5, 2, 4], [2, 5, 4, 9, 8, 7, 3, 6, 1], [1, 3, 9, 4, 5, 6, 2, 8, 7], [6, 8, 7, 1, 2, 3, 9, 4, 5], [5, 7, 8, 3, 9, 2, 4, 1, 6], [9, 1, 3, 6, 4, 8, 7, 5, 2], [4, 6, 2, 7, 1, 5, 8, 3, 9]]
    why Value is not what was expected??? many random test in ruby seems uncorrect.

    [[3, 0, 0, 0, 0, 5, 0, 0, 8], [0, 0, 1, 0, 6, 0, 5, 0, 0], [4, 2, 0, 1, 0, 0, 0, 0, 7], [0, 0, 3, 0, 8, 0, 0, 5, 0], [7, 0, 2, 0, 0, 0, 0, 0, 1], [0, 4, 0, 0, 2, 0, 7, 0, 0], [6, 0, 0, 0, 0, 3, 0, 7, 5], [0, 0, 7, 0, 4, 0, 3, 0, 0], [9, 0, 0, 5, 0, 0, 0, 0, 4]]
    [[3, 9, 6, 4, 7, 5, 1, 2, 8], [8, 7, 1, 9, 6, 2, 5, 4, 3], [4, 2, 5, 1, 3, 8, 6, 9, 7], [1, 6, 3, 7, 8, 4, 9, 5, 2], [7, 8, 2, 6, 5, 9, 4, 3, 1], [5, 4, 9, 3, 2, 1, 7, 8, 6], [6, 1, 4, 2, 9, 3, 8, 7, 5], [2, 5, 7, 8, 4, 6, 3, 1, 9], [9, 3, 8, 5, 1, 7, 2, 6, 4]]
    Value is not what was expected

    thanks for notice where i am wrong

  • 5276153?v=4

    Nice kata, a good exercise for me.

  • 45905923?v=4

    My solution occasionally solves "invalid" boards generated randomly.

  • Profile pic

    They are not exactly the same. My sudoku solver passes the other kata, but this one for some reason does not pass :(

  • 32236948?v=4

    seems goood, now.

  • 32236948?v=4

    not anymore. ;)

  • 32236948?v=4

    not an issue

  • 32236948?v=4

    Python version updated with random tests and more tests about validation of the grids too.

  • 32236948?v=4

    Java translation

    Consistent with the ruby version. Please, someone, review and approve.

  • 32236948?v=4
  • Profile pic

    .

  • Loading more items...