6 kyu

Maze Runner

284 of 7,768adrian.eyre
Description
Loading description...
Arrays
Fundamentals
  • Please sign in or sign up to leave a comment.
  • Nkotiya Avatar

    I liked this kata too much because it makes You to think hard in every marshroot case. Thank You very much!

  • artem-totality Avatar

    Simple funny kata)

  • sanyovichhh Avatar

    I don`t clear understand the 6th rule: "6. If you find yourself still in the maze after using all the moves, you should return Lost.". What is the maximum count of moves that is limited?

  • FamusovDamirSergeyevich Avatar

    Great kata! I think this would be a good introduction to nested lists/arrays.

  • Grazil Avatar

    This comment has been hidden.

  • Dariusz255 Avatar

    Great kata thank you I learned a lot!

  • Dariusz255 Avatar

    I am pretty sure my code was/is correct: However I am facing the followingn :

    File "/workspace/default/tests.py", line 24 test.assert_equals(maze_runner(maze,["N","N","N","N","N","E","E","S","S","S","S","S","S"]), "Dead") ^ IndentationError: unindent does not match any outer indentation level

  • longinii Avatar

    solution wont work when it is correct

  • miggycoder Avatar

    Got this kata done in Python after debugging alot, its a easy-ish 5 kyu and a more challenging 6 kyu difficulty in my opinion.

  • Hsabes Avatar

    Tests are horrible. Debugging is near impossible with random tests. On top of that, sometimes just adding console.log() will all of sudden pass random tests.

  • Romansh12610 Avatar

    All of the basic tests done, but i got this when trying to attempt: "Should return Lost: expected undefined to equal 'Lost'" and I can't see test parameters unfortunately:( Could you help me with that? lang: js

  • cuadchris Avatar

    Had a lot of fun with this one; thank you!

  • VojtechStepan Avatar

    Wow, amazing. I love this kata.

  • Bigoh20 Avatar

    Very good kata. :D

  • acodeaday2 Avatar

    I don't understand where the start and finish points are stated?

  • LosBlobbos Avatar
  • vailcolorado13 Avatar

    man oh man. this one had me sweatin for hours

  • Tigeriss Avatar

    Is this kata going to be translated to Go? Would like to try to solve it!

  • Christina_M Avatar

    Sadly had to check solutions and do not understand what I did wrong (fixed tests passed, randoms did not).

    It is extremely annoying, however, when tests that pass aren't being displayed and the ones that don't provide no information beyond "(actual) expected to be (expected)".

  • FandaL Avatar
  • rsschool_5923dcd2f64a9d4f Avatar

    This comment has been hidden.

  • Dbeck Avatar

    Had a lot of fun on this one, thank you for the great kata, adrian.eyre

  • ashishkag Avatar

    needlessly annoying.One doesn't need to find starting position in a maze.

  • quantaforce Avatar

    All example test cases are passing but some random test cases (5-8) are failing not able to understand what am i doing wrong

  • zellko Avatar

    Amazing Kata, one of the best that I did so far!

    Enjoyed it a lot. Thank you adrian.eyre

  • D-Mielewczyk Avatar
    File "tests.py", line 6
        maze = def maze_runner(maze, directions):
               ^
    SyntaxError: invalid syntax
    

    I am getting this error, and I am almost sure this is not my bad, any ideas?

  • SmartBucket Avatar

    This is a fantastic problem. Enjoyed solving this :D

  • Rohit kr 063 Avatar

    This comment has been hidden.

  • Cambysses Avatar

    Fun challenge, but significantly harder than any other 6 kata I've attempted. I'd consider this a 5 for sure.

  • Lencof Avatar

    Hello! I use Python3. I have a problem with the Python interpreter "Eror102". Thinks!

  • laurelis24 Avatar

    i think this is too hard for 6 kata.. xD I don't even know where to begin with.

  • phobco Avatar

    This comment has been hidden.

  • heyitsgany Avatar

    I started learning JavaScript about 3 months ago, trying to make my way into web development. Have been using CodeWars recently as a practice to make sure I'm understanding what I'm learning. This one was a very fun problem. It took me a little to wrap my head around, and I'm sure my solution is far from perfect; but, I'd like to say that this has really helped me build some confidence! Thanks.

  • Gabri_ Avatar

    I get this error: TypeError: Cannot read property '3' of undefined I'm in javascript but I compiled the problem in many editors and only this one gives me this problem? how can I fix? Thanks

  • Rosscurry Avatar

    Hi, I'm passing all the tests but then failing on the attempt. Unfortunately the feedback only tells me that I'm failing. How can I see the maze & directions to check out where I must be going wrong. Thanks in advance.

  • owen_dev Avatar

    First kata I have encounterd that does not make sense to me. How do you navigate the maze(2D arrays) with the directions???????? I'm so disappointed in myself that I cannot figure this kata out.

  • kmadl Avatar

    I started codewars about a week ago and this is without question one of the more creative, well explained kata I've done. Will be doing others by you as well. Thank you

  • libertytommy Avatar

    This comment has been hidden.

  • OmegaAI Avatar

    Great challenge that visualizes the algorithmic problem.

  • Neil1312 Avatar

    This comment has been hidden.

  • Plucik Avatar

    This comment has been hidden.

  • Schulzkafer Avatar

    This comment has been hidden.

  • wllmlng Avatar

    This comment has been hidden.

  • pskrillz Avatar

    This comment has been hidden.

  • ivmoskalev Avatar

    This comment has been hidden.

  • Lion007 Avatar

    Hello,

    This kata in Python has issues in test cases.

    Maze equals:

       [[1,1,1,1,1,1,1],
        [1,0,0,0,0,0,3],
        [1,0,1,0,1,0,1],
        [0,0,1,0,0,0,1],
        [1,0,1,0,1,0,1],
        [1,0,0,0,0,0,1],
        [1,2,1,0,1,0,1]]
        
    

    test.assert_equals(maze_runner(maze,["N","N","N","N","N","E","E","E","E","E","W","W"]), "Finish") while that test case should be "Lost".

    Also other test cases show "Finish" instead "Dead".

    Kindly ask the author to check.

    Thank you!

  • dem4ron Avatar

    very fun kata! helped me to improve my debugging skills in CW:D

  • lbvf50mobile Avatar

    This comment has been hidden.

  • rowcased Avatar

    C Translation available. Please scrutinize for approval, thanks!

  • damarinov1 Avatar

    Very challenging kata

  • LiemLT Avatar

    I'm so frustrated with this Kata. Thought it was easy at first but then found out some tricky situations. But even after fixing them, whenever I click the "Attemp" button, the number of Passed and Failed cases kept changing. Like there're time they're 74 - 36, 72 - 38, 70 - 40, 80 - 30....

  • heckadactyl Avatar

    This was a really cool one (challenging for me in a good way as a beginner)...thanks!

  • detuvoldo Avatar

    So many wrong test cases, they made me feel so annoyed when I had to check again so many times and found that it is the problem of test cases.

  • dsprang Avatar

    This comment has been hidden.

  • tudtude Avatar

    This is very sweet, love it

  • PropeReferio Avatar

    Loved this kata. Lots of fun. It would be nice to have in the description that if the player leaves the confines of the maze, that the function should return 'Dead'.

  • zzork Avatar

    This comment has been hidden.

  • Ohmmega Avatar

    what's the starting point?

  • Hotasice123 Avatar

    For JavaScript there seems to be a mistake. I fail test, where maze looks like this:

    [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]

    The directions are simply = [N, E, E]

    As you can see it should return "Dead" as I bump into the wall (and I try to return it), but this test tells me that it expects "Lost". What on earth?

  • Captainmoe Avatar

    When call the log the return value I get 'Finish' but I still get the error: "Should return Finish - Expected: "Finish", instead got: nil". The last line of my code is returning 'Finish' not nil

  • fedeberge Avatar

    Wow I loved this kata.

  • abizmo Avatar

    I think some test are wrong, for example: maze = [ [ 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1 ], [ 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1 ], [ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1 ], [ 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1 ], [ 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0 ], [ 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1 ], [ 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1 ], [ 1, 1, 0, 1, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1 ], [ 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1 ], [ 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1 ], [ 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 3, 1 ], [ 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1 ], [ 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0 ] ];

    var directions = [ 'W', 'E', 'S', 'N', 'S', 'S', 'W', 'S', 'S', 'S', 'N', 'E', 'N', 'W', 'S', 'N', 'E', 'W', 'E', 'N', 'W', 'S', 'E', 'S', 'W', 'S', 'E', 'N', 'E', 'N', 'E', 'E' ];

    After the first move you are Dead, instead it expects that you are lost

  • sdempsey13 Avatar

    I keep catching a random number of errors between 5 and 15. The error messages don't present much of a pattern to work on. Is there any way to see input for debugging purposes?

  • flocurity Avatar

    This comment has been hidden.

  • dimglyn Avatar

    Pass all tests but shows error:

    TypeError: Cannot read property '3' of undefined at mazeRunner at /home/codewarrior/index.js:67:19 at /home/codewarrior/index.js:135:5 at Object.handleError

  • heptapod Avatar

    My first attempt passed 149/150. I reloaded the page, attempted again, passed all. Is this a thing?

  • rishirawat Avatar

    Log:

    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]] Directions: ["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"]

    Should return Finish - Expected: "Finish", instead got: "Lost"

    This is the log I got when i attempted. I think this testcase is incorrect.

  • michielStaes Avatar

    Uuuuurgh my solution is so messy!

    Very fun kata!

  • seasidetesting Avatar

    I like this kata, since it's easy enough so solve quickly and at the same time hard enough to invite creating a class or two and then let the objects 'talk' to each other.

  • WinfredH Avatar

    love this kata! interesting:)

  • user8138641 Avatar

    I love Maze Runner Movie! Thank you for the nice Kata.

  • BusyReadingSomething Avatar

    This comment has been hidden.

  • pieterst Avatar

    I finished this Kata succesfully (C#), but didn't take into account the rule that if you reach finish before the end of moves you should return "Finish". I had 1 test failing from the local ones, but the non visible tests apparently don't test this condition, so I could finalize it..

  • nicuparente Avatar

    This comment has been hidden.

  • RobertRappole Avatar

    This comment has been hidden.

  • Stephard Avatar

    My Python code is passing the sample tests but randomly fails at different real tests. The system complains that I am showing either 'Finish' or 'Lost' instead of 'Dead'. Is there any way I can look into the test cases to see whats going on?

  • OscarAlvarez Avatar

    This comment has been hidden.

  • john129er Avatar

    For Ruby, I'm passing every single random test and all but one test case. For the last test case (non-random) I get:

    Should return Finish - Expected: "Finish", instead got: "Lost"

    Are you sure this isn't a typo?

    I noticed on the first round of test cases, the third test case should be "Lost", but it instead wants "Finish".

    Test.assert_equals(maze_runner(maze,["N","N","N","N","N","E","E","E","E","E","W","W"]), "Finish")

    But that's impossible for it to be 'Finish' when the finish line is on the very 'east' side of the maze! Please correct both the sample test case and the final test case when clicking submit.

  • Blind4Basics Avatar

    Hi,

    I think you should rewrite the part of the description about the size of the maze :

    "The Maze array will always be square i.e. N x N but its size and content will alter from test to test." instead of "7 x 7". It would be more "accurate".

    Cheers,

    B4B

  • puzkarapuzzz Avatar

    Can somebody explain me how's that possible http://joxi.net/EA4KL0jIQpo02b ? How come 'Lost' is expected there ? Found another interesting test case arr : [ [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 ], [ 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0 ], [ 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0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 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0 ], [ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0 ], [ 2, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0 ], [ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0 ], [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0 ] ];

    directions : ['E','S','N','E','W','N','N','W','W','S','N','W','E','E','S','W','W','E','N','N','N','S','S','E','E','W','S','E','W','E','W','N','W','S','E','E','W','E','N' ]

    expected result 'Lost'. Wtf ?

  • bouchert Avatar

    The use of short or obvious variable names in the Kata Test Cases in Python increases the chance of problems due to collisions with user solutions' choices for their variable names, and it's difficult to debug when this happens. Please try to use as few global variables as possible, and use long, non-obvious variable names and/or store them inside of a single variable or object.

  • jthistle Avatar

    This comment has been hidden.

  • Edwuards1327 Avatar

    This comment has been hidden.

  • zebulan Avatar

    @adrian.eyre,

    Python 2 isn't available.

  • mmaletas Avatar

    I enjoyed this kata and I think I solved it, but one of the Test cases is returns nil instead of lost, and it's kinda weird since it passes every Random Test.

  • St3f4n Avatar

    Hello Adrian here's a PHP translation(I've put less walls[1's] in random testing so it's a bit more balanced outcome between 'Dead','Lost' and 'Finish', hope you don't mind).

  • Hustlan Avatar

    I'd like to suggest you change this part "The Maze array will always be square ie 7 x 7 but will alter from test to test." to something like this "The Maze array will always be square i.e. 7 x 7 but its size and content will alter from test to test.". I only discovered that the size changes when I opened discuss section. However, great kata anyway.

  • dafaso1 Avatar

    Hi, I'm enjoying this kata, however, I'm confused by one of the specs. I'm passing 49 tests and failing the first one which is:

    N N N W W W N N W W S S S S W W N N N N N N N N N N W

    ✘ Should return Finish - Expected: "Finish", instead got: "Dead"

    Those directions do not lead to the finish...Thanks!!