esolang

'#b'

Brainfuck where only the parity of each character counts, so any text with the right rhythm runs.

None1, 2023 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 8 known programs · Test method

Run it

Expected: 0

The idea

None1 made #b in 2023. The name is two music signs, sharp and flat. # has an odd character code and b an even one, and that is the whole trick. Every character with an odd code counts as #, every even one as b. Three marks make one of brainfuck's eight commands, because 2 to the third is 8.

Read the story

So the same program can be written in # and b, or in random letters. The specification gives each example both ways, and both ways print the same.

The machine

MarksBrainfuck
bbb+
bb#>
b#b,
#bb[
b##]
#b#.
##b<
###-

Line feeds do not count. Cells are bytes that wrap, the tape has no end either way, and , at the end of input stores 0. The specification leaves those choices open.

Example

The cat is bbb#bbb#b#b#b## in marks and dXzyHhtQVCfMFAS in letters, both +[,.].

The cat is bbb#bbb#b#b#b## in marks and dXzyHhtQVCfMFAS in letters, both +[,.]. At the end of input it reads a 0, prints it and stops, so the last byte out is a 0.

The truth machine, first in marks and then in letters.

Expected: 0

Reverse one line of input, in letters.

Expected: desserts

Patterns it teaches

  • Camouflage: the program can hide in any text with the right parity.
  • Every text runs: each character is a mark, so only bracket balance can go wrong.
  • Encoding tricks: three bits per command, one bit per character.

Further

'#b' builds on Brainfuck.

Brainfuck equivalents

Cell-based

Write your own in Run Convert a program from '#b'

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: sharp-flat.

Command line

shib run sharp-flat -e 'bbb#bbb#b#b#b##' --input 'abc'
shib manual sharp-flat

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/sharp-flat.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org