Fear of the Unknown
Fear of the Unknown is an esolang created by User:Fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff in 2024. It's inspired by My Unreliable Past, Entropy, and Subtractpocalypse.
Data storage
Data in Fear of the Unknown is stored in variables, which can be modified by commands. After each command, one of the variables (except the subject of the command) has a chance to 1: increment, 2: decrement (this only happens if the variable is nonzero), 3: not change at all. Options #1 and #2 both have a 25% chance, while #3 has a 50% chance. All variables except $IO are initially set to 0. $IO is initialized to 1.
Syntax
A command starts with a variable (called the subject), followed by an operator (+, -, =) and then either a number or a variable (called the object), then finally a semicolon. Empty commands are also allowed. Note that = is a loose equality check, not an assignment. = sets the subject to 1 if the subject and object are equal, and 0 otherwise. Commands are followed in a cyclic order. After a command, if the subject of the command is ever negative, the program halts. Randomization may not halt the program. Comments may be included in the source code, surrounded by a ". Whitespace is disallowed in variable names and numbers, but is permitted everywhere else. All alphanumeric characters are allowed in variable names, along with _ and $.
For example, a valid program could be:
A + $IO; A = 65; " Comment " lOnG_vAr2 - 9;
Symbol | Name | Function |
---|---|---|
+ | Add | Increment the subject's value by the object |
- | Subtract | Decrement the subject's value by the object. The program halts if the value becomes negative. |
= | Equality | Set the subject to 1 if it is equal to the object's value and 0 otherwise. If the values are one away, the subject still becomes 1. |
Input and output
The variable $IO is special, as it handles input and output. Whenever $IO is the subject of either + or - (and nonzero), the new value written to it is printed as an ASCII character (if it's nonzero). When $IO is the object (and nonzero) of a command, the value is the Unicode ID of one character of input. $IO may not be changed randomly. End of file returns 1114112.
Examples
Hello, World!
$IO=0; $IO+1; $IO+72; $IO=0; $IO+1; $IO+101; $IO=0; $IO+1; $IO+108; $IO=0; $IO+1; $IO+108; $IO=0; $IO+1; $IO+111; $IO=0; $IO+1; $IO+44; $IO=0; $IO+1; $IO+32; $IO=0; $IO+1; $IO+87; $IO=0; $IO+1; $IO+111; $IO=0; $IO+1; $IO+114; $IO=0; $IO+1; $IO+108; $IO=0; $IO+1; $IO+100; $IO=0; $IO+1; $IO+33; $IO=0; $IO+1; HALT - 99;
This program uses the HALT variable to halt. It does not have enough time to get to 99, thus it will always be smaller and halt the program.
Truth-machine (?)
X + $IO; X = 50; X + X; X + X; X + X; $IO + 49; X - 3; $IO = 1000;
Note that this truth-machine outputs at 1 when the input is 0.