6 kyu

Pong! [Basics]

207 of 1,301KDaryl
Description
Loading description...
Fundamentals
Games
Algorithms
Object-oriented Programming
  • Please sign in or sign up to leave a comment.
  • Said438 Avatar

    Language: Java

    I passed the sampleTest(), but the ATTEMPT gives me the following error message: expected: <Player 2 has won the game!> but was: <Player 1 has missed the ball!>

    I don't understand why this happens, since the winning condition is evaluated first, followed by the conditions for hitting or missing the ball.

  • 66  Avatar

    Language: C++
    Test suit missing the required headerstd::string.

  • trashy_incel Avatar

    the picture is gone (<img alt="pong" src="http://gifimage.net/wp-content/uploads/2017/08/pong-gif-3.gif">)

  • particleflux Avatar
  • smokerrr86 Avatar

    How is such a mistake even possible: Expected: "Player 1 has hit the ball!" But was: "Player 2 has hit the ball!"? I passed the test task but further...

  • Awesome A.D. Avatar

    The description states

    "Game Over!" - If the game has ended but either player still hits the ball

    Alas, this is misleading; according to tests, "Game Over!" should be returned every time play() is called after either player has won, regardless whether they hit or miss.

  • qrt88 Avatar

    This one was fun. Thanks for the kata :)

  • heckadactyl Avatar

    Heya, the testing suite seems to be around the wrong way. Language is C#.

    Expected: <string.Empty> But was: "Player 1 has missed the ball!"

    (Expected always shows up as whatever I return as, instead of the other way around).

  • heckadactyl Avatar

    Seems to be an error with the random tests in C# (or I could be wrong on something). I pass the test suite no problem. Random tests are outputting the correct results for me when I debug to Console. But when I run the test, it always says:

    Expected: "Player 1 has missed the ball!" But was: "Player 2 has won the game!"

    The weird thing is, even if I change the "player x has won the game" code to say something completely different, so there's no reference ot that result, it will still output that as the result. (I'm clearing the string / result line each time and it works perfectly in the test suite). The other issue is if I return nothing / "" in the code, it will then say Expected: "", or whatever I change the result / return statement to.

    Is something buggy with this or am I missing something?

    EDIT: testing the suite with a complete blank statement (the default code), it says:

    Expected: <string.Empty> But was: "Player 1 has missed the ball!"

    As if it's around the wrong way somehow?

  • shadowprompt Avatar

    Random Tests Test Passed: Value == 'Player 1 has missed the ball!' Test Passed: Value == 'Player 2 has missed the ball!' Test Passed: Value == 'Player 1 has missed the ball!' Test Passed: Value == 'Player 2 has missed the ball!' Expected: 'Player 2 has won the game!', instead got: 'Player 1 has missed the ball!' Expected: 'Game Over!', instead got: 'Player 2 has missed the ball!' Expected: 'Game Over!', instead got: 'Player 1 has missed the ball!' Expected: 'Game Over!', instead got: 'Player 2 has missed the ball!' Expected: 'Game Over!', instead got: 'Player 1 has missed the ball!' Expected: 'Game Over!', instead got: 'Player 2 has missed the ball!'

    Every player has missed the ball, how can 'Player 2 has won the game!' ???

    The language is Javascript

  • Voile Avatar

    Needs edge case: maxScore = 0.

  • agkg Avatar

    Typo in the kata description. Output requirements say:

    '"Game over!" - If the game has ended but either player still hits the ball'

    but the tests only accept "Game Over!" (capital O)

  • user7705613 Avatar

    ... should equal 'Player 1 has missed the ball!' ... should equal 'Player 2 has missed the ball!' ... should equal 'Player 1 has missed the ball!' ... should equal 'Player 2 has missed the ball!' ... should equal 'Player 1 has missed the ball!' ... should equal 'Player 2 has missed the ball!' ... should equal 'Player 1 has missed the ball!' ... should equal 'Player 2 has missed the ball!' ... should equal 'Player 2 has won the game!'

    Why 'Player 2 has won the game!' in full test suite?

  • FArekkusu Avatar
    function f(...args)
    {
    
    }
    

    Maybe it's widespread in C# (at least I heard it from Donald), but in JS it's not conventional to move an opening curly brace to the new line.

  • Blind4Basics Avatar

    well, the idea is nice, but the description is rather desorganized...

    • don't describe implementation details firts, desribe the behaviors instead
    • describe what happens at all steps of the game before going to the implementation details (sounds the same than the sentence above? almost...) => don't mix up everything, going back and forth.
    • the Game over! case isn't described anywhere
    • I had to read the description 4 times before I finally notice the "7 pix" thing. That means the breakdown of the info is pretty unnatural... ;)
  • adrian.eyre Avatar

    PHP, Ruby, Python, TypeScript, C# translations, please check and approve :-)

  • adrian.eyre Avatar

    If player 1 and player 2 take it in turns to have a go, why are sample tests 4 and 5 asking for player 2's result? :-)

    (Javascript)

    Test.assertEquals(game.play(25, 25), "Player 2 has hit the ball!");
    Test.assertEquals(game.play(75, 25), "Player 2 has won the game!");
    
  • JohanWiltink Avatar

    ( JS )

    Description is incomplete. There's a whole class to implement, not just play.

  • JohanWiltink Avatar

    What is the middle of 6 pixels ?!?