Skip to content

Commit

Permalink
Merge branch 'mastodon' of github.com:8bitkick/BBCMicroBot into mastodon
Browse files Browse the repository at this point in the history
  • Loading branch information
8bitkick committed Jan 13, 2024
2 parents 5203588 + 26ab882 commit 33a3e97
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions docs/user guide.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# BBC Micro Bot User Guide

This guide will outline how BBC Micro Bot works on Twitter and tricks to reduce the size of your code to fit in a tweet with the [Owlet Editor](https://bbcmic.ro).
This guide will outline how BBC Micro Bot works on Mastodon and tricks to reduce the size of your code to fit in a toot with the [Owlet Editor](https://bbcmic.ro).

## Prerequisites

Before reading below check this awesome [interactive BBC BASIC tutorial](https://www.bbcmicrobot.com/learn/index.html) first if you aren’t familiar or want a refresher. The guide below is more about using the bot and how to minify code rather than covering the BBC BASIC language.

## How to run your code

When you include [@bbcmicrobot](https://twitter.com/bbcmicrobot) in a tweet the bot will run your tweet as code on a BBC Micro emulator. Your code must fit within a single tweet, limiting it to 280 characters.
When you include [#bbcmicrobot](https://mastodon.me.uk/@bbcmicrobot) in a toot the bot will run your toot as code on a BBC Micro emulator. Your code must fit within a single toot, limited it to 500 characters by its home instance.

### Default

Normally the bot runs your code for 30 seconds, and then takes 3 second video clip that it posts to Twitter. If that last 3 seconds is a static image the bot will reply with a PNG image instead.

### Emoji commands

You can add an emoji to the end of your tweet to send a command to the bot. These are not included in the program sent to the BBC Micro emulator, and should not be in your code in Owlet. Because the [emulator is very fast](https://github.com/scarybeasts/beebjit) a 3 hour emulation only takes a few seconds. Although the emulation is fast the video capture at the end is real-time - the 🎬 is the same as leaving a real BBC Micro running for 3 hours and then afterwards taking a look at the screen for 3 seconds.
You can add an emoji to the end of your toot to send a command to the bot. These are not included in the program sent to the BBC Micro emulator, and should not be in your code in Owlet. Because the [emulator is very fast](https://github.com/scarybeasts/beebjit) a 3 hour emulation only takes a few seconds. Although the emulation is fast the video capture at the end is real-time - the 🎬 is the same as leaving a real BBC Micro running for 3 hours and then afterwards taking a look at the screen for 3 seconds.


Bot execution modes
Expand All @@ -37,25 +37,19 @@ We use the beebjit `-fast` parameter to achive very fast emulation in the accele
If your code waits for an external timer based event like VSYNC the video will appear to freeze. It's recommended to use `FOR ... NEXT` loop based delays in code you intend to run with 🎬 mode for that reason. The emulator takes a screenshot every 40,000 emulated 6502 cycles (which is the same period as VSYNC) and so resulting animation will still look [pretty much the same on a real machine](https://twitter.com/bbcmicrobot/status/1356755101587697669?s=20).


### Ignored tweets

The bot will reply to any mention that starts with a line number, contains an `=` sign or contains special characters. This needs improving.

## Etiquette

If you copy or modify someone's code you should either reply to the original tweet so people can see the thread, or acknowledge the author in your tweet. When you tweet at the bot your code is public. You might find that other users are inspired to help reduce the size of your code, improve the design or remix it - you should take this as a compliment!
If you copy or modify someone's code you should either reply to the original toot so people can see the thread, or acknowledge the author in your toot. When you toot at the bot your code is public. You might find that other users are inspired to help reduce the size of your code, improve the design or remix it - you should take this as a compliment!

BBC Micro Bot is a place to write fun code and help each other out doing it. Tweets contains any bad words will be ignored and the user account blocked. This is automatic and on quite a strict filter.
BBC Micro Bot is a place to write fun code and help each other out doing it. Toots contains any bad words will be ignored and the user account blocked. This is automatic and on quite a strict filter.

# Writing code in a tweet
# Writing code in a toot

The [Owlet Editor](https://bbcmic.ro) is designed specifically for creative coding with BBC Micro Bot. From within the editor you can hit the `Share` button to automatically be taken to your Twitter account and tweet the code.
The [Owlet Editor](https://bbcmic.ro) is designed specifically for creative coding with BBC Micro Bot.

## Reducing code size

One of the fun and challenging aspects of the bot is you need to squeeze your code into a tweet - code golf! Techniques to do this have evolved over time, many pioneered by [Rheolism](https://www.twitter.com/rheolism). Here we outline some fundamental approaches, this is by no means comprehensive.

One tip for starters - `@bbcmicrobot` is a long name. If you reply to a tweet from @bbcmicrobot you don't need to explicitly include the `@bbcmicrobot` mention in the code for the bot to see and run your tweet. This will save you 13 characters.
One of the fun and challenging aspects of the bot is you need to squeeze your code down in size - code golf! Techniques to do this have evolved over time, many pioneered by [Rheolism](https://www.twitter.com/rheolism). Here we outline some fundamental approaches, this is by no means comprehensive.

```
10 PRINT "HELLO WORLD"
Expand All @@ -65,7 +59,7 @@ One tip for starters - `@bbcmicrobot` is a long name. If you reply to a tweet fr

### Removing line numbers and spaces

You do not need line numbers in your tweeted code. The numbers are automatically added in increments of 10 by the bot. As a guide Owlet will show you the line numbers in the gutter of the editor if you omit them from your code. Spaces are usually removable, but are required in some cases where a variable name is directly next to a BASIC keyword.
You do not need line numbers in your code. The numbers are automatically added in increments of 10 by the bot. As a guide Owlet will show you the line numbers in the gutter of the editor if you omit them from your code. Spaces are usually removable, but are required in some cases where a variable name is directly next to a BASIC keyword.

```
PRINT"HELLO WORLD"
Expand All @@ -83,7 +77,7 @@ G.10

### BBC BASIC byte tokens

As with the original implementation each BBC BASIC keyword is represented in memory as a single byte. We can use these byte tokens directly in tweets to save characters. You can quickly do the conversion in the [Owlet Editor](https://bbcmic.ro) using the `Shrink` button (so you don't need to worry about learning the [values of byte tokens](http://www.benryves.com/bin/bbcbasic/manual/Appendix_Tokeniser.htm)). The `PRINT` keyword shrinks to byte token 0xF1. This is represented in a tweet as Unicode U+00F1 which is `ñ`.
As with the original implementation each BBC BASIC keyword is represented in memory as a single byte. We can use these byte tokens directly in toots to save characters. You can quickly do the conversion in the [Owlet Editor](https://bbcmic.ro) using the `Shrink` button (so you don't need to worry about learning the [values of byte tokens](http://www.benryves.com/bin/bbcbasic/manual/Appendix_Tokeniser.htm)). The `PRINT` keyword shrinks to byte token 0xF1. This is represented in a toot as Unicode U+00F1 which is `ñ`.

```
ñ"HELLO WORLD"
Expand All @@ -95,7 +89,7 @@ Note that some byte values must be ORed with 0x100 in order to map to a valid Un

### base2048 encoding [deprecated for Mastodon due to larger post length]

[Base2048](https://github.com/qntm/base2048) is a Unicode encoding optimized for transmitting binary data through Twitter. Using base2048 gives you an extra 100 characters of BBC BASIC code in a tweet, bringing it to ~384 characters in total. However our Hello World tweet will no longer be human readable:
[Base2048](https://github.com/qntm/base2048) is a Unicode encoding optimized for transmitting binary data through Twitter. Using base2048 gives you an extra 100 characters of BBC BASIC code in a tweet, bringing it to ~384 characters in total. However our Hello World tweet will no longer be human readable. For this reason we no longer support base2048 on the Mastodon bot.

```
༣Ȝǁঐ౭चؼ๗ԪʢࠁನȤ3
Expand Down

0 comments on commit 33a3e97

Please sign in to comment.