Ad
  • 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

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

  • Custom User Avatar

    I'm sorry but I still didn't fully get the issue... I have personally tried to randomly generate as many mazes as I could, but never encountered any issue.

  • Custom User Avatar

    Sorry, but I haven't understood. Where do you get the bug?

  • Custom User Avatar

    For the moment I can increment n to 40. Worst case you can copy-paste the maze in a text editor on a large-enough screen (??).

  • Custom User Avatar

    Yeah, that's what the tests have now (for n<16). I don't know what the optimum n is.

  • Custom User Avatar

    That's a great idea! I just remembered that CodeWars JS runs on Node, so I can just console.log the maze on Codewars! The only issue is that some of the 12 random mazes will be too big and cumbersome to be visualized properly in the console (up to 100x100 arrays!). I updated the cases so that the first two mazes (of fixed content and sizes) plus the random ones which will are smaller than 15x15 will be logged. Let me know if you find this reasonable.

  • Custom User Avatar

    Hi andrewMacmurray!

    • the test cases first verify your solution for the first maze (1st group of tests), and then repeats the same group of tests for different mazes (including some randomly generated ones). The description of the group of tests says "testing for 'n'th maze".
    • The group of tests first verifies the format of your solution (independent from the maze), and then checks the content of your solution (dependent on the maze).
    • Anyway, I tried just now submitting a solution as follows, matching the result in your comment.
    function getToX(maze){
      var path, values;
      return {path:[[0,0],[0,1],[0,2],[1,2],[2,2],[3,2],[4,2],[4,3],[4,4],[4,5]], values:["_","_","_","_","_","_","_","_","_","x"]};
    }
    

    You're right, it is a perfectly fitting solution for the maze in the 1st group of tests (same as in description) and, therefore, has passed all tests for that maze (1st test group). However, the same solution is not correct for all possible mazes of course, and will not pass for the second group of tests.

  • Custom User Avatar

    Thanks for the appreciation, Katbow! The array of values '_'ending with 'x' should be quite useful for the codewarrior to debug the solution. Getting the right path is the most valuable info of course, and most of the tests check the path rather than the array. But you still need to get the values array right to pass this kata.

  • Custom User Avatar

    All good now! I really like this kata, btw!

  • Custom User Avatar
  • Custom User Avatar

    I really enjoyed this kata! Great job!

  • Custom User Avatar

    The 7th test is giving me:
    Expected: 2469135819, instead got: -2469135813
    though I'm getting correct results for other tests. Given the previous comment (probably not a coincidence we get the same result), I guess it's an issue...

  • Custom User Avatar

    Yeah, the test was checking if your path was going in steps of 1, but the error message was wrong. I confirm that you do need to start from [0,0]. Thank you for spotting it out!

  • Loading more items...