We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

3switchBF

From Esolang
Jump to navigation Jump to search

3switchBF is yet another brainfuck equivalent, in the form of a Turing tarpit, conceived then neglected by User:Bataais in August of 2013. Because of this, information beyond the general idea may not be accurate.

Instructions

Each BF command is represented with 3 switches: A, B, and C. Each switch can be toggled on or off. All 8 possibilities of the 3 switches represent the 8 BF commands. E is then used to run the switch configuration as a BF command.

A B C BF Equivalent
OFF OFF OFF >
OFF OFF ON <
OFF ON OFF +
OFF ON ON -
ON OFF OFF .
ON OFF ON ,
ON ON OFF [
ON ON ON ]
Instruction Action
A Toggles the A switch.
B Toggles the B switch.
C Toggles the C switch.
E Executes the BF instruction the switches represent.

Examples

Cat

ABEBEBCEBE

Translator to brainfuck

Written in Python.

def translate(code):
  d = "><+-.,[]" ; r = ""
  a = b = c = 0
  for cc in code:
    if cc == "A": a = 1 - a
    elif cc == "B": b = 1 - b
    elif cc == "C": c = 1 - c
    elif cc == "E": r += d[a & (b << 1) & (c << 2)]
  return r