5 kyu

Wimbledon Scoreboard - Game

32 of 114dinglemouse
Description
Loading description...
Algorithms
View
AllIssuesQuestions3Suggestions4Show Resolved
  • Please sign in or sign up to leave a comment.
  • brodiemark Avatar

    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

  • Krillan Avatar

    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.

  • KataSideKick Avatar

    C# Translation added.Please review and approve~

  • B1ts Avatar

    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!

  • Voile Avatar

    Please add a fixed test about many successful services after a single fault: apparently it's only caught in the random tests.

  • guysbryant Avatar

    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

  • dinglemouse Avatar

    Hi @B4B - Thanks for approving...

    It gives me incentive to do more work on the next Kata of this series now :-|

  • Blind4Basics Avatar
  • ThomFabian Avatar

    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).

    Example For series T / T / F it seems like it could be interpreted as each of these unless a false is always present after shots which land correctly but are not returned:
      1) p1 good serve, p2 good return, p1 bad return ---> p1:0 - p2:15
      2) p1 good serve with no return, p1 good serve, p2 bad return ---> p1:30 - p2:0
      3) p1 good serve with no return, p1 good serve with no return, p1 bad serve(fault) --> p1:30 - p2:0 (p1 on second serve)
      4) p1 good serve, p2 good return of serve with no return by p1, p1 bad serve(fault) --> p1:0 - p2:15 (p1 on second serve)
    

    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.

  • ZED.CWT Avatar
    String[][] expected = new String[][]{{"1","30"},{"0","15"}};
    boolean[] balls = new boolean[]{true,false,true,false,true,false,true,false,true,false,false,false,false,false};
    

    Why?

    P1 serves
    true false -- 15 0
    true false -- 30 0
    true false -- 40 0 GAME 1 0
    P2 serves
    true false -- 0 15
    true false -- 0 30
    false false -- 15 0
    false false -- 30 30
    
    Final
    P1 1 30
    P2 0 30
    
    String[][] expected = new String[][]{{"0","40"},{"0","AD"}};
    boolean[] balls = new boolean[]{true,false,true,false,true,false,false,false,false,false,false,false,false,false};
    
    P1 serves
    true false -- 15 0
    true false -- 30 0
    true false -- 40 0 GAME 1 0
    P2 serves
    false false -- 15 0
    false false -- 30 0
    false false -- 40 0 GAME 2 0
    P1 serves
    false false -- 0 15
    
    Final
    P1 2 0
    P2 0 15
    
  • ZED.CWT Avatar

    Nav to the detail page, and scroll down to the bottom, LOL.

  • dinglemouse Avatar

    ADVERT - Anyone for tennis?