Let Machine Learning Code an Infinite Variety of Pong Games

In a very real way, Pong started the video game revolution. You wouldn’t have thought so at the time, with its simple gameplay, rudimentary controls, some very low-end sounds, and a cannibalized TV for a display, but the legendarily stuffed coinboxes tell the tale. Fast forward 50 years or so, and Pong has been largely reduced to a programmer’s exercise to see how few lines of code can stand in for what [Ted Dabney] and [Allan Alcorn] accomplished. But now even that’s too much, as OpenAI Codex can generate a playable Pong from just a few prompts, at least most of the time.


This endless loop of Pong is the handiwork of [Jose Antonio Garcia Peiro], who wanted to explore the possibilities of on-the-fly AI-generated code. Pong seemed like a good choice, so he whipped up a handheld console with a Raspberry Pi Pico W and a 240×135-px LCD display. [Jose] chose MicroPython for the code, since an interpreted language means the output from the AI would be directly useable. To actually generate the code he chose OpenAI Codex, an API that’s designed to translate natural language to code.


All that was left was to come up with the prompt that will generate the code for the game. The prompt has the merest skeleton of code for the game, specifying things like the libraries needed and how to read the Pico’s buttons, along with comments that direct Codex on the classes needed for the basic game elements — ball, paddle, and a unifying Pong class. And that’s it, really — push a button, the AI generates about 300 new lines of code, and about 80% of the time, you get a playable game.


The point of al ..

Support the originator by clicking the read the rest link below.