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, Brainf**k, HQ9+
File extension(s) .gfpp, .goldfpp

 

Goldfish++ is a Turing-complete version of Deadfish. Because the name Goldfish was taken before I even existed, the language uses the name Goldfish++ to avoid confusion. Mostly.

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

Examples

Hello World!

H

Cat

g[ag]

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

Cipher

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

g[iag]

Cipher variants

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

Fish

Prints the Fish logo : ><>.

8sdda
dda
iiA

Colored Fish

5siia
0IsDia
7sIdda
7siia
0IsIda

8sdda
dda
iiA

5siia
0IsDia
7sda
0IsIda

Hello World, properly

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

Runs & Quits


Implementation

import std.stdio;
import std.file;
import std.random;
import std.string;
void main(string[] args) {
    string source = readText(args.length > 1 ? args[1] : "goldf.d");
    int accumulator = 0;
    int storage = 0;
    int storage2 = 0;
    int storage3 = 0;
    int storage4 = 0;
    int storage5 = 0;
    size_t[size_t] jumpTable;
    size_t[] stack;
    for (size_t i = 0; i < source.length; i++) {
        if (source[i] == '/' && i + 1 < source.length && source[i + 1] == '/') {
            while (source.length && source[i] != '\n') {
                i++;
            }
            continue;
        }
        if (source[i] == '[') {
            stack ~= i;
        } else if (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++) {
        char c = source[pc];
            if (c == '/' && pc + 1 < source.length && source[pc + 1] == '/') {
            while (source.length && source[pc] != '\n') {
                pc++;
            }
            continue;
        }
        if (c == 'i' || c == '+') accumulator += 1;
        else if (c == 'I') accumulator += 10;
        else if (c == 'd' || c == '-') accumulator -= 1;
        else if (c == 'D') accumulator -= 10;
        else if (c == 's') accumulator *= accumulator;
        else if (c == 'o') writeln(accumulator);
        else if (c == 'h') break;
        else if (c >= '0' && c <= '8') accumulator = c - '0';
        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 == '*') 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 == 'a') write(cast(char)accumulator);
        else if (c == 'A') writeln(cast(char)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 == '[') {
            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') {
            char ch;
            if (readf("%c", &ch) == 1) {
                accumulator = cast(int)ch;
            } else {
                accumulator = 0;
            }
        }
    }
} 

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?!

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. Only 10 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 you name on the edit!

Is Python / Scratch your main language? Please don't touch this language. It will give your brain a 404 hardware error.

See also