6 kyu

Simple Fun #150: Robot Transfer

79 of 241myjinxin2015
Description
Loading description...
Puzzles
View
AllIssues2Questions2Suggestions4Show Resolved
  • Please sign in or sign up to leave a comment.
  • joebegley15 Avatar

    Man, I hate to be rude, but this kata is just loaded with issues.

    First off, the instructions are extremely difficult to understand. They should be re-written. It's impressive that you can write coding problems in a language that is not your first language, but based on the way the kata is written, this should not have been approved.

    Second, the random test cases, do not show you which cases are failing, and this makes it extremely difficult to debug my code.

  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • Krillan Avatar

    For those who don't understand the condition, this example means "Robot start at (0,0) --> (0,1) --> (0,0), total 2 moves"

    1. We sort through the matrix values in order, starting with indices 0-0
    2. The element at indexes 0-0 is "0,1"
    3. Accordingly, the robot goes to the cell of the matrix 0-1 element in which "0,0"
    4. We return to the cell of the matrix 0-0
  • user9644768 Avatar

    Ruby translation should be updated 3.0, see relevent information here: https://github.com/codewars/content-issues/wiki/List-of-Ruby-Kata-to-Update

  • akar-0 Avatar

    What a challenge... To understand the description! I'll try to make it clearer...

    We have a matrix, each point of which contains coordinates. When the robot is on a point, then he goes next to the point which coordinates are contained by the point it is on, and so on k times. From each point of the matrix, we have to check if the robot goes back to the same point after k moves (if the robot goes back to the first point before k moves that point does not count). For example in the first matrix of the description, the robot goes back to initial point 8 times, only case 2,2 is not valid (0,0 -> 0,1; but for all others it's ok: ej 1,0: 1,1-> 1,0; 2,1: 2,0->2,1, etc.)

  • yaksorok Avatar

    could not understand the instructions. English is not my native language either so I really cannot offer confident help of clarifying the instructions. One thing I do see - it needs rewriting. Even Example does not help.

  • FArekkusu Avatar

    The current description is terribly misleading. You're saying the same thing twice while it's unknown if number of moves should equal k or can be greater than k too.

    We want to compute number of points who robot after K moves returns to that.(If the robot returns to the same point after K moves then that point adds to the result)
    

    should be something like this:

    For each point in the matrix we want to know if robot returns back to it after exactly K moves.
    
  • JohanWiltink Avatar

    Haskell translation

    It's time to lightning again, Alien One! :yum:

  • ryanq214 Avatar

    It is hard to understand the instructions, and i read in other comments that english is not your native language so it is understandable but let me make sure i understand this right before I try to solve it. I would appreciate if you could answer my questions.

    if the robot returns to the point it started at in that turn in less than K moves that does NOT count towards the total. ( the total being the answer that is retured, 8 in the case of the instructions.

    So the robot has to return to the start point in exactly k moves to count toward the total?

    But it also sounds like your saying if the robert returns to the start point even if it takes more moves that "k" to count that towards the total too?

    Am i understading this right?

  • bouchert Avatar

    I'm not certain I understand what you mean in the description when you say (although the robot may transfer k moves n times loop back to the starting point). It's a bit unclear from what seems like slightly broken English grammar in that paragraph, but it sounds like you are saying we should count any cycle that's a multiple of k in length as well, but the test cases clearly only accept cycles of exactly length k.

    Unless I'm misunderstanding, it seems whatever you are saying in parentheses isn't relevant to the solution. If that is the case, might I suggest you simplify it to say: You should stop counting moves as soon as the robot returns to the starting point. That is, if the robot returns to the starting point in fewer than k moves, that point should not count as a valid point.

  • maiya-22 Avatar

    Could someone please clarify the instructions? I'm not sure what they are asking for. Thanks.

  • kazk Avatar

    How should we handle the cases where the robot returns before k moves and at k moves?

    Failed few tests where the path loops:

    /*
    matrix = [
      ["0,1","2,6","5,4","6,3","1,0","4,0","1,4"],
      ["0,4","1,4","3,5","0,3","5,5","2,2","1,3"],
      ["3,3","1,4","0,0","1,1","5,5","4,1","3,3"],
      ["1,3","3,6","0,1","0,6","1,2","4,1","5,2"],
      ["6,1","6,6","2,6","0,1","6,3","1,0","2,6"],
      ["4,4","3,0","2,1","1,2","2,2","2,1","4,0"],
      ["1,5","1,3","3,1","6,5","5,5","3,2","3,2"]
    ]
    k = 4
               1        2        3        4    moves
    (0,4) -> (1,0) -> (0,4) -> (1,0) -> (0,4)
    (1,0) -> (0,4) -> (1,0) -> (0,4) -> (1,0)
                       
    ✘ Expected: 0, instead got: 2
    */
    
  • user5036852 Avatar

    Another great kata! Thanks!