6 kyu
Simple Fun #150: Robot Transfer
79 of 241myjinxin2015
Loading description...
Puzzles
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
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.
Published Feb 20, 2017
Considering the age it's honestly not as bad as it could be. There's WAY worse old kata out there. Though yes it is still terrible lol.
JS tests un-myjinxined
My brain must be myjinxined after solving a few hundred of his Kata's. I perfectly understood what he meant. :-D
It's not pretty, I know.
python new test framework is required. updated in this fork
Approved
For those who don't understand the condition, this example means "Robot start at (0,0) --> (0,1) --> (0,0), total 2 moves"
Ruby translation should be updated 3.0, see relevent information here: https://github.com/codewars/content-issues/wiki/List-of-Ruby-Kata-to-Update
Enabled in this fork + Cleanup tests
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.)
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.
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 thank
too.should be something like this:
Count points to which Robot returns in exactly k moves.
Description changed. Thank you(@FArekkusu) and you(@UnencumberedPineapple) ;-)
Haskell translation
It's time to lightning again, Alien One! :yum:
Approved. Alien also need sleep sometimes ;-)
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?
No, exactly
k
moves is right. ;-)It means such a sitution: Some robot after 3 moves back to the starting point, after 6 moves it back to the starting point again. and so on. This robot should NOT be counted when
k=6
ork=9
ork=12
...OP solved it, closing
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.
OK, changed the description as your suggestion ;-) English is not my native language. So please forgive these mistakes. Thank you for your feedback ;-)
Could someone please clarify the instructions? I'm not sure what they are asking for. Thanks.
This is the example in description. There are 9 points in
matrix
. Your task is to count how many points: robot start at this point, afterk
times transfer can back to this point.Thank you for trying to help, but I am still very confused.
look at matrix[0][0]. Its value is "0,1", if robot start at this point, robot will be transfer to matrix[0][1], the value of matrix[0][1] is "0,0", then the robot will be transfer back to matrix[0][0].
How should we handle the cases where the robot returns before
k
moves and atk
moves?Failed few tests where the path loops:
I think the calculation should stopped when the robot first time back to the start. That is, if robot back to start less than k moves, this point should not count as a valid point.
Ok, thanks for clarifying :) Can you add that to the description to avoid confusions?
OK, a note added ;-)
Another great kata! Thanks!
Thanks
^_^