Saturday, February 4, 2023
No Result
View All Result
  • Login
NEWSLETTER
Google Publishers
  • World
    • Africa
    • China
    • Asia
    • Australia
    • Europe
    • India
    • Middle East
    • United Kingdom
  • Politics
  • Lifestyle
    • All
    • Diet and Weight Loss
    • Fashion
    • Health
    • Relationships
    586ea6dd9da96b2ac1f8896ac7d3c7ce

    Day 37: Black Heart Nail Art

    winning88 x400 thumb

    acemanpicks

    download

    Our Favorite Fleece, the Patagonia Retro X, Is a Rare 40% Off

    VRDREQFEGZHK7G7TIED5EIGJD4

    The heated rhetoric over the migrant standoff in midtown Manhattan obscured a stark reality

    bbafbdd8dd79e637a194416b53273f10

    Simple Valentine’s

    34a9064fe6a427c632c4a678ed253f54

    Day 45: Valentine’s Day Nail Art

    844e8b8b914e752b3665969700e773cd

    Trend Watch: Hearts

    d8527d5285695f5dc98a1e37d2e77a9c

    These Markets Are Predicted to See the Biggest Increase in Homes for Sale

    the best tubing mascaras for longer lashes that w 3 6927 1675459057 0 dblbig

    The Best Tubing Mascaras For Longer Lashes That Won’t Smudge

    ofs 274505836 qw

    Firefighters busy with three early morning fires in freezing conditions

    Trending Tags

    • Golden Globes
    • Mr. Robot
    • MotoGP 2017
    • Climate Change
    • Flat Earth
    • food
    • Fashion
    • Diet and Weight Loss
    • Mindfulness
    • Relationships
  • Entertainment
    • All
    • Gaming
    • Music
    • Sports
    4cbc690963de7206c19c13.58600246

    Kit Harington and Rose Leslie Are Expecting Their Second Child

    usatsi 13921959

    Conor McGregor, Michael Chandler to star in ‘The Ultimate Fighter’

    KitHarington BL 2x1 230204 04d0de

    Kit Harington and Rose Leslie expecting baby No. 2

    lebron tracker

    The King’s Quest: When will LeBron pass Kareem?

    derrick lewis presser

    UFC Fight Night predictions — Serghei Spivac vs. Derrick Lewis: Fight card, odds, start time, live stream

    kg1 3801

    The Times’ top 25 preseason baseball rankings

    Armie Hammer Says ‘I Was an Asshole’ But I Didn’t Assault Women

    usatsi 19791520 2

    College basketball picks, schedule: Predictions for Kansas vs. Iowa State and more Top 25 games Saturday

    EOTFP139143rv2a

    The best movies new to streaming on Netflix, HBO Max, Prime Video, and Hulu (February 2023)

    • Celebrities
    • Gaming
    • Movie
    • Music
    • Television
  • Sports
  • Business
    • Market
    • Media
    • Perspectives
    • Success
    • Tech
    • Videos
  • Travel
    • Destinations
    • Food & Drinks
    • Stay
  • Style
    • Architecture
    • Arts
    • Beauty
    • Design
    • Luxury
  • Tech
    3f9c7550 a484 11ed bcff e9bd33adf93e

    Pakistan blocks Wikipedia over ‘sacrilegious’ content | Engadget

    4298880 original 1

    Apple has finally realized Sir Jony Ive is literally irreplaceable

    manything 2

    Turn Your Old Phone Into a Free Home Security Camera. Here’s How

    63dc365ce33c4000193ac3e5?width=1200&format=jpeg

    Confessions of 20-somethings who live at home and splash out on cars, designer handbags, and nightclubs instead

    ClimateDesk Saffron Science GettyImages 1244511640

    The Climate Crisis Is Threatening Spain’s Saffron Crop

    gettyimages 1408934219 1

    Ditch Diet Culture and Practice Mindful Eating Instead

    Trending Tags

    • Sillicon Valley
    • Climate Change
    • Election Results
    • Flat Earth
    • Golden Globes
    • MotoGP 2017
    • Mr. Robot
    • AI World
    • Future
    • Gadget
    • Innovate
    • Innovative Cities
  • World
    • Africa
    • China
    • Asia
    • Australia
    • Europe
    • India
    • Middle East
    • United Kingdom
  • Politics
  • Lifestyle
    • All
    • Diet and Weight Loss
    • Fashion
    • Health
    • Relationships
    586ea6dd9da96b2ac1f8896ac7d3c7ce

    Day 37: Black Heart Nail Art

    winning88 x400 thumb

    acemanpicks

    download

    Our Favorite Fleece, the Patagonia Retro X, Is a Rare 40% Off

    VRDREQFEGZHK7G7TIED5EIGJD4

    The heated rhetoric over the migrant standoff in midtown Manhattan obscured a stark reality

    bbafbdd8dd79e637a194416b53273f10

    Simple Valentine’s

    34a9064fe6a427c632c4a678ed253f54

    Day 45: Valentine’s Day Nail Art

    844e8b8b914e752b3665969700e773cd

    Trend Watch: Hearts

    d8527d5285695f5dc98a1e37d2e77a9c

    These Markets Are Predicted to See the Biggest Increase in Homes for Sale

    the best tubing mascaras for longer lashes that w 3 6927 1675459057 0 dblbig

    The Best Tubing Mascaras For Longer Lashes That Won’t Smudge

    ofs 274505836 qw

    Firefighters busy with three early morning fires in freezing conditions

    Trending Tags

    • Golden Globes
    • Mr. Robot
    • MotoGP 2017
    • Climate Change
    • Flat Earth
    • food
    • Fashion
    • Diet and Weight Loss
    • Mindfulness
    • Relationships
  • Entertainment
    • All
    • Gaming
    • Music
    • Sports
    4cbc690963de7206c19c13.58600246

    Kit Harington and Rose Leslie Are Expecting Their Second Child

    usatsi 13921959

    Conor McGregor, Michael Chandler to star in ‘The Ultimate Fighter’

    KitHarington BL 2x1 230204 04d0de

    Kit Harington and Rose Leslie expecting baby No. 2

    lebron tracker

    The King’s Quest: When will LeBron pass Kareem?

    derrick lewis presser

    UFC Fight Night predictions — Serghei Spivac vs. Derrick Lewis: Fight card, odds, start time, live stream

    kg1 3801

    The Times’ top 25 preseason baseball rankings

    Armie Hammer Says ‘I Was an Asshole’ But I Didn’t Assault Women

    usatsi 19791520 2

    College basketball picks, schedule: Predictions for Kansas vs. Iowa State and more Top 25 games Saturday

    EOTFP139143rv2a

    The best movies new to streaming on Netflix, HBO Max, Prime Video, and Hulu (February 2023)

    • Celebrities
    • Gaming
    • Movie
    • Music
    • Television
  • Sports
  • Business
    • Market
    • Media
    • Perspectives
    • Success
    • Tech
    • Videos
  • Travel
    • Destinations
    • Food & Drinks
    • Stay
  • Style
    • Architecture
    • Arts
    • Beauty
    • Design
    • Luxury
  • Tech
    3f9c7550 a484 11ed bcff e9bd33adf93e

    Pakistan blocks Wikipedia over ‘sacrilegious’ content | Engadget

    4298880 original 1

    Apple has finally realized Sir Jony Ive is literally irreplaceable

    manything 2

    Turn Your Old Phone Into a Free Home Security Camera. Here’s How

    63dc365ce33c4000193ac3e5?width=1200&format=jpeg

    Confessions of 20-somethings who live at home and splash out on cars, designer handbags, and nightclubs instead

    ClimateDesk Saffron Science GettyImages 1244511640

    The Climate Crisis Is Threatening Spain’s Saffron Crop

    gettyimages 1408934219 1

    Ditch Diet Culture and Practice Mindful Eating Instead

    Trending Tags

    • Sillicon Valley
    • Climate Change
    • Election Results
    • Flat Earth
    • Golden Globes
    • MotoGP 2017
    • Mr. Robot
    • AI World
    • Future
    • Gadget
    • Innovate
    • Innovative Cities
