
How the Code Works
​
​
The basis of our code is from https://github.com/kidscancode/intro-python-code/blob/master/pong%20game.py
In our code, two main classes are created: Ball and Paddle. The first portion of our code is defining these two classes’ functions, meaning that the ball and paddle are both created, and their attributes are defined. The score variable is created here as well. After these two classes are created, our code next creates a Tkinter canvas and defines its attributes. After this is the actual execution of our code. This comes in the form of an infinite While loop, where Ball and Paddle’s varying functions are called sequentially and infinitely. This While loop also defines when the ball touches the bottom of the screen (the player has failed to bounce back the ball). When this happens, the score is reset, and the game immediately restarts. For more specific information on our code, please see the line by line pseudocode attached on the final version of our code (Version 4.2).
​