Article 51681 Show The World You Can Write A Cool Program Inside A Single Tweet

Show The World You Can Write A Cool Program Inside A Single Tweet

by
Stephen Cass
from IEEE Spectrum on (#51681)

Want to give your coding chops a public workout? Then prove what you can do with the BBC Micro Bot. Billed as the world's first "8-bit cloud," and launched on 11 February, the BBC Micro Bot is a Twitter account that waits for people to tweet at it. Then the bot takes the tweet, runs it through an emulator of the classic 1980s BBC Microcomputer running Basic, and tweets back an animated gif of three seconds of the emulator's output. It might sound like that couldn't amount to much, but folks have been using it to demonstrate some amazing feats of programming, most notably including Ebon Upton, creator of the Raspberry Pi.

"The Bot's [output] posts received over 10 million impressions in the first few weeks, and it's running around 1000 Basic programs per week," said the account's creator, Dominic Pajak, in an email interview with IEEE Spectrum.

Upton, for example, performed a coding tour de force with an implementation of Conway's Game of Life, complete with a so-called Gosper Gun, all running fast enough to see the Gun spit out glider patterns in real time. (For those not familiar with Conway's Game of Life, it's a set of simple rules for cellular automata that exist on a flat grid. Cells are turned on and off based on the state of neighboring cells according to those rules. Particularly interesting patterns that emerge from the rules have been given all sorts of names.)

pic.twitter.com/geNARZAAwU

- BBC Micro bot (@bbcmicrobot) February 21, 2020

Upton did this by writing 150 bytes of data and machine code for the BBC Microcomputer's original CPU, the 6502, which the emulator behind the BBC Micro Bot is comprehensive enough to handle. He then converted this binary data into tweetable text using Base64 encoding, and wrapped that data with a small Basic program that decoded it and launched the machine code. Since then, people have been using even more elaborate encoding schemes to pack even more in.

Pajak, who is the vice-president of business development for Arduino, created the BBC Micro Bot because he is a self-described fan of computer history and Twitter. "It struck me that I could combine the two." He chose the BBC Micro as his target because "growing up in the United Kingdom during the 1980s, I learnt to program the BBC Micro at school. I certainly owe my career to that early start." Pajak adds that, "There are technical reasons too. BBC Basic was largely developed by Sophie Wilson (who went on to create the Arm architecture) and was by far the best Basic implementation of the era, with some very nice features allowing for 'minified' code."

Pajak explains that the bot is written in Javascript for the Node.js runtime environment, and acts as a front end to Matt Godbolt's JSbeeb emulation of the BBC Micro. When the bot spots a tweet intended for it, "it does a little bit of filtering and then injects the text into the emulated BBC Micro's keyboard buffer. The bot uses ffmpeg to create a 3-second video after 30 seconds of emulation time." Originally the bot was running on a Raspberry Pi 4, but he's since moved it to Amazon Web Services.

Pajak has been pleasantly surprised by the response: "The fact that BBC BASIC is being used for the first time by people across the world via Twitter is definitely a surprise, and its great to see people discovering and having fun with it. There were quite a lot of slogans and memes being generated by users in Latin America recently. This I didn't foresee for sure."

The level of sophistication of the programs has risen sharply, from simple Basic programs through Upton's Game of Life implementation and beyond. "The barriers keep getting pushed. Every now and then I have to do a double take: Can this really be done with 280 characters of code?" Pajak points to Katie Anderson's tongue-in-cheek encoding of the Windows 3.1 logo, and the replication of a classic bouncing ball demo by Paul Malin-game giant Activision's technical director-which, Pajak says, uses "a special encoding to squeeze 361 ASCII characters of code into a 280 Unicode character tweet."

pic.twitter.com/c9g3fIT41N

- BBC Micro bot (@bbcmicrobot) February 21, 2020

pic.twitter.com/ThOhzgdFGX

- BBC Micro bot (@bbcmicrobot) March 18, 2020

If you're interested in trying to write a program for the Bot, there are a host of books and other coding advice about the BBC Micro available online, with Pajak hosting a starting set of pointers and a text encoder on his website, www.dompajak.com.

As for the future and other computers, Pajak says he given some tips to people who want to build similar bots for the Apple II and Commodore computers. For himself, he's contemplating finding a way to execute the tweets on a physical BBC Micro, saying "I already have my BBC Micro connected to the Internet using an Arduino MKR1010..."

6YCI1SORfEs
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/IeeeSpectrum
Feed Title IEEE Spectrum
Feed Link https://spectrum.ieee.org/
Reply 0 comments