User:DoggyDogWhirl

From Esolang
Jump to navigation Jump to search

DoggyDogWhirl has been a user since July 7, 2019.

Languages

Interpreters for these languages can be found here.

Works in progress

Nearly finished concept, interpreter in progress:

  • Arepo
  • Pytho
  • Hyla and Della

Unfinished concept:

Brainfuck derivatives

This is where I will put my brainfuck derivatives and equivalents

Here's one

Code is a string of 1s and 0s. Sets of three 1s and 0s correspond to brainfuck commands as they do in Unary. However, after an instruction, the next command is not the next set of three digits, but instead the set starting at the next digit. Thus, the first two digits of one command are the same as the last two of the previous command. This makes programming difficult, as about half of brainfuck derivatives do. In fact, it might not be Turing-complete.

1

Outputs the character with value 1, SOH (Start Of Heading)

0100

Equivalent to +.

Cat program

Might not be possible.

An attempt on a one-character cat program: 10100 Takes 1 character input, increments it, and then outputs it.

A close cat program: 010110100010111

Corresponding BF commands: +,-[,+.><+,-]

How to use: input a character, and then input your cat program input, with every character separated by another character. Example: Ta.b.c.

Compiler to brainfuck

Written in Python 3.

code="".join(i for i in input() if i in "01")
assert len(code)>=3, "Code cannot refer to any instruction"
print("".join(["<>+-.,[]"[int(code[i:i+3],2)] for i in range(len(code)-2)]))


Elevatorfuck

Instead of adding 1 and subtracting 1 (+ and -), cells can be set to go up, down, or to not move. (^,v and -). After each instruction, the value of each cell changes by 1 in the direction given to that cell. All cells are set to not move by default. Although setting a cell's direction to the direction it was already going is effectively a noop, there is a noop command: ~.

