esolang

Braisnack

Brainfuck where every cell holds a snack, and printing a cell says which one.

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

Tested with 4 known programs · Test method

Run it

Expected: Pickle Pickle Dorito Tortilla chip Applesauce

The idea

Braisnack is brainfuck on the SNACBIT, a unit with eleven states that are all snacks. Every cell starts as a peanut butter cracker. Plus and minus walk through the list of snacks and wrap around, and a loop runs until the cell is a peanut butter cracker again. Output is the snack's name, and input is a name typed in.

Read the story

The specification calls its Hello World picklepickledoritotortilla chipapplesauce.

The machine

CommandDoes
> <Move to the next or the previous cell
+ -Next or previous snack, wrapping around
[ ]Skip past ] if the cell is a peanut butter cracker; go back to [ if it is not
.Print the snack's name on a line of its own
,Read a line and store the snack it names

The snacks in order are Peanut butter cracker, Cosmic brownie, Cheezit, Cheeto, Dorito, Tortilla chip, Cheese cracker, Potato chip, Applesauce, Peanut butter cup and Pickle. A name is matched without its spaces and in any case. The specification's Common Lisp interpreter also prompts with >> before a read; this implementation does not.

Example

One step back from the peanut butter cracker is the pickle.

One step back from the peanut butter cracker is the pickle.

Expected: Potato chip

Printing every state goes once around the circle, until the cell is a peanut butter cracker again.

Expected: Peanut butter cracker Cosmic brownie Cheezit Cheeto Dorito Tortilla chip Cheese cracker Potato chip Applesauce Peanut butter cup Pickle

Patterns it teaches

  • Turing tarpit: brainfuck's eight commands, with cells of eleven states.

Further

Braisnack builds on Brainfuck.

Brainfuck derivatives

Write your own in Run Convert a program from Braisnack

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: braisnack.

Command line

shib run braisnack -e ',.' --input 'potato chip'
shib manual braisnack

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/braisnack.js

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

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