No Result
View All Result
Google Publishers
No Result
View All Result
Home Science

Play Infinite Versions of AI-Generated Pong on the Go

by Google Publishers
January 25, 2023
in Science
0
a pair of hands holding a small handheld with a screen mini joystick and two buttons
0
SHARES
0
VIEWS
Share on FacebookShare on TwitterShare on Tumblr

There is currently a lot of interest in AI tools designed to help programmers write software. GitHub’s Copilot and Amazon’s CodeWhisperer apply deep-learning techniques originally developed for generating natural-language text by adapting it to generate source code. The idea is that programmers can use these tools as a kind of auto-complete on steroids, using prompts to produce chunks of code that developers can integrate into their software.

Looking at these tools, I wondered: Could we take the next step and take the human programmer
out of the loop? Could a working program be written and deployed on demand with just the touch of a button?

In my day job, I write embedded software for microcontrollers, so I immediately thought of a self-contained handheld device as a demo platform. A screen and a few controls would allow the user to request and interact with simple AI-generated software. And so was born the idea of infinite
Pong.

I chose
Pong for a number of reasons. The gameplay is simple, famously explained on Atari’s original 1972 Pong arcade cabinet in a triumph of succinctness: “Avoid missing ball for high score.” An up button and a down button is all that’s needed to play. As with many classic Atari games created in the 1970s and 1980s, Pong can be written in a relatively few lines of code, and has been implemented as a programming exercise many, many times. This means that the source-code repositories ingested as training data for the AI tools are rich in Pong examples, increasing the likelihood of getting viable results.

