Beta
#1 Step Motor Fun: Wave drive
Loading description...
Algorithms
Mathematics
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.
Hi again,
as stated in your last kata, the type of the values is not currently acceptable. It leads to more problems than anything
Cheers
Kata description looks horrible in light mode. Maybe don't do the fancy box formatting? I think it's pretty unnecessary
Agree.
Hi again,
This should show up in the console:
the kata is currently a total mess, about use of Decimals at some places but not at others, and the description needs a big clean up to reflect thecurrent specs. This makes the completion of the kata very annoying, right now, so I'll unpublish it to avoid users dropping downvotes on it.
Cheers
oh, the above is because you use unittest assertions, I guess. You should stick to codewars test framework (see docs)
No unittest then.
Hi,
If Decimals are used in the full test suite, they also should be used in the sample tests. There aren't much things more annoying than discovering specs when you go from the sample tests to the full tests... ;)
Cheers
Hi. Let them all be floats then.
I AM VERY SORRY I missclicked and unpublished your kata back to draft. It was unintentional, please feel free to republish if you have no reason to keep it in draft state.
No problem.
From comments below:
This is not yet resolved, the values in the input array are still floats, and hence not exact.
Agree. Changed in 360 degrees and random tests. Should be good now.
Some fixed tests are still using floats.
Yes, I changed floats only from generators. Values in simple tests are manually written and come to users unchanged. I think there are no problems with this because users can receive and process data on their side the same way I can prepare it on mine. Otherwise,I don't understand how it can impact Kata.
Whether the values affect the outcome of this particular set of tests or not is one thing, but both of the statements quoted above are generally not correct.
This comment has been hidden.
Why pass
3.600000000000000088817841970012523233890533447265625
and let the user guess that you meant3.6
?As usual: https://docs.python.org/3/tutorial/floatingpoint.html
Yeah, it has sense; let's switch to strings for input. I also added a requirment for tolerance in description, based on real motors.
Is the 3.6° step fixed for all tests, or can it be different between test cases?
Yes, it is fixed.
Thanks.
Maybe as a suggestion, turning the amount of coils and the step into parameters could make the task more interesting. What do you think?
There are methods to increase precision even without increasing the number of coils. But I saved it for my next Katas ;)
This comment has been hidden.
I believe it is only related to random tests. Changed to sliced copies.
Sometimes your solution doesn't work correctly on the random tests: for example, if you take the number
2872.8
, then, because that's 798th switch to the right from the start, it corresponds to 798 => 2 => C, so it should return the sequence ending with'C'
, but your solution for some reason stops BEFORE that, ending with'B'
:I feel like you should recheck your solution and compare its output with mine — maybe I am right and you need to rewrite a part of it, maybe I'm wrong and I need to think of smth else :/
Yes, you are right; it should return the sequence ending with 'C'. I can't repeat the issue; however, I believe there can be a problem with float division. I reviewed lines related to that; It should be more stable now. Added 2872.8 to simple tests.
Maybe change the setup of the kata to avoid floating point errors completely? Use precise values expressed as for example fractions, decimals, or stringified decimal values, instead of binary floats?
Yes, it works better with decimals and gives different values against rounding random tests. Implemented. Great notice.
Thank you for cooperation, now there are no questions from me :)
For the test "360° turn positive direction", when we turn to 360° position, the following error happens:
However, for the very next test, when we get to the 360° via 3.6° steps, the answer is
'B_C_D_A_..._B_C_D_A_'
, ending withA_
, while in this test the ending is'D_'
.Why there are different endings for the answers if we eventually turn in the both cases to the 360°?
You are right, it should be the same and ending with A_. Fixed.
For sample tests, I feel like the testing on raising the
ValueError
can be done with the help oftry-except ValueError-except-else
:Yes, that way it looks much better. Done.