GithubHelp home page GithubHelp logo

standardgalactic / bbcmicrobot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 8bitkick/bbcmicrobot

0.0 0.0 0.0 944 KB

Runs your tweet on an 8-bit computer emulator

License: GNU General Public License v3.0

Shell 1.75% JavaScript 77.07% Perl 21.19%

bbcmicrobot's Introduction

BBCMicroBot

Node.js CI

A twitter bot that runs mentions on a BBC Micro emulator and responds with a tweet of 3 second, 50fps video after 30 seconds of emulated execution time.

Using the bot

You can try the bot now live at https://twitter.com/bbcmicrobot

For help running code on the bot please see the User Guide.

Background

The @bbcmicrobot gained fans like comedian Dara ร“ Briain, science writer Ben Goldacre, and Raspberry Pi founder Eben Upton. The concept is simple - make a retrocomputer accessible over social media. The bot runs any tweet written in BBC BASIC (1982) a programming language developed by Sophie Wilson who later went on to create the ARM architecture.

The Twitter community rose to the challenge with some seriously creative and clever code within 280 character limit. Read more background on BBC Micro Bot here.

It started a Twitter code bot revolution! There's a guide to building emulators in the cloud in the Commodore 64 notes as well as full bot projects inspired by it including Auto Tweetcart for the pico8 and Kay Savetz's AppleIIbot, PC BASIC Bot and Atari8BitBot.

Contributing

Running your own bot instance

For development and testing you can run your own instance of the bot on a Linux machine. I've been running it on:

  • Arm-based AWS instances (Ubuntu)
  • Raspberry Pi 4 (Raspbian and Raspberry Pi OS)
  • Apple Mac OS X

Installation

  • Install Node.js v12.x
  • Install ffmpeg (e.g. sudo apt install ffmpeg)
  • Download or clone this BBCMicroBot repository and cd into the directory
  • npm install

Local testing

To run a set of test tweets defined in test.js and output the video or image capture to the ./tmp/ folder. For each test a checksum of the last frame of emulator video is compared against a known good value. To run the tests type:

npm test

You should see output like the following:

[14/06/2020 09:06:49 ] [LOG]    Cli0: Running BASE2048 from @<TEST SERVER>
[14/06/2020 09:06:49 ] [LOG]    Cli0: Base 2048 decode
[14/06/2020 09:06:49 ] [LOG]    Cli0: Loading OS from roms/os.rom
[14/06/2020 09:06:49 ] [LOG]    Cli0: Loading ROM from roms/BASIC.ROM
[14/06/2020 09:06:49 ] [LOG]    Cli0: Loading ROM from roms/b/DFS-0.9.rom
[14/06/2020 09:06:49 ] [LOG]    Cli0: Loading ROM from roms/gxr.rom
[14/06/2020 09:06:59 ] [LOG]    Cli0: JSbeeb DONE in 9.807s 
[14/06/2020 09:07:01 ] [LOG]    Cli0: JSbeeb captured 150 frames (1 unique)
[14/06/2020 09:07:01 ] [LOG]    Cli0: Ffmpeg DONE in 0.172s 
[14/06/2020 09:07:01 ] [LOG]    Cli0: checksum: 80f830477fc1632c3f8a65702825f33b3d6c069e
[14/06/2020 09:07:01 ] [LOG]    Cli0: BASE2048 TEST - OK

In the tmp folder you should also see the test output files.

Interactive testing

The try subcommand allows you to run a BASIC program from a file. If the bot would have posted a replied it instead runs xdg-open with the video or image output filename as an argument, which should open it in a suitable viewer:

node client try someprogram.bas

If you omit the filename, it defaults to reading from stdin which is handy for one-liners:

echo '0MO.4:REP.V.RND(2)*45+2:U.0'|node client try

Connecting to a Twitter account

To run the bot on a Twitter account you need to apply for a Twitter developer account, generate API keys for your bot application and put them into a .env file to be accessed by tweet.js.

You can then run the bot with

npm start

Please refer to the https://developer.twitter.com if you are unfamiliar with these processes.

Thanks

Thanks to Matt Godbolt for the JSBeeb emulator that made this project possible and to all the @bbcmicrobot users for their support - I hope this source code is interesting or useful.

bbcmicrobot's People

Contributors

8bitkick avatar mattgodbolt avatar ojwb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.