I used a US $6
Raspberry Pi Pico W as the core of my handheld device—its built-in wireless allows direct connectivity to cloud-based AI tools. To this I mounted a $9 Pico LCD 1.14 display module. Its 240 x 135 color pixels is ample for Pong, and the module integrates two buttons and a two-axis micro joystick.

My choice of programming language for the Pico was
MicroPython, because it is what I normally use and because it is an interpreted- language code that can be run without the need of a PC-based compiler. The AI coding tool I used was the OpenAI Codex. The OpenAI Codex can be accessed via an API that responds to queries using the Web’s HTTP format, which are straightforward to construct and send using the urequests and ujson libraries available for MicroPython. Using the OpenAI Codex API is free during the current beta period, but registration is required and queries are limited to 20 per minute—still more than enough to accommodate even the most fanatical Pong jockey.

An LCD screen with a joystick on the left-hand side and two buttons on the right-hand side, a microcontroller, and a USB cable.
Only two hardware modules are needed–a Rasperry Pi Pico W [bottom left] that supplies the compute power and a plug-in board with a screen and simple controls [top left]. Nothing else is needed except a USB cable to supply power.James Provost

The next step was to create a container program. This program is responsible for detecting when a new version of Pong is requested via a button push and when it, sends a prompt to the OpenAI Codex, receives the results, and launches the game. The container program also sets up a hardware abstraction layer, which handles the physical connection between the Pico and the LCD/control module.

The most critical element of the whole project was creating the prompt that is transmitted to the OpenAI Codex every time we want it to spit out a new version of
Pong. The prompt is a chunk of plain text with the barest skeleton of source code—a few lines outlining a structure common to many video games, namely a list of libraries we’d like to use, and a call to process events (such as keypresses), a call to update the game state based on those events, and a call to display the updated state on the screen.

The code that comes back produces a workable Pong game about 80 percent of the time.

How to use those libraries and fill out the calls is up to the AI. The key to turning this generic structure into a
Pong game are the embedded comments—optional in source code written by humans, really useful in prompts. The comments describe the gameplay in plain English—for example, “The game includes the following classes…Ball: This class represents the ball. It has a position, a velocity, and a debug attributes [sic]. Pong: This class represents the game itself. It has two paddles and a ball. It knows how to check when the game is over.” (My container and prompt code are available on Hackaday.io) (Go to Hackaday.io to play an infinite number of Pong games with the Raspberry Pi Pico W; my container and prompt code are on the site.)

What comes back from the AI is about 300 lines of code. In my early attempts the code would fail to display the game because the version of the MicroPython
framebuffer library that works with my module is different from the framebuffer libraries the OpenAI Codex was trained on. The solution was to add the descriptions of the methods my library uses as prompt comments, for example: “def rectangle(self, x, y, w, h, c).” Another issue was that many of the training examples used global variables, whereas my initial prompt defined variables as attributes scoped to live inside individual classes, which is generally a better practice. I eventually had to give up, go with the flow, and declare my variables as global.

Nine example screenshots
The variations of Pong created by the OpenAI Codex vary widely in ball and paddle size and color and how scores are displayed. Sometimes the code results in an unplayable game, such as at the bottom right corner, where the player paddles have been placed on top of each other.James Provost

