6 kyu
Simple Fun #130: Robot Walk
83 of 285myjinxin2015
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.
Please make test errors more descriptive. Let them at least show the failing example.
Haskell translation
python new test framework is required. updated in this fork
Approved
Cool kata! First tried the brute force approach and timed out. Then realized this is a puzzle and not a plotting exercise. Gave it some thought away from the computer and came up with a solution.
that does not seem to be true, as there is a fixed test
[34_241, 23_434, 2_341]
in all languagesDone in Python
Done for Ruby, in this fork
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 + tests clean up
The final basic test appears to violate the condition that "both of the robot's coordinates stay non-negative."
The robot moves 9348 units North, 2188 units East, and 9352 units South, leaving it at position (2188, -4).
Modified the testcase to
9348,2188,9348
. Thanks for your feedback ;-)And thank you for all of the Simple Fun katas - I enjoy them very much!
感谢关注和反馈。
All but 2 solutions (1 of the 2 is mine) will fail against this test case:
Yes, even your own solution is wrong! :D
description says:
Huh, okay, I looked at the description many times and never managed to catch that line :)
I have run my code and all 7 basic tests and 100 random tests are marked as passed but the option to submit the code is not available. Is this a Codewars problem or a problem specifically with this problem?
Yes, Codewars platform is currently experiencing issues.
https://github.com/Codewars/codewars.com/issues/893
Thanks!
It's happening to me too, hope the they get it fixed soon
(C#) It would be nice to have a fixed test case where the array has less than 3 values. My solution initially didn't account for that and I only accidentally ran into a random test of this nature after some refactoring.
less than 3 values
?But the description already said:
[input]
integer arraya
An array of positive integers, each number representing a command.
Constraints:
3 ≤ a.length ≤ 100
Oh, then it's the random tests that need fixing. My solution only worked after adding in a "if (a.Length > 2)".
But I haven't found
less than 3 values
in the random tests. I ran the code 5 times, no such case found.I just realized, that this is another case of how starting to count with 0 can throw you off. I just assumed that
if (a.Length > 2)
did fix my problem, when in fact I just got lucky with the random tests.if (a.Length > 3)
would've fixed it, since I assume a[3] to exist, which happens to be the fourth, not the third, element.Sorry for the confusion.
It would be nice to have a fixed test case where the array has
exactly 3
values.There are two fixed testcase already exist:
Both in example tests and basic tests. It was added 1 week ago, when I saw the comment from @FrankK(see the comment below)
Now it's a mystery, since my naive solution (without
if (a.Length > 3)
) passes the initial tests, when it didn't last week! It still fails 1 out of 40 or so attempts at the random tests, but the only error I get is System.IndexOutOfRangeException.I'll just leave this mystery alone, I think.
Hi,
I got with one submit a fail on this input of the random test:
new int[]{9348, 2188, 9352}
It said: Expected 'true', actual 'false'
Fixed. ;-) Please re-test.