Game of Pong

OpenAI recently released Codex in private beta. Codex is the AI model that powers GitHub Co-pilot, branded as “Your AI pair programmer”.
There is much hype about this technology (and for good reasons), but in order to understand this state of the art automatic code generation technology better, we need to look at a specific example. A good example is one that can be described in just a few lines of text, can easily be understood through visualization and in a domain that is outside of your expertise, so you can better appreciate the value a “code co-pilot” brings to non-experts.
So let’s build the game of Pong!
First Try — Code generation from a general description
When you look up “the game of pong” on google, you are pointed to WikiPedia, which offers the following description:
Pong is a two-dimensional sports game that simulates table tennis. The player controls an in-game paddle by moving it vertically across the left or right side of the screen. The player can compete against another player controlling a second paddle on the opposing side. Players use the paddles to hit a ball back and forth. The goal is for each player to reach eleven points before the opponent; points are earned when one fails to return the ball to the other.
If you would believe the popular press[2], you would expect that the code generation problem was already entirely solved.
Read the full tutorial at
Author: Bart Theeten