The code that comes back from my current prompt produces a workable
Pong game about 80 percent of the time. Sometimes the game doesn’t work at all, and sometimes it produces something that runs but isn’t quite Pong, such as when it allows the paddles to be moved left and right in addition to up and down. Sometimes it’s two human players, and other times you play against the machine. Since it is not specified in the prompt, Codex takes either of the two options. When you play against the machine, it’s always interesting to see how Codex has implemented that part of code logic.

So who is the author of this code? Certainly there are
legal disputes stemming from, for example, how this code should be licensed, as much of the training set is based on open-source software that imposes specific licensing conditions on code derived from it. But licenses and ownership are separate from authorship, and with regard to the latter I believe it belongs to the programmer who uses the AI tool and verifies the results, as would be the case if you created artwork with a painting program made by a company and used their brushes and filters.

As for my project, the next step is to look at more complex games. The 1986 arcade hit
Arkanoid on demand, anyone?

Tags: ai programmingAI ToolscodexcopilotOpenAIRaspberry Pi Pico Wtype:departments
Google Publishers

Google Publishers

Related Posts

Screenshot 20230204 091855 e1675521335644
Science

Boy, 16, charged with first-degree murder in St. Catharines killing

by Google Publishers
February 4, 2023

Article content A 16-year-old boy has been arrested and charged in the brutal killing of a 31-year-old man in St....

5280dea5
Science

The History of Electric Vehicles Is Older Than You Think

by Google Publishers
February 4, 2023

Darren Brode/Shutterstock.com The electric vehicle has been around for much longer than you may think. Though the concept of electric...

image 1

Take your Valentine out with two $100 Restaurant.com e-gift cards for just $20

February 4, 2023
Next Post
SEI 141666645

Skin patch makes ultrasound images of your heart as you move

Recommended

1501074453 2941

IndiGrid to acquire 100% stake in Khargone Transmission for Rs 1497 crore

2 weeks ago
driving and dementia roadmap

When should someone with dementia stop driving? This resource helps seniors decide | CBC News

2 days ago

Popular News

  • artworks 000211900021 37ewc8

    Aryan Khan & Naseebo Lal – Pyar Meri Zindagi – Medley 2017 – Latest Punjabi Songs

    0 shares
    Share 0 Tweet 0
  • Aisi Mulaqaat – Rahat Fateh Ali Khan

    0 shares
    Share 0 Tweet 0
  • Kity_Door_Samdroo_par_koi___New_tiktok_viral_song__Dil_Ronda_ay__tik_tok_trending_song__2022(128k).m

    0 shares
    Share 0 Tweet 0
  • Naam-E-Wafa Matlab K Liye

    0 shares
    Share 0 Tweet 0
  • Spooky Black – no medicine you know the cure (VAGUE003 remix) TikTok slowed version

    0 shares
    Share 0 Tweet 0

Connect with us

Facebook Twitter Youtube RSS

About Us

GOOGLE PUBLISHERS NETWORK is the largest local-to-national digital media organization in the country. Our national flagship brand, sits at the center of the NETWORK, surrounded by hundreds of local media properties reporting on the stories and cultural moments happening across America and in our communities.

Recent News

jyotiraditya scindia 1653641474 37873100

Number of airports in country to go up to over 200: Jyotiraditya Scindia

February 4, 2023
586ea6dd9da96b2ac1f8896ac7d3c7ce

Day 37: Black Heart Nail Art

February 4, 2023
1149417 pic

Preet Bal Shares Important Tips for Getting Started in the Modeling Industry

February 4, 2023

Site Links

  • About Us
  • Corrections & Clarifications
  • Ethical Principles
  • Privacy Policy
  • Terms & Conditions
  • Contact

© 2023 Google Publishers -

No Result
View All Result
  • World
    • Africa
    • China
    • Asia
    • Australia
    • Europe
    • India
    • Middle East
    • United Kingdom
  • Politics
  • Lifestyle
    • food
    • Fashion
    • Diet and Weight Loss
    • Mindfulness
    • Relationships
  • Entertainment
    • Celebrities
    • Gaming
    • Movie
    • Music
    • Television
  • Sports
  • Business
    • Market
    • Media
    • Perspectives
    • Success
    • Tech
    • Videos
  • Travel
    • Destinations
    • Food & Drinks
    • Stay
  • Style
    • Architecture
    • Arts
    • Beauty
    • Design
    • Luxury
  • Tech
    • AI World
    • Future
    • Gadget
    • Innovate
    • Innovative Cities

© 2023 Google Publishers -

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In