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.

Goldfish++

From Esolang
Jump to navigation Jump to search
Goldfish++
Designed by User:acidbytes.h
Appeared in 2026
Computational class Turing-complete
Reference implementation Implemented
Influenced by Deadfish, Deadfish~, brainfuck, HQ9+
File extension(s) .gdfp

 

Goldfish++ is a Turing-complete version of Deadfish. The language uses the name Goldfish++ to avoid confusion from Goldfish. Mostly.

Goldfish++ is what would happen if Deadfish, HQ9+ and brainfuck all got into a trench coat. Wonder how programming languages can even move, let alone get into a trench coat, however.

Command table

This table lists all the commands in Goldfish++ :

Category Command Description
Deadfish i or + Increments the accumulator.
Deadfish f or # Increments the accumulator by 5.
Deadfish I or | Increments the accumulator by 10.
Deadfish F or : Increments the accumulator by 25.
Deadfish d or - Decrements the accumulator.
Deadfish b or ~ Decrements the accumulator by 5.
Deadfish D or . Decrements the accumulator by 10.
Deadfish B or ; Decrements the accumulator by 25.
Deadfish s or * Squares the accumulator.
Deadfish h Halts.
Math c Cubes the accumulator. If you like making it a lot more obfuscated to say, you can say "the accumulator multiplied by the accumulator multiplied by the accumulator".
Math / Divide the accumulator's value by itself. So... just a way of setting a non-zero number to 1 and doing nothing with a 0.
Math ^ or % A fancier way of setting the accumulator to 0.
Accumulator Macro 0–8 Sets the accumulator's value to any number between 0-8 and you can choose the number.
Accumulator Macro n Sets the accumulator's value to 9.
Accumulator Macro "Infinite" Value You can set the accumulator to any value BUT once you've used it once, it no longer works. But just make sure your value doesn't start with 9. Or until int overflow.
Accumulator Macro r Sets the accumulator's value to any number between 1-100 and you CANNOT choose the number.
Accumulator Macro R Sets the accumulator's value to any number between 1-1000 and you CANNOT choose the number.
Accumulator Macro å Flips the accumulator's value. For example, it turns -74 into 74 and vice versa.
Storage l / v Saves the accumulator to Storage 1 (l) / Loads Storage 1 into the accumulator (v).
Storage L / V Saves the accumulator to Storage 2 (L) / Loads Storage 2 into the accumulator (V).
Storage Y / w Saves the accumulator to Storage 3 (Y) / Loads Storage 3 into the accumulator (w).
Storage X / y Saves the accumulator to Storage 4 (X) / Loads Storage 4 into the accumulator (y).
Storage W / x Saves the accumulator to Storage 5 (W) / Loads Storage 5 into the accumulator (x).
Brainfuck > Move the tape pointer to the right by 1 cell.
Brainfuck < Move the tape pointer to the left by 1 cell.
Brainfuck @ Write the accumulator's value into the selected tape cell.
Brainfuck $ Load current tape cell value into the accumulator (defaults to 0).
Control [ ... ] A while loop. Couldn't have been taken from brainfuck!
Control ( ... ) Repeats 5 times.
Control { ... } Repeats 10 times (let's just say that Deadfish~ may not be feeling so great today).
Control æ ... ø Repeats between 1 and 100 times (I just HAD to use letters for this).
Control Æ ... Ø Repeats between 1 and 1000 times (SAME AS ABOVE).
Timers z Wait 1 millisecond.
Timers Z Wait 1 second.
Comments /- Just your average comment (which was inspired by functional programming). Note that if you suddenly feel a strange urge to divide and then decrement, you'll have to write /d.
I/O o Output the accumulator's value as a number.
I/O a or & Output the accumulator's value as a Unicode character.
I/O A or ? Output the accumulator's value as a Unicode character. BUT it's followed by a newline.
I/O , Reads any number.
I/O g Reads any Unicode character. All 1,000,000+ of them.
HQ9+ H Prints Hello, world!
HQ9+ Q Prints the program's own source code (Quine).
HQ9+ 9 Prints the, and I quote, "complete" lyrics to 99 Bottles of Beer.
Extras Å Prints "Hello, world!" in Norwegian, which is "Hallo, verden!"

Examples

Hello World!

H

Quine

Q

99 Bottles Of Beer

9

Cat

g[ag]

In the world of programming, this can also be considered a Text interpreter.

Caesar cipher

This is like the cat program, but it takes the input and changes the ASCII value by 1 :

g[iag]

Variants

g[Iag] /- ASCII value plus 10.
g[dag] /- ASCII value minus 1.
g[iiiiiag] /- ASCII value plus 5.

ROT13

g[Iiiiag] /- ROT13.

Truth-machine

,o[o]

1-2-1-2-1

This program goes to 1, then 2, and does that till the heat death of the universe.

7sA
[
    iA
    7sA
]

Addition calculator

,l,L[vilVdL]vo

Fish

Prints the Fish logo : ><>.

8sdda
dda
iiA

Goldfish

5siia
0IsDia
7sIdda
7siia
0IsIda

8sdda
dda
iiA

5siia
0IsDia
7sda
0IsIda

A Nope. interpreter

78aIFddaiaDda7sdddA

A Charator interpreter

æRaø

Hello World, properly

8siiiiiiiia
0Isia
Iddda
a
iiia
6sdddda
0Idsiiiiiia
0IisDa
iiia
Diiiia
0Isa
6sdddA

ASCII table

d{{ia}}{ia}{ia}(ia)iaiaiA

1 to 10

{io}

1 to 100

{{io}}

Alphabet

8s{ia}{ia}iaiaiaiaiaiA

Alphabet, but lowercase

Isdddd{ia}{ia}iaiaiaiaiaiA

Norwegian alphabet

8s{ia}{ia}iaiaiaiaiaia{I}IddaIIddaDDiA

Binary alphabet

7sdaiA

Base-64 alphabet

8s{ia}{ia}iaiaiaiaiaiaIdddd{ia}{ia}iaiaiaiaiaia7sdd{ia}DddddaiiiiA

Null program


Implementation

import std;
import core.thread;
void main(string[] args) {
    dstring source = readText(args.length > 1 ? args[1] : "main.gdfp").to!dstring;
    int accumulator = 0;
    int storage = 0;
    int storage2 = 0;
    int storage3 = 0;
    int storage4 = 0;
    int storage5 = 0;
    bool usedBigNum = false;
    int[long] tape;
    long ptr = 0;
    size_t[size_t] jumpTable;
    size_t[] stack;
    int[size_t] rep;
    for (size_t i = 0; i < source.length; i++) {
        if (source[i] == '/' && i + 1 < source.length && source[i + 1] == '-') {
            while (i < source.length && source[i] != '\n') {
                i++;
            }
            continue;
        }
        if (source[i] == '[' || source[i] == '{' || source[i] == '(' || source[i] == 'æ' || source[i] == 'Æ') {
            stack ~= i;
        } else if (source[i] == ']' || source[i] == '}' || source[i] == ')' || source[i] == 'ø' || source[i] == 'Ø') {
            if (stack.length == 0) {
                writeln("oh crap! some symbol is breaking the law and it's ", i);
                return;
            }
            size_t openingIndex = stack[$ - 1];
            stack.length--;
            jumpTable[openingIndex] = i;
            jumpTable[i] = openingIndex;
        }
    }
    for (size_t pc = 0; pc < source.length; pc++) {
        dchar c = source[pc];
            if (c == '/' && pc + 1 < source.length && source[pc + 1] == '-') {
            while (pc < source.length && source[pc] != '\n') {
                pc++;
            }
            continue;
        }
        if (c == 'i' || c == '+') accumulator += 1;
        else if (c == 'f' || c == '#') accumulator += 5;
        else if (c == 'I' || c == '|') accumulator += 10;
        else if (c == 'F' || c == ':') accumulator += 25;
        else if (c == 'd' || c == '-') accumulator -= 1;
        else if (c == 'b' || c == '~') accumulator -= 5;
        else if (c == 'D' || c == '.') accumulator -= 10;
        else if (c == 'B' || c == ';') accumulator -= 25;
        else if (c == 's') accumulator *= accumulator;
        else if (c == 'o') writeln(accumulator);
        else if (c == 'h') break;
        else if (c == 'å') accumulator = -accumulator;
        else if (c == 'Å') writeln("Hallo, verden!");
        else if (c == 'n') accumulator = 9;
        else if (c == 'H') writeln("Hello, world!");
        else if (c == 'Q') writeln(source);
        else if (c == '9') {
            for (int i = 99; i > 0; i--) {
                writefln("%d bottles of beer on the wall, %d bottles of beer.", i, i);
                writefln("Take one down and pass it around, %d bottles of beer on the wall.", i - 1);
                }
            }
        else if (c >= '0' && c <= '8' && pc + 1 < source.length && source[pc + 1] >= '0' && source[pc + 1] <= '9') {
            long val = 0;
            while (pc < source.length && source[pc] >= '0' && source[pc] <= '9') {
                val = val * 10 + (source[pc] - '0');
                pc++;
            }
            pc--;
            if (!usedBigNum) {
                accumulator = cast(int)val;
                usedBigNum = true;
            }
        }
        else if (c >= '0' && c <= '8') accumulator = c - '0';
        else if (c == '*') accumulator *= accumulator;
        else if (c == '/') {
        if (accumulator != 0) accumulator /= accumulator;
        }
        else if (c == '%') {
        if (accumulator != 0) accumulator %= accumulator;
        }
        else if (c == '^') accumulator ^= accumulator;
        else if (c == 'c') accumulator = accumulator * accumulator * accumulator;
        else if (c == 'r') accumulator = uniform(1, 101);
        else if (c == 'R') accumulator = uniform(1, 1001);
        else if (c == 'a' || c == '&') write(cast(dchar)accumulator);
        else if (c == 'A' || c == '?') writeln(cast(dchar)accumulator);
        else if (c == 'v') accumulator = storage;
        else if (c == 'l') storage = accumulator;
        else if (c == 'V') accumulator = storage2;
        else if (c == 'L') storage2 = accumulator;
        else if (c == 'w') accumulator = storage3;
        else if (c == 'Y') storage3 = accumulator;
        else if (c == 'y') accumulator = storage4;
        else if (c == 'X') storage4 = accumulator;
        else if (c == 'x') accumulator = storage5;
        else if (c == 'W') storage5 = accumulator;
        else if (c == 'z') Thread.sleep(1.seconds / 1000);
        else if (c == 'Z') Thread.sleep(1.seconds);
        else if (c == '>') ptr++;
        else if (c == '<') ptr--;
        else if (c == '@') tape[ptr] = accumulator;
        else if (c == '$') accumulator = tape.get(ptr, 0);
        else if (c == '[') {
            if (accumulator == 0) {
                pc = jumpTable[pc];
            }
        }
        else if (c == ']') {
            if (accumulator != 0) {
                pc = jumpTable[pc];
            }
        }
        else if (c == ',') {
            if (readf(" %d", &accumulator) != 1) {
                accumulator = 0;
                }
            }
        else if (c == 'g') {
            try {
            dchar ch;
            if (readf("%s", &ch) == 1) accumulator = cast(int)ch;
            else accumulator = 0;
            }
            catch (Exception) {
                accumulator = 0;
            }
        }
        else if (c == '{') rep[pc] = 10;
        else if (c == '}') {
            if (--rep[jumpTable[pc]] > 0) pc = jumpTable[pc];
            }
        else if (c == '(') rep[pc] = 5;
        else if (c == ')') {
            if (--rep[jumpTable[pc]] > 0) pc = jumpTable[pc];
            }
        else if (c == 'æ') rep[pc] = uniform(1, 101);
        else if (c == 'ø') {
            if (--rep[jumpTable[pc]] > 0) pc = jumpTable[pc];
            }
        else if (c == 'Æ') rep[pc] = uniform(1, 1001);
        else if (c == 'Ø') {
            if (--rep[jumpTable[pc]] > 0) pc = jumpTable[pc];
            }
    }
} 

If you're fluent in D, then you can see that this has many functions.

I'M SORRY, IT WAS THE FIRST THING THAT CAME TO MIND, OK?!

Turing-completeness

Goldfish++ is Turing-complete, thanks to a brainfuck-to-Goldfish++ translation.

brainfuck Goldfish++
> >
< <
+ $i@
- $d@
. $a
, g@
[ $[
] $]

Since brainfuck is Turing-complete and brainfuck commands translate into Goldfish++, Goldfish++ is Turing-complete! This works because the tape is unbounded in both directions, just like in brainfuck.

Asymmetric storage

If you want to put "accumulator" into "storage", you type 'l'.

But to put "storage" into "accumulator", you type... 'v'?!

HOW CAN THIS BE?!

Because it's an esolang. What were you expecting?

Developer's notes

Because this is a very young programming language, not many programs are available at your disposal. 26 have been provided, but another option is to stay awake for the next 3 months straight and make a 2D game in it!

Edits are very helpful, especially showing examples of Goldfish++ code. If you do make an edit, I suggest you put your name on the edit!

The first one to make a brainfuck interpreter in Goldfish++ gets 100¤ / $0.01! The reward will be sent in satoshis. What you can do with 1 penny in this economy is AMAZING. You can buy... another penny! Actually, you can't. Just take it or leave it.

Do you like staying sane? Please don't touch this language. It will give your brain a 404 hardware error.

Contributions

Credit to User:acidbytes.h, aka myself, for making the interpreter and most of the example programs!

Credit to User:Cordership for making the ROT13 program!

Credit to User:Aadenboy, User:PkmnQ and User:Yoshifan66 (all lowercase) for making the wiki page cleaner!

See also

  • Deadfish, basically the original version of Goldfish++
  • Deadfish~, Deadfish but you can do more things with it
  • Deadfish++, basically Goldfish++ but slightly different and unimplemented
  • Goldfish, not to be confused with Goldfish++, as this barely has any correlation with it
  • brainfuck, the Turing-complete parts of this language, such as [ and ], not to mention others
  • HQ9+, all 4 functions were implemented directly into Goldfish++

External resources