Adding a simple AI allows us to implement a single player game.
Press 1 for a single player game.
Press 2 for a double player game.
Press 0 to watch the computer play itself.
The AI consists of 2 components, a reaction time, and a prediction error. The better the human player is, the faster the reaction time and the lower the prediction error.
The AI recalculates its prediction every so often (based on its reaction time) and every time the ball changes direction when it bounces off a wall
Here, when you play against the computer you will see a red box indicating the exact point the ball will intercept and a yellow box indicating where the computer thinks it will be.