If you know English, you can write code

In News, Tools by Xu CuiLeave a Comment

I watched OpenAI’s live demo of Codex today. I have to say it’s jaw dropping – Codex’s capability is well beyond my expectation. It looks like it won’t be long that everybody can write code, as long as he knows English.

Let’s dive into examples. The input is in plain English, and the output is working code.

Input: Say Hello world with empthy 5 times

print("Hello World with empthy" * 5)

Input: Now instead do it with a for loop

for i in range(5):
    print("Hello World with empthy")

Input: Make a web page that says our message, and save it to a file

with open("index.html", "w") as f:
    f.write("<h1>Hello World with empathy</h1>\n")

Input: Look up the current Bitcoin price, and save it to a variable. Now send everyone an email, telling them (a) hellow world and (b) the current Bitcoin

import requests

response = requests.get("https://api.coindesk.com/v1/bpi/currentprice.json")
bitcoin_price = response.json()["bpi"]["USD"\{"rate_float"]

import codex_chimp
codex_chimp.send("Hellow World", "Hello World!\n\nThe current Bitcoin price is ${}.".format(bitcoin_price))

And I did receive the email a few minutes later. Here is a screenshot:

The next example is a simple game:

Input: Add this image of a person (image url), Now make it controllable with the left and right arrow keys. Add this image of a boulder (image url). Set its position to the top of the screen, at a random horizontal location. Now have it fall from the sky, and wrap around. Constantly check if the person and the boulder overlap at all, and if so, you lose. Define what happens when you lose. Clear the screen and show a message saying you got squashed.

The output is many lines of code and I will not show them here. The end result is a game where a boulder is falling from the sky, and you can control a person to move left and right. If the boulder hits the person, then a message appears on the screen. Please feel free to check out the game at https://www.twitch.tv/videos/1114111652

The live demo also included an example manipulating a Word document via Word javascript API. The input is: Remove initial spaces, make every fifth line bold. Then Codex generated code and the document is formatted exactly as instructed.

I encourage you to view the demo at https://www.twitch.tv/videos/1114111652. I myself am very impressed by Codex’s capability. The only thing I worry is, will Codex put me out of a job?

If you find the article useful, you may consider to subscribe:

Leave this empty:

Leave a Comment