Retired

Chicken crossing the road (retired)

18 of 19KK201431873
Description
Loading description...
Puzzles
Fundamentals
  • Please sign in or sign up to leave a comment.
  • LogicalX Avatar

    Please everyone who downvoted reconsider, I know there were a lot of issues with this before but they're fixed now :)

  • Blind4Basics Avatar

    It's not said in the description that the left column will never have 'o' inside it. It should be told.

  • rowcased Avatar

    You will be given an n x 2 2-D array in which:

    • n is the number of rows in the array
    • 'x' will be the chicken
    • 'o' will be an obstacles
    • '0' will be an empty space.

    Using these directions:

    • 'U' for up
    • 'D' for down
    • 'R' for right

    return a list which shows the path the chicken must follow in order to avoid obstacles and make it to the other side with the shortest route.

    If there are multiple routes with the same length, choose the topmost one.

    It is guaranteed that the chicken will be on the left side, and that there will be a route or routes to the right.

  • LogicalX Avatar

    C++ version has been removed due to inconvenience, it will be added back later, when all issues are resolved

  • Blind4Basics Avatar

    ...holy... xo

    Guys, when I tell you that this and that fixed tests are missing, I mean those specific tests. Meaning choosing to use only 2 of the 5-7 I gave isn't a good idea.

    • still missing 1x2 and 2x2. I/we don't care that it's not interesting, it's to have in the fixed tests
    • fixed tests != sample tests != test suite. Currently, you have 3 fixed tests in the sample tests, and 0 fixed tests in the test suite.
    • What the hell... x(
        print(testcase,chicken_route(deepcopy(testcase)))
        test.assert_equals(chicken_route(deepcopy(testcase)),solution(testcase))
    

    This is still here!?
    => coordonate your actions. You're both overwritting your changes...

  • Blind4Basics Avatar
    • the test suite needs fixed tests too (use the sample tests)
    • now that the problem is nx2, a lot of cases are missing in the fixed tests:
      • 1x2
      • 2x2
      • bigger boards, especially stuff like that:
    00      00      00      00      00
    0o      0o      0o      00      00
    0o      xo      0o      0o      0o
    xo      0o      0o      0o      0o
    0o      0o      xo      0o      0o
    0o      0o      0o      00      00
    00      00      00      00      00
                            0o      xo
                            xo      0o
                            00      00
                            0o      0o
                            0o      0o
                            00      00
    
  • Blind4Basics Avatar
    • use the new test framework to make the test suite comprehensible
    • why in the world passing n while this info is directly accessible through len(road)...? xs => it's python, not C => stick to one single argument.
  • user9644768 Avatar
  • user9644768 Avatar
  • user9644768 Avatar

    After the update:

    Log:
    [['0', '0'], 
    ['0', '0'], 
    ['x', 'o']] ['U', 'R']
    
    ['U', 'R'] should equal ['U', 'U', 'R']
    

    From description:

    To finish, return a list with direction(s) ('U','D' and 'R', for up, down, and right) in which the chicken should follow in order to avoid the obstacles and make it to the other side with the shortest route

  • B1ts Avatar

    It should be mentioned that input is always 3 x 2 list (although, why not make it more general?)

  • mauro-1 Avatar

    User can modify the input.

  • Mercy Madmask Avatar

    Sample tests in python use 0 then attempts use '0'.

  • user9644768 Avatar

    Testing are inadequete in both C++ and python For example:

    {{'o', '0'},
    {'x', 'o'},
    {'0', '0'}};
    

    is not being tested.

  • user9644768 Avatar

    No sample tests in C++

  • LogicalX Avatar

    C++ translation added as a "contribution" because kata creator has gone to sleep :P

  • user9644768 Avatar

    You've gauranteed that chicken will be on left side, but in some inputs there are no chickens at all.

    Other than that:

    [[0, 'o'], [0, 'o'], [0, 0]] None
    None should equal ['D', 'D', 'R']
    

    Who am I giving path to, when there is no chicken in the first place?
    (I ain't mutating the input)