Bias
Bias is an esolang by User:PythonshellDebugwindow.
Commands
Outside biases
Where B is the value of the command's preceding bias (or 0 if it has no preceding bias):
Command | Effect |
---|---|
+ |
Increase the current cell by B |
- |
Decrease the current cell by B |
/ |
Set the current cell to an input integer |
= |
Set the current cell to an input character |
& |
Output the current cell as an integer B times |
' |
Output the current cell as a character B times |
" |
Increase the cell pointer by B |
* |
Halt the program |
: |
Jump forwards B commands (not including biases) |
; |
Jump backwards B commands (not including biases) |
( |
Starts a bias (see #Biases) |
) |
Ends a bias |
Inside biases
Here, B is initialized to 1 if there is no preceding bias:
Command | Effect |
---|---|
+ | Increment the value by B |
- | Decrement the value by B |
* | Multiply the value by B |
\ | Divide the value by B (integer division) |
/ | Set the value to the current cell |
= | Set the value to 0 |
Each of these commands may be preceded by a bias. This nesting can be arbitrarily deep. A bias can also be preceded by another bias, in which case that bias's value will be initialized to the preceding bias's value instead of 1.
Biases
Biases, this language's namesake, affect the "magnitude" of the command they directly precede. The result of a bias when executed is known as its 'value' (also B in #Commands). The value starts as 0.
Examples
Hello, World!
- Currently prints Hello
(++++++++(+++++++++)*)+'(++++)+(+++++(+++++)*)+'(+++++++)+''(+++)+'
Infinite 1-char cat
='(++);
Truth-machine
/(/(+++)*):&*&(+);
Turing-completeness proof
Brainfuck where [ jumps if nonzero and ] jumps right back to [ (let's call it BF0) is still Turing-complete, as you can use two cells for every BF cell: one to store the value, the other for computing the NOT of the value (for adjusting to nonzero loops instead of zero loops). BF0 can be compiled into Bias with the following translations:
Command | Translation |
---|---|
+ |
(+)+
|
- |
(+)-
|
+ |
(+)+
|
< |
(-)"
|
> |
(+)"
|
, |
=
|
. |
(+)'
|
Looping is a bit more difficult, but it can be done. You have to replace all [
s with +(off(+(/)*/\)*\):
where off is the right-offset of the matching ]
; this exits the loop if the current cell is zero. Replace the ]
s with (off-);
where off is the left-offset of the matching [
.