• This case was from random section, I can't reproduce it.

    But I got the same error for another test grid and it looks like I once again confused the sequence of the log and error messages, the user interface is rather unfriendly.
    This test grid really has multiple solutions, but my scripts return only one. My mistake.

    Thanks for your help!

  • It looks like some of the base grids used to generate unsolvable cases might accidentally generate valid case. :/ That's annoying...

    Does it happen often?

    edit: are you absolutely sure this is the input causing troubles? (note: I checked, this one is effectively solvable)

  • Something wrong with Python test cases.

    "Invalid grid should raise an error" appears for

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

    This board has only one solution, I tested it with my script and a lot of other submitted scripts.
    Can anyone suggest what the problem is?

  • Solved using optimised backtracking algorithm. But sometimes it fails with 'Invalid grid should raise exception' at random tests. I check for multiple solutions. Fixed test with multiple solution passed. What can be wrong with grid that I don't check?
    P.S. I've managed to submit solutions since it passes sometimes :)

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

  • Yes, that helps quite a bit. Thank you! I had already found a way to correlate the stderr output I was producing to the error message. The count isn't quite right but I found the case where I'm not seeing a second solution. That guide (now bookmarked!) will help in the future, though.

    The previous log entries are still a mystery. I didn't print them in my code, so they must have come from the testing framework. Oh well, not my problem...

    Thanks again!

  • Can anybody tell me what the "Log" boxes are for in the Output window (Python version, if that matters)? I'm trying to debug a problem that only seems to show up in the random tests where it complains that an "Invalid grid should raise an error."

    Occasionally it shows a log box immediately below that showing an input grid and my solution; but I can't tell if that log applies to the red line above it or the green line below. However, the ones I've looked at are all perfectly-valid single-solution cases so far. (Tested on my own graphical solver from 15+ years ago, plus a couple of web solvers just in case.) This, of course, means nothing if the logged input/output grids don't go with the failed test case.

    Or, does anyone have an idea how I can find what input grid failed the test? From there I can go offline and find the problem.

  • Very well! Q.E.D. Dancing links from Algorithm X is the best solution!

  • My time is about 1350ms, I think there is still room for improvement:)

  • who said you didn't have to "search"? ;) But there are some case that are clearly invalid too (input validation), so no need to "search" for those.

  • I'm not sure I understand the assignment here. How am I supposed to figure out if a puzzle is unsolvable without searching.. literally every sudoku board that could generate from the seed I'm given?

  • what is the maxiumum text ms to pass

  • Finally I find the root cause. I use iteration to find the solution. If I write only one iteration function to both return solution and raise errors, the problem above occurs. However, if I write two functions, one is iteration function to find the solution, and another function to validate puzzle, raise errors, call iteration function and return the solution, the problem above will never happen. I am afraid if it is an issue for this Kata?

  • Loading more items...