DWITE Online Computer Programming Contest, January 2008, Problem 1
This "game" has been simplified so much that all the players left. Incidentally, with no paddles left on the screen, it makes it even more simple, as there is nothing to bounce off. The only objective left now is to figure out where the ball will hit the edge of the playfield.
The playfield is a rectangle of the size 100 wide by 50 high. Lower left corner is at ; upper right is at . The ball is the size of a single pixel, and the score counts as that pixel lands on the edge. The ball starts out at the center, at , and its velocity will be provided in the input.
The input will contain 5 sets of input, 2 lines each. The first line will be an integer value , the horizontal component of the velocity. The second line will be an integer value , the vertical component of the velocity. There will be no input, and thus there will always be a solution.
The output will contain 5 lines, the location where the ball hits the edge, in the format.
Note: if one was to simulate the game using a loop, the integer values in all of the cases will land exactly on an edge during one of the steps.
Another note: Some might want to draw to screen while developing or debugging their code – this could be helpful to get a better idea of what's going on, but please remember to comment out any graphical code before submitting a solution.
5 0 0 -5 5 5
100,25 50,0 75,50