Ad
  • Custom User Avatar

    Glad you got it, and I hope you liked it!

    Good job!

  • Custom User Avatar

    To add to the pain. My last submission just passed all 78 test cases in 11918ms and then timed out, so it must be on the cusp.

    Solved, once comparing to less neighbouring points. I'm sure I'll learn a lot from other solutions.

  • Custom User Avatar

    Haha, I missed the random test text. Thinking about it, I think it only looks like it's stopping at the 2nd large grid because it reaches the max buffer size with a print statement, so the algo might be going further. Is their anyway of outputting how far it gets through the 25 random large grid tests?

  • Custom User Avatar

    large grids are random. You can print the input, but not sure how it would help... (maybe by drawing gthe points locally on a canvas...?)

  • Custom User Avatar

    Does anyone know how to view the third large grid test case? My algo gets through all the tests up until this one in 2000ms but looks like it falls into an infinite loop on the 3rd large grid, but I can't seem to get an output to see what is going on. Any help would be massively appreciated as the algo gets through 50 random 4000*1 generated turples in less than 5 seconds.

  • Custom User Avatar

    If "node is grid[2][5] # True" then we should be able to set a list of nodes with the grid co-ordinates, rather than having to reference the grid location in the final list of nodes. I suppose this reflects previous comments.

  • Custom User Avatar

    I appreciate your response, however I'm still getting an error even though the contents, type of list and elements are the same. They have the following types:
    grid1_optimum_path type = <class 'list'>
    Each item is grid1_optimum_path[0] = <class 'setup.Node'>
    and my solution, with the following types:
    path = <class 'list'>
    Each item is path[0] = <class 'setup.Node'>

    If the contents are the same how can these two things not be equal?

  • Custom User Avatar

    I guess you're returning the wrong data type, but it's not visible in the assertion message because both translate to the same string, so:

    • if you're returning tuples, return Nodes instead
    • if you're returning Nodes, return tuples instead.
  • Custom User Avatar

    I have worked out the shortest path from the start_node to end_node in the test, and my function returns the path as a list of nodes yet still my answer says: I don't really know what else to do, I've tried returning the answer is a list of turples and a list of nodes and, any advice?
    Your path is not the shortest path.
    Try again!:
    [(0,0), (0,1), (0,2), (0,3), (1,3), (2,3), (2,2), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4)] should equal
    [(0,0), (0,1), (0,2), (0,3), (1,3), (2,3), (2,2), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4)]