Now that pong is fully automated, it is time to optimize.
First I switched to the game Doeo. The goal of the game is to move your mouse as fast over Doeos as possible. A fun game to use as an example for automation.
I also made a small performance enhancement (10 to 15 percent) by not using getRGB () from BufferdImage, but reading directly from an array. It does take some time to get everything into an integer array, but if that’s done, the for-loop is a lot faster.
The optimized code: