Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Ok, fine. Advise: you should unpublish the kata in the meantime. ;)
Keep me posted when you'll republish it, please. :)
Woah. I hadn't thought of all that. I'll try to update the kata around the weekend, when I have time. Thanks for your in-depth feedback!
Reading this makes me think that the tests aren't precise enough: currently, my solution does not match this type of behavior at all! Example:
With that, my solution will keep a, b and c for the secund round. Well acutally, that will end up with the exact same result... Let me think a little bit about it...
Ok...:
With this, my code will return "no winner" because it will keep
c
for the secund round, but with what you describe,a
should win on the second round.I believe your kata/description needs reenforcement... ;)
EDIT: you should explore this type of subcases too:
BTW: the "with majority" condition: is that synonym of "won at the first round" or is it real calculation at the second round? Because in that case...:
c
wins at the second tour but he has better than the majority at this one. So? If you just want to have the answer "1st/2nd round", put it that way in the description, if not, you should emphasize this a bit more, I believe (here again, my solution answer to "first/second round" only...).Thanks for your feedback! I will fix the test cases, and clarify the description. For the voting system, there isn't a way to deal with having 3 drawing votes at the first round. I suppose that it should just be a draw in that case (i.e. returning "no winner").
Hi,
Interesting kata. For a moment, I feared it was a duplicate of the "instant runoff voting", but it's not. :)
Some suggestions:
Test.it
orTest.describe
before the call to the user's function: currently, when printing something to the console, the display of the current test is done before the message related to it is displayed, that's misleading... I ended up debugging the first test for a draw with the test.it message"should return bill and majority"
!test.assert_equals
perfectly does the jobEDIT: the description might miss one thing though: if you get a draw after the first round, what are the remaining candidates on the second round? Only those who were draw or those and the ones who got the second highest score too? (currently, my solution does that. It passed the tests, but is that the wanted behavior?)
This solution wasn't designed to be elegant, only to do the job.
Not an issue, a question. ;p (issues are when kata is not working correctly or contains wrong informations/tests/...)
One important thing is missing in your post: what is the problem on cw? time out? or failure? (I guess the first one) Be aware that your solution has to pass more than 300 tests with very large grids (300 random ones, size of the grid is range(3,75,5) (NxN) and you have 20 tests for each size), so your code has to be optimized/efficient to get throuth them. Abut python verison, 3.4 is a bit faster but good solutions manage the tests in 5s, so that couldn't be an issue.
'Looked quickly at your code: it's really not optimized. One of your function is actually reeeeeally slow and that's where lays your troubles.
This is a very good kata, but my code doesn't work in CodeWars but it does on my computer. I'm using Python 3.6 vs CodeWars' Python 3.4, but I don't think that should have any difference?
Anyway, here's my solution. Thanks if you can tell me why it doesn't work :)
Fair comment.
The use of short or obvious variable names in the Kata Test Cases in Python increases the chance of problems due to collisions with user solutions' choices for their variable names, and it's difficult to debug when this happens. Please try to use as few global variables as possible, and use long, non-obvious variable names and/or store them inside of a single variable or object.
Ah, thanks!
Once you've solved a kata you can click on the
language drop down menu
from theDetails Page
and select+ Add New
. This should open the kata for editing. Once complete the Kata Sensei can approve/reject the translations. Hope this helps :-)Thanks for making it! It was a good challenge :)
Out of interest, I'm quite new and I'm not sure how I can translate Katas. Do you know at all?
Cool, nice one :-), thanks for solving.
This comment is hidden because it contains spoiler information about the solution