I carried out simple tests at each step of my project in order to ensure that I wouldn’t have to go back and fix half of my code at the end. The main tests were done once the whole project was completed to ensure the results were aligned with my expectations. These included testing how the speed of the paddles and the ball affects gameplay and ensuring all collisions/movement worked correctly.
After the project was completed I carried out detailed tests of the functionality of my code. This included testing out how each button acts, how the AI works, whether collision logic works correctly and if the paddle moves when it’s supposed to. Below is a test case table illustrating the tests I carried out.
The graphs below represent testing done to see how the paddle’s speed affects the win-rate of the games. The right paddle was kept at a constant speed of 8 and the left paddle was changed from a speed lower than the right paddle’s to a speed that was higher than it. The results align with what I expected with the paddle of a lower speed losing more games than winning, having a 50:50 result when both were the same.
Based on these results I conducted another test with the left paddle’s speed higher than the ball’s speed and the right paddle’s speed. I expected it to win more games than the opponent with the lower speed. After running the simulation for the same number of games with the same variables kept except for the paddle speed the results showed that I was right and the left paddle did indeed win more games than the right, slower paddle.