Ad
  • Custom User Avatar

    @dinglemouse Thanks a lot! For your guide, it will help me a lot to find a right path to solve it.

  • Custom User Avatar

    So the random test as per my calc.. there are 4 rounds: 1st pong winner 2nd ping winner 3rd pong winner 4th ping winner since the result is even.

    Wrong.

    Rallies are:

    1. ping-pong-ping-pong-ping-pong-ping-ding-plik-funk-
      where ping serves, but eventually misses ==> no point ==> score ping=0:pong=0

    2. pong-ping-pong-ping-pong-ting-pang-bonk-
      where pong serves, but eventually misses ==> no point ==> score ping=0:pong=0

    3. pong-ping-pong-ping-pong-ping-pong-ping-boof-bong-ting-
      where pong serves, but eventually ping misses ==> 1 point to Mr Pong ==> score ping=0:pong=1

    4. pong-ping-pong-whak-wang
      where pong serves, but eventually misses ==> no point ==> score ping=0:pong=1

    RESULT -
    score: ping=0:pong=1 ==> Mr Pong is winner.

    ~

    AFAICT you seem to be going wrong for this Kata rule:

    To score a point the same player must both serve and win the rally.

  • Custom User Avatar

    Hi ! Everyone.... working on this kata with JavaScript since long ago and having some random test not working well.

    • Random test #1: 'ping-pong-ping-pong-ping-pong-ping-ding-plik-funk-pong-ping-pong-ping-pong-ting-pang-bonk-pong-ping-pong-ping-pong-ping-pong-ping-boof-bong-ting-pong-ping-pong-whak-wang'. Expected = pong

    I know it looks like from the comments that there is no issue with the KATA.
    However I am in trouble as I can not understand what should I fix in my code.
    As it appears to me that above rantom test expect me to output sound "pong".
    but with this pingpong staff my mind is heating and cant anymore to work properly.
    So the random test as per my calc.. there are 4 rounds:
    1st pong winner
    2nd ping winner
    3rd pong winner
    4th ping winner
    since the result is even. then who ever made bad shot is losses.
    hence here supposed to expected Mr. ping? right?
    or is it my calc.. wrong? plaese help!!!

  • Custom User Avatar

    Hmmm. I am confused. For Javascript there was no such "edge_cases_and_bugs" test having the noises like you gave, so I don't know why you mentioned that test name in your original mail. But, I have now just added that extra test case to "edge_cases and bugs" but it gave the expected answer as "pong".

    I suspect you have just fooled yourself (and then fooled me). I tried using your solution but importantly I added an extra console.log(sounds) to display what input it was processing. Doing this you can now see your solution has failed on one of the EXISTING "edge_cases_and_bugs" test.

    Log
    pong-ping-bink-pong-ping-donk-pong-ping-pong-bang
    ping-pong-bink-ping-pong-donk-pong-ping-pong-ping-bang
    ping-pong-aaaa-ping-pong-ping-aaaa
    expected 'pong' to equal 'ping'
    

    Here the expected answer was "ping" because:

    • ping-pong-aaaa - Ping serves and wins. Score ping=1:pong=0
    • ping-pong-ping-aaaa - Ping serves and hits last bad shot. Score is unchanged.
    • Final score is ping=1:pong=0; Ping is winner.

    IMO your code is flawed somewhere.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Hmmm... at the end I think the scores are even (1:1)

    • ping-pong-ping-voom-wizz -> ping serves, ping misses; no point; score: ping=0,pong=0
    • ping-wizz -> ping serves and misses; no point; score=ping=0,pong=0
    • ping-pong-ping-pong-ping-pong-foom-bang-plop -> ping serves, pong misses; ping scores a point; score: ping=1,pong=0
    • pong-ping-pong-ping-pong-ping-pong-ping-pong-ping-klak-bing -> pong serves. ping misses; pong scores a point; score: ping=1,pong=1;

    So the rule is:

    If scores are even, then the winner is the player who did NOT hit the final bad shot.

    Since "ping" hit that last bad shot so "pong" should be winner.

    Maybe it is a bug. Please tell me what language this is.

  • Custom User Avatar

    edge_cases_and_bugs !!!! [sounds = 'ping-pong-ping-voom-wizz-ping-wizz-ping-pong-ping-pong-ping-pong-foom-bang-plop-pong-ping-pong-ping-pong-ping-pong-ping-pong-ping-klak-bing'];

    'ping-pong-ping-voom-wizz- // pong win
    ping-wizz- // pong win
    ping-pong-ping-pong-ping-pong-foom-bang-plop- / ping win
    pong-ping-pong-ping-pong-ping-pong-ping-pong-ping-klak-bing'/ pong win

    but random test showing [edge_cases_and_bugs] [expected 'pong' to equal 'ping']

    Help whats wrong with it?