Example - Keras deep Q-network for catch
The objective of our game is to catch a ball released from a random location from the top of the screen with a paddle at the bottom of the screen by moving the paddle horizontally using the left and right arrow keys. The player wins if the paddle can catch the ball and loses if the balls falls off the screen before the paddle gets to it. The game has the advantage of being very simple to understand and build, and is modeled after the game of catch described by Eder Santana in his blog post (for more information refer to: Keras Plays Catch, a Single File Reinforcement Learning Example, by Eder Santana, 2017.) on deep reinforcement learning. We built the original game using Pygame (https://www.pygame.org/news), a free and open source library for building games. This game allows the player to move the paddle using the left and right arrow keys. The game is available as game.py
in the code bundle for this chapter in case you want to get a feel for it...