esolang

DDR

Brainfuck as a dance chart. Each line is one step, and the arrows in it are the command.

DoggyDogWhirl, 2019 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: 2

The idea

DoggyDogWhirl made DDR in 2019, after the Dance Dance Revolution games. In the game arrows scroll up the screen in four columns, left, down, up and right, and you step on the pad as they reach the guide arrows at the top. A DDR program looks like that chart. It starts with the guide line <v^>, and each line below it is one step of some of the four arrows.

Read the story

Four arrows make 16 steps. Eight of them are brainfuck's commands. The others print a cell as a number, keep one variable, write a byte straight into the program, define and call one function, and halt.

The machine

ArrowsDoes
> <Move right or left
^ vAdd 1 to the cell or take 1 away
v^Print the cell as a character
<vRead a character into the cell
< ^ v >Loop while the cell is not 0, as brainfuck's brackets do
^>Print the cell as a number
<v^ v^>Copy the cell to the variable; copy the variable to the cell
< >Store the next two lines in the cell as a byte
< ^>Start or end the function
<v >Call the function
<v^>Halt

A byte literal reads its two lines as bits, with <, v, ^ and > worth 8, 4, 2 and 1, and the first line is the high half. So v > and v^> are 0101 and 0111, which make 87. Those two lines are data and never run. An empty line is a step with no arrows and does nothing. Every character other than the arrows is a comment. Cells are bytes, and the end of the input reads as 0.

Example

The 2.

The 2. Two steps on up add 2, and ^> prints the cell as a number.

The cat, which is brainfuck's ,[.,] in arrows.

Expected: cat

The Hello, world! writes most letters as literals and prints each with v^. It keeps the l in the first cell and the o in the second, and on the way back it prints them again instead of writing them twice. The space is ^ over an empty line, 0010 and 0000, which is 32.

Expected: Hello, world!

Patterns it teaches

  • Camouflage: a program that reads as a chart of dance steps.
  • Encoding tricks: the same arrows are commands on most lines and the bits of a byte on the two lines after a literal.
  • Turing tarpit: all of brainfuck is in it.

Further

DDR builds on Brainfuck.

Brainfuck derivatives

Write your own in Run Convert a program from DDR

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run ddr -e '<v^>
  ^
  ^
  ^>'
shib manual ddr

Source

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

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

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