PlusOrMinus
Two commands and one byte. + counts up, and - prints the count and counts down.
PythonshellDebugwindow, 2019 · Turing complete: no · ●○○ easy · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
PythonshellDebugwindow made PlusOrMinus in November 2019. There is no input, no loop and no memory beyond a single accumulator, so every program runs once from left to right and stops. The only trick is that printing also lowers the accumulator by one. To print a lower letter after a higher one, a program counts up past 255 and wraps round.
The machine
One accumulator from 0 to 255 that wraps and starts at 0. The original 2019 variant ran from 0 to 461 and started at 18; this is the modern one.
| Char | Does |
|---|---|
+ | Add 1 |
- | Print the character with the accumulator's code point, then subtract 1 |
Every other character is a comment.
Example
H is code point 72, so 72 + and a - print it and leave 71.
H is code point 72, so 72 + and a - print it and leave 71. The 34 + after that reach 105, which is i.
The Hello World is 1,338 characters long and its interpreter for Nope. is 567. Both print Hello, World! and Nope..
Further
Ideas it shows
See also
Also in Jokes
Write your own in Run Convert a program from PlusOrMinus
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: plusorminus.
Command line
shib run plusorminus program.txtThe program is long; save it as program.txt first.
shib manual plusorminusSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/plusorminus.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org