Draft
Find Parallel Perfect Fifths
Loading description...
Algorithms
Fundamentals
Performance
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.
sol
twice per test case, which is unnecessary.harmony
after it was potentially mutated by user solution, what can lead to confusing messages or tests working incorrectly."Passed"/"Failed"
scream forboolean
and not strings.Thank you!
Bullet 1. removed console logs that were calling sol a second time. I think that's what you meant?
Bullet 2. I don't understand this really. It's been my experience that if I don't use actual and expected in this way that people can mutate the array to cheese the test. Any suggestions for how to fix what you're describing?
Bullet 3. removed all console logs.
Bullet 4. Point taken. I'll consider changing it.
Bullet 5. Not exactly. The variable named passing is there to help even out the ratio of passing and failing harmonies generated. However it being false does not necessarily mean a completely random harmony won't pass, it's just rare that it does.
Bullet 2: it's good that you calculate the reference solution before user input, however, you are still using the same variable 'harmony' you provide to the user in the assert message (possibly altered by that user). You can solve this by providing the user with a copy of that variable instead.
Looking at similar kata's, I would add the following tags: algorithms, fundamentals
Okay, done. Thanks!
I'm timing out on the first bigger random test. Are you sure there aren't any performance constraints? If so, add the "performance" tag.
Ok, we needed to check consecutive chords, not any combination of chords. But still, I get close to a timeout after fixing this.
The reference solution also takes about 10 seconds to pass. Given that the users solution must be about as fast or faster than the reference solution in order to pass the long random tests. I've added the 'Performance' tag to the Kata.
In addition to the tag, I would also add a note at the end of kata's description stating something about the performance criteria. For instance, the number of tests, or the number of chords in big tests.
Okay. Added:
(99 of your students will turn in harmonies around 1000 to 50,000 chords long)
to the descriptionAm I missing something in this random test?
It seems to me the soprano and the bass have a perfect fifth on the 2nd and 3rd chord:
The bass and soprano are a perfect Fourth apart. The Soprano sings higher than the Bass, so the interval is a fourth, not a fiftth. I hope I'm explaining that clearly.
When considering an interval you consider the lower pitch note against the higher pitched note, not the reverse.
I'll try to think of a way to concisely explain that in the description.
Thanks for clarifying; description looks good!
The remark about diminished fifths is unclear. What exactly is a diminished fifth? Only
ti
tofa
?Also, this should be put in the fixed tests as well.
Yes. In the major scale, the only diminished fifth is
ti
tofa
. All of the other fifths are perfect fifths.I added:
ti
tofa
is the only case in which the interval is a fifth and not a Perfect Fifth.to the description
Hope that helps?
Okay. I'll make a fixed test.
A perfect fifth is when they are 8 semitones apart. A diminished fifth is only 7 semitones. That's why it's not perfect.
Not sure how deeply to delve into all that business in the description, or if what I added will suffice.
Added a fixed test for the special case of 'ti' and updated description