User:DoggyDogWhirl

From Esolang
Jump to navigation Jump to search

DoggyDogWhirl has been a user since July 7, 2019.

Languages

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 value 1, SOH

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 value 1, SOH

^.

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.

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 had'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.