Ad
  • Default User Avatar

    Hi Adrian,
    Thanks for the interesting kata!

    You wrote to Animoni that the maze 2 replies above and the following directions should return 'Lost':
    Test.assert_equals(maze_runner(maze,["N","N","N","E"]), "Lost", "Should return Lost")

    I totally agree, but when I attempt to test it, I am getting this error: "Expected outcome to be Dead: expected 'Lost' to equal 'Dead'". How could the expected answer be 'Dead'?

    Thanks.

  • Custom User Avatar

    Cool, nice one :-)

  • Custom User Avatar

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

  • Custom User Avatar

    Hi @animoni, it looks like your code is return nil but not sure why without looking at it :-) if you want you could post your code here and mark as spoiler and I can try and solve it :-)

    The final test cases (in every language) are below then lots of random tests.

    maze = [[1,1,1,1,1,1,1,1,0,1],
            [1,3,1,0,1,0,0,0,0,1],
            [1,0,1,0,0,0,1,1,0,1],
            [1,0,1,1,1,1,1,0,0,1],
            [1,0,1,0,0,0,0,0,0,1],
            [1,0,1,0,1,0,1,0,0,1],
            [1,0,1,0,1,0,0,0,0,0],
            [1,0,1,0,1,0,1,1,0,1],
            [1,0,0,0,1,0,0,0,0,1],
            [1,1,1,0,1,1,1,1,2,1]]
    
    Test.it("Test Cases") do
      Test.assert_equals(maze_runner(maze,["N","N","N","W","W","W","N","N","W","W","S","S","S","S","W","W","N","N","N","N","N","N","N"]), "Finish", "Should return Finish")
      Test.assert_equals(maze_runner(maze,["N","N","N","N","N","N","N","N","W","W","W","S","W","W","N"]), "Lost", "Should return Lost")
      Test.assert_equals(maze_runner(maze,["N","N","N","N","N","E","E","S","S","S","S","S","S"]), "Dead", "Should return Dead")
      Test.assert_equals(maze_runner(maze,["N","W","W","W","W"]), "Dead", "Should return Dead")
      Test.assert_equals(maze_runner(maze,["N","N","N","N","N","N","N","N","N","S","S","S","S","S","S","S","S","S"]), "Lost", "Should return Lost")
      Test.assert_equals(maze_runner(maze,["N","E","E"]), "Dead", "Should return Dead")
      Test.assert_equals(maze_runner(maze,["N","W","W","W","N","N","N","N","W","W","S","S","S","S","W","W","N","N","N","N","N","N","N","S","S"]), "Finish", "Should return Finish")
      Test.assert_equals(maze_runner(maze,["N","W","W","W","N","N"]), "Lost", "Should return Lost")
      Test.assert_equals(maze_runner(maze,["N","N","N","E"]), "Lost", "Should return Lost")
      Test.assert_equals(maze_runner(maze,["N","N","N","W","W","W","N","N","W","W","S","S","S","S","S","S"]), "Dead", "Should return Dead")
      Test.assert_equals(maze_runner(maze,["N","W","W","W","N","N","N","N","W","W","S","S","S","S","W","W","N","N","N","N","N","N","N"]), "Finish", "Should return Finish")
    end
    
  • Custom User Avatar

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

  • Custom User Avatar

    Hi Animoni. Which language? please provide more info on the test case. :-)

  • Custom User Avatar

    Same here:( That is the only fail I have :(