This AI tries to code whatever you tell it to, even videogames

This AI tries to code whatever you tell it to, even videogames

OpenAI Codex translates natural language into actual code, and it's pretty darn good at it.


This AI tries to code whatever you tell it to, even videogames - image1
(Image credit: Kilito Chan via Getty Images)

In tʜᴇ ᴇᴠᴇʀ-ɪɴcreᴀsɪɴg lɪst ᴏꜰ thɪɴgs thᴀᴛ machɪɴe lᴇᴀʀnɪɴg AI cᴀɴ ᴅᴏ ɪɴ ᴏᴜʀ ᴍᴏᴅᴇʀɴ wᴏʀld, tʜᴇre's ɴᴏw a program thᴀᴛ ᴡɪʟʟ code (ᴏʀ ᴀᴛ leᴀst, ᴛʀʏ ᴛᴏ code) whᴀᴛᴇᴠᴇʀ ʏᴏᴜ ᴛᴇʟʟ ɪᴛ ᴛᴏ ɪɴ plaɪɴ Englɪsh. Wᴀɴt sᴏᴍᴇ flᴀshy bᴀɴner text thᴀᴛ chᴀɴges ᴄᴏʟᴏʀ ᴇᴠᴇʀy ꜰᴇᴡ secᴏɴds? Tell thᴀᴛ ᴛᴏ OpenAI Codex ᴀɴd ɪᴛ ᴡɪʟʟ code ɪᴛ ꜰᴏʀ ʏᴏᴜ ɪɴ secᴏɴds.

The OpenAI Codex beta, currently only available through an online waiting list, is a simple web tool with three windows: one to type in commands, one that shows the code generated by those commands, and one that shows what the code does. You could theoretically use Codex for all sorts of tasks in over a dozen coding languages, but the coolest use I've seen is coding simple Javascript videogames with just a handful of natural language instructions.

Check out the video below from YouTuber Joy of Curiosity to see it in action.

It's pretty wild—the tool can easily handle simple commands like "make a black circle," but it can also correctly interpret commands that require context, like "make it smaller," and even multi-step instructions like "if the rectangle and the circle overlap, make the circle go in the opposite direction." In minutes, Joy of Curiosity has a crude version of Breakout up and running.

That's impressive, but I noticed a few instances where Joy intervened with little tweaks to the AI's attempt to code. OpenAI also made an official live demo of Codex's Javascript skills (zero intervention required) with a little spaceship game. It's cool how the tool leverages the OpenAI platform to have general knowledge about the world, like when the user tells Codex to "set background to the color of space," resulting in black. The commands get even more elaborate in this demo. With the single sentence beginning with "When the rocket is clicked," Codex successfully programs a boost mechanic that accelerates the ship in its current direction. By the end of the eight-minute demo, the game has scoring, a tutorial, and an objective.

I fully expect that the spaceship video is a manicured demonstration that plays toward OpenAI's strengths and avoids its weaknesses, but the magic of watching a simple phrase turn into actionable code seems very real. Now, even a math-averse person like me can be one of those game directors that points over his programmer's shoulder and says "make this faster, that needs more color." For a look at an alternate use of Codex, YouTuber Ania Kubów was able to make a snazzy (if simple) website to showcase her work.

I suspect Codex is still a long way from being useful for projects beyond demonstrations, but it's a fascinating glimpse at a potential future in which telling computers what to do doesn't require fluency in any language other than the one you learned to speak growing up, a la Star Trek. Concurrently, there's a growing interest among Silicon Valley investors in "low-code" or "no-code" tools that aim to make programming faster and simpler, and even accessible to those who aren't fluent in any coding languages.

OpenAI is still hiding Codex behind lock and key for now, but you can sign up for the waitlist for a chance at access. If I get access, my first goal is to instruct the AI to destroy itself. I'll let you know what happens.

Author's other posts