Note: When a ] loops back, the next instruction is the one after the matching [.

1

Outputs the character with value 1, SOH (Start Of Heading)

^.

After being assigned to move up, the cell immediately increments by 1 to the value 1.

Outputs the character "1"

^~~~~~~~-[>^<v-]>~.
Cat program

Identical to brainfuck.

,[.,]
Hello, world!
^~~~~-[>^>^>^<-<-<v-]>v>>~~~.<<[]>^>v~~~~~~~~.^~~~~~~~-..<->^~~.<.v>~~~-<~~~~~-.>.v~~~~~~~.^~~~.v~~~~~~.~~~~~~~.<^.
Interpreter

Written in Python 3. Code modified from https://github.com/pocmo/Python-Brainfuck/blob/master/brainfuck.py

code="""code goes here"""
import getch 
code="".join([i for i in code if i in "<>^v-.,[]~"])

temp_bracestack, bracemap = [], {}
for position, command in enumerate(code):
  if command == "[": temp_bracestack.append(position)
  if command == "]":
    assert len(temp_bracestack)!=0,"Brackets do not match"
    start = temp_bracestack.pop()
    bracemap[start] = position
    bracemap[position] = start
assert len(temp_bracestack)==0,"Brackets do not match"

cells, celldirs, codeptr, cellptr = [0], [0], 0, 0
while codeptr < len(code):
  command = code[codeptr]
  if command == ">": cellptr += 1
  if cellptr == len(cells): cells.append(0); celldirs.append(0)
  if command == "<": cellptr = 0 if cellptr <= 0 else cellptr - 1
  if command == "^": celldirs[cellptr] = 1
  if command == "v": celldirs[cellptr] = -1
  if command == "-": celldirs[cellptr] = 0
  if command == "[" and cells[cellptr] == 0: codeptr = bracemap[codeptr]
  if command == "]" and cells[cellptr] != 0: codeptr = bracemap[codeptr]
  if command == ".": print(chr(cells[cellptr]),end="")
  if command == ",": cells[cellptr] = ord(getch.getch())
  for i in range(len(cells)):
    cells[i]+=celldirs[i]
    if cells[i] == 256: cells[i] = 0
    if cells[i] == -1: cells[i] = 255
  codeptr += 1

I would like to see a visualization of this language (or somehow in a way to allow any tape-based language) in a way similar to this one of BF Joust.

I made a visualizer in Python, but it doesn't make animations.


TwoBrainsfuck

Instead of one tape, there are two tapes. The usual commands +-<>[]., act on the first tape, and the commands #=v^{}:; act on the second.

However, +- (and thus #=) do not add or subtract 1, but instead add or subtract the position of the other tape's pointer (0-indexed).

Of course, this idea in its entirety may have already been thought of and detailed, but I don't know how I would find it.

1

Outputs the character with value 1, SOH (Start Of Heading)

^+. or >#:

Since both tapes are identical, every program has a mirror program with its symbols switched which does exactly the same thing.

Outputs the character "1"

^^^^^^^+++++++.

>>>>>>>#######:

Cat Program

,[.,] or ;{:;}

Hello, world!
>>>>>>#<<<<<
{^^^^^^++>+++>+++>+>+<<<<vvvvvv=}
H  .
e  >^^^^^^^-.
l  >.
l  .
o  vvvv+.
'  >^++.
   >-.
w  <<++.
o  --.
r  v+.
l  --.
d  <vv-.
!  >>>+.
Interpreter

Written in Python 3. Code modified from https://github.com/pocmo/Python-Brainfuck/blob/master/brainfuck.py

code="""code goes here"""

import getch 
code="".join([i for i in code if i in "+-<>[].,#=v^{}:;"])

temp_bracestack, bracemap = [], {}
for position, command in enumerate(code):
  if command in "[{": temp_bracestack.append((position, command))
  if command in "]}":
    assert len(temp_bracestack)!=0,"Brackets do not match"
    start, matchingcommand = temp_bracestack.pop()
    assert (command == "]" and matchingcommand == "[") or (command == "}" and 
matchingcommand == "{"), "Matched two different types of bracket"
    bracemap[start] = position
    bracemap[position] = start
assert len(temp_bracestack)==0,"Brackets do not match"

cells, cells2, codeptr, cellptr, cellptr2 = [0], [0], 0, 0, 0
while codeptr < len(code):
  command = code[codeptr]
  if command == "+": cells[cellptr] += cellptr2
  if command == "-": cells[cellptr] -= cellptr2
  if command == ">": cellptr += 1
  if cellptr == len(cells): cells.append(0)
  if command == "<": cellptr = 0 if cellptr <= 0 else cellptr - 1
  if command == "[" and cells[cellptr] == 0: codeptr = bracemap[codeptr]
  if command == "]" and cells[cellptr] != 0: codeptr = bracemap[codeptr]
  if command == ".": print(chr(cells[cellptr]),end="")
  if command == ",": cells[cellptr] = ord(getch.getch())

  if command == "#": cells2[cellptr2] += cellptr
  if command == "=": cells2[cellptr2] -= cellptr
  if command == "^": cellptr2 += 1
  if cellptr2 == len(cells2): cells2.append(0)
  if command == "v": cellptr2 = 0 if cellptr2 <= 0 else cellptr2 - 1
  if command == "{" and cells2[cellptr2] == 0: codeptr = bracemap[codeptr]
  if command == "}" and cells2[cellptr2] != 0: codeptr = bracemap[codeptr]
  if command == "!": print(chr(cells2[cellptr2]),end="")
  if command == "?": cells2[cellptr2] = ord(getch.getch())

  cells[cellptr] %= 256
  cells2[cellptr2] %= 256
  codeptr += 1


Game

I had started to make a text adventure game which mostly would revolve around solving puzzles with different esolangs. You would start with deadfish, and then from there... I hadn't got that far yet.

One idea I had was visualizations of languages, i.e. logos and item-esque descriptions, but even the most popular of esolangs do not have logos. For example, here is my design for deadfish:

+-------------+
|       _____ |
|      /     ||
|     /  X   /|
| ___/      / |
|\    _____/  |
| \  /        |
|  \/         |
+-------------+
deadfish: They say it's like eating dead fish.