5 kyu
Wimbledon Scoreboard - Game
32 of 114dinglemouse
Loading description...
Algorithms
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.
Beautifully done - thanks!
I do agree with some of the other posts here that more sample tests would be helpful.
For tennis fans, it might be worth adding to the description a mention of this easier problem: Give the status of the tennis game
Incomprehensible description of the kata, I read it several times, read the comments and still did not understand anything. If true is a hit and false is a bad hit, why do double misses score points for the non-server? For this kata, you need a detailed step-by-step description of one of the examples.
Double fault.
Refer to the link in the description how scoring in tennis works.
Offering a wall of text from Wikipedia is not a very good suggestion, given that for the kata itself, it would be enough to add a couple of lines to the description to clarify such not-so-obvious points. I think it is in the insufficient description that the reason for the unpopularity of this kata is hidden, because otherwise it does not have any problems or overestimated ranking so that it has so few solutions in 5 years.
The NOTEs part of the Kata description already says
Not all Katas are for everybody -- anyone not familiar with basics of tennis scoring should probably avoid this Kata.
C# Translation added.Please review and approve~
Approved :-)
From passing all fixed tests and failing all random ones to success by adding 1 line in 30 minutes >.<
My problem was not resetting service fault after serving successfully 2nd time. Apparently it never occured in fixed tests o_O Such case is worth adding.
Anyway, great kata, sir!
Lots more here for you: https://www.codewars.com/collections/dinglemouse :-)
Regarding the test comment - did you mean a fixed test like this:
false, true, false, true, false
(Where server wins 1st point on 2nd serve, and then 2nd point on 1st serve)
Thanks
Not entirely, here's what I mean:
given:
balls = [false, true, false, false, true, false]
Incredibly my approach managed to pass all fixed tests.
The example you shown is just standart case of 1 fault and 2 points for server.
Does that make it clearer?
New test added.
Please add a fixed test about many successful services after a single fault: apparently it's only caught in the random tests.
My code passes all of the standard tests but none of the random tests. I took the list of balls values and manually parsed them to determine points and compared that to what my solution comes up with and what the test case is asking for. My code comes up with the same results as I do, which tells me that my code is doing exactly what I want it to do based on my understanding of the problem. Obviously I'm not understanding something about how to assess the points earned.
Considering that the tests are quite lengthy and my code isn't short either, what is the best way for me to get some direction here? Should I just post the true false values of one of the tests I am failing and add in my notes as to how I am assigning points, determining game wins, switching who serves, handling deuce and advantages? Should I share my code?
Thanks
Option 1 - What language? I can add more random tests with less balls. That will make your debugging easier.
Option 2 - https://gitter.im/Codewars/codewars.com/kata-solving-help
I am using Ruby.
@DM: I just added a first batch of random tests (length 80 for the input). Is that ok for you?
Hi again, DM!
Ok, so after some chatting with guy, it turns out that the fixed tests are lacking some inputs with an even number of consecutive
in
. That's why he could pass the fixed tests. Could be a good idea to add one more with a miw of the sequences (odd/even).cheers
Hi @B4B - please give me some example of missing test with even numbers of
in
. Does it have to span games etc? What's the details?I finally passed all of the tests. The problem was with how I was thinking about tennis scoring which resulted in mishandling the array. My solution, which passed all of the static tests and none of the random tests, was:
Example 1: balls={[false, true, true, false, true]} false > ignore true, true > ignore false > ignore true > implied false > server gets a point
When handled properly: false, true, true, false > non serving player gets a point true > implied false > server gets a point
I don't know if you need to add a test for this, but a test like the following would have caught me early on: balls={[true, true, false]} balls={[true, true, true, true, false]} These are essentially representing a volley in which the non serving player scores a point, which is never tested for until the random tests.
@guysbryant - thanks for that info
For Java
@B4B - any chance you could do same for Python/Ruby?
no problem, I'll do that later today (poke at me if ever I forget to do so)
Hi @B4B - Thanks for approving...
It gives me incentive to do more work on the next Kata of this series now :-|
I hope so! ;p
python updated version ruby one
;)
cheers!
Approved x 2. Cheers :-)
I might be thinking about this incorrectly... How would the true/false sequence work for the real world situation of a shot which lands in correctly, but is not returned (opponent doesn't get a raquet on it). In other words if P1 serves, it lands in, but P2 doesn't get a raquet on it, then in the sequence is there a corresponding F (even though there was never a ball that landed out?).
I see the caveat for the last ball in the sequence, but I just wanted to clarify that an untouched good shot would still be a T and F sequence even if there was no return (in the real world).
Hopefully that makes sense, and we can assume scenario 1 is as intended? And as I type this, just wanted to clarify when you say "all the balls the players have hit and whether they landed in or out", am I to assume that the balls don't actually have to land to be present in the sequence? (ie p1 hits it to p2 who returns it into play before it hits the ground would be T / T). Sorry if I'm being pedantic, just trying to clarify how I'm to think of it.
Thanks for the question.
Correct. There are no air-swings. i.e.Nobody ever completely misses the ball. So there are no aces (e.g. serve-miss). Except, as you said, the only special case is the last ball of the sequence.
In your example
T/T/F
is case (1)--
The array elements are meant to represent balls successfully/unsuccessfully hit. There was not an intention to say they had to actually land on the ground. Volleys are fine.
If you think the description is misleading about that please let me know how to improve it.
Thanks for the clarification. I was probably just overthinking it. Thanks for the kata.
No, you're not over thinking it. That was my immediate thought, which then makes the reconstruction almost impossible. This should be clearly stated in the problem that nobody ever misses. Particularly since the edge case of finishing with a True ball. In essence that edge case IS a miss, it COULD BE an ace...
Just an oddity of the kata as it is now - poor 'user requirments' gathering maybe
Um, perhaps that only means now two people are overthinking it :-)
~
false
means that a hit ball landed out (like it says)This is most crucial information, and it must be in the spec.
Added to Notes.
Why?
warning, a player wins the game if he wins a point when he's already at 40, so:
@DM: a link to the actual rules of the game could be of use.
It's there already!
@ZED: sorry, but I'm bored with that again: 7 kyu? Seriously, but just open your eyes! x/ You're completely blind to ranking.
Well, I'm finer now. Just needed to spit it out... :p
@B4B Nope, it is you who are always complicating the task. Katas whose solution can be directly translated from the desc are white (maybe 6.5 or 6).
no, you're wrong on this, sorry (btw, I don't see where I'm complicating the task here? Is it because I use more characters than you ? :p ).
You're so good that you don't even realize the difficulty of a task. Ask yourself again: how is it that you ALWAYS rank at least 1 below the approval rank? (in 80% of the cases. And in the ramaining 20%, there are 15 where the gap is even greater than that...). It's kind of my day to day work to evaluate this kind of things. And that drives me crasy to see you behaving so.
@B4B You wish to rank average, that's nice. But gererally, the result is more like in normal distribution where some guys rank higher and some rank lower. I may rank lower sometimes, higher sometimes, that's normal, that's how i feel about the kata in the first place. Ranking should be a subjective thing but not an objective thing, think about it, if we all ranking while thinking how the final result would be, then how can the final result representing the actual difficulty 'correctly'.
Well, you are the only one who complain my ranking...
Well, characters is not a big thing, if you really want my opinion on your codes... I would feel better if there are no comments.
try to get a gaussian with less than 5 ranking suggestions, I will be amazed... x)
EDIT:
Well, let's rather say I'm the only one to say it out loud...
@B4B
Well, that's the design
failureof CW, 'publish' should mean 'the quality of the kata is good to go' but not include 'with these ranking we can assign the actual rank'. What i mean is that users should still be able to give a difficulty ranking after the kata is published so that the resullt could give a better estimation.@ZED - I tried to promote exactly that idea some time ago, but nobody jumped onto my bandwagon :-(
https://github.com/Codewars/codewars.com/issues/1247
Nah, to make CW better just raising issues would be too slow. My suggestion would be:
Nav to the detail page, and scroll down to the bottom, LOL.
HaHa - I don't know whether the bother fixing that, or just call it a "feature". The green looks nice :-)
OK. Fixed :-)
ADVERT - Anyone for tennis?