Inverted
Jump to navigation
Jump to search
Inverted is an esoteric programming language written by Dominicentek in Java. It's code is written line-by-line, and executed from bottom to top. It's very similar to Brainfuck.
Commands
Command | Description |
---|---|
inc | Decrements a value in a cell by 1 |
dec | Increments a value in a cell by 1 |
left | Moves the cell pointer to the right |
right | Moves the cell pointer to the left |
while | Executes code in this code block unless a cell value is 0, then it loops |
if | Executes code in this code block unless a cell value is 0, then it continues |
loop | Loops a code block the number of times in a cell |
text | Prints the current cell's Unicode value to the console |
Prints the current cell's value to the console | |
user | Prompts the user for input and sets it to the current cell |
char | Prompts the user for input and sets the first character's Unicode value to the current cell |
random | Places a random number in a cell, range is the cells value (Range: 0 to x - 1) |
exit | Exits the program |
end | Ends a code block |
You have 100 cells to work with. Each having signed 32-bit values.
Examples
Hello World
text dec dec dec dec dec dec dec dec dec dec left text dec left left text inc inc inc inc inc inc inc inc text inc inc inc inc inc inc text dec dec dec text right right right right text inc inc inc right end inc left dec dec dec dec dec dec dec dec dec right while dec dec dec dec dec dec dec dec dec dec left left left text right end inc left dec dec dec dec right while dec dec dec dec dec dec dec dec left left left text dec dec dec text text dec dec dec dec dec dec dec text dec right end inc left dec dec dec dec right while dec dec dec dec dec dec dec left text right end inc left dec dec dec dec dec dec dec dec right while dec dec dec dec dec dec dec dec dec left
Truth Machine
print end print while user
Converters
All of those converters are written in JavaScript
Inverted to Brainfuck
Commands if, loop, print, user, random and exit are ignored
var input = ""; // Enter the Inverted code here var lines = input.split("\n"); lines.reverse(); var string = ""; for (var i = 0; i < lines.length; i++) { var line = lines[i]; if (line == "dec") string += "+"; if (line == "inc") string += "-"; if (line == "right") string += "<"; if (line == "left") string += ">"; if (line == "while") string += "["; if (line == "end") string += "]"; if (line == "text") string += "."; if (line == "char") string += ","; } console.log(string);
Brainfuck to Inverted
var input = ""; // Enter the Brainfuck code here var characters = input.split(""); var output = []; for (var i = 0; i < characters.length; i++) { var character = characters[i]; if (character == "+") output.push("dec"); if (character == "-") output.push("inc"); if (character == "<") output.push("right"); if (character == ">") output.push("left"); if (character == "[") output.push("while"); if (character == "]") output.push("end"); if (character == ".") output.push("text"); if (character == ",") output.push("char"); } output.reverse(); var string = output.join("\n"); console.log(string);