Double

From Esolang
Jump to navigation Jump to search
Double
Designed by Lim95
Appeared in 2022
Memory system Cell-based
Dimensions One-dimensional
Computational class Turing complete
Major implementations Original (Python), IDE (Created by Vivax), Flask (Created by me)
File extension(s) .txt, .dbl
Double's logo
Double's logo

Double is an esolang created by Lim95 on July 5th, 2022. It was programmed over the course of two hours on a livestream. Double's main feature is that each instruction must be two characters long. Comments are marked with a couble forward slashes (//)

To run a program, either use "python3 double.py/main.py -r [code]" or "python3 double.py/main.py -f [filename]".

Double Commands
Command Token What it does Version introduced Arguments
PV 0 Prints the value of the current cell. 1.0 None
PC 1 Prints the character of the current cell. 1.0 None
SX 2 Sets the X coordinate of the current cell. 1.0 Value
SY 3 Sets the Y coordinate of the current cell. 1.0 Value
IX 4 Increments the X coordinate of the current cell. 1.0 None
IY 5 Increments the Y coordinate of the current cell. 1.0 None
DX 6 Decrements the X coordinate of the current cell. 1.0 None
DY 7 Decrements the Y coordinate of the current cell. 1.0 None
SV 8 Sets the value of the current cell. 1.0 Value
IV 9 Increments the value of the current cell. 1.0 None
DV 10 Decrements the value of the current cell. 1.0 None
RS 11 Restarts the program (sets the pointer to 0) 1.0 None
CR 12 Restarts the program if the value provided is not equal to the value of the current cell. (BNE) 1.0 Condition
GC 13 Get the character ID of a character the user types in. If there's an error, return 255. 1.0 None
GV 14 Get the value of a hexadecimal number the user types in. 1.0 None
XV 15 Set the value of the current cell to the X coordinate. 1.0 None
YV 16 Set the value of the current cell to the Y coordinate. 1.0 None
JM 17 Jump to a specified location. 1.0 Address
CJ 18 Jump to a specified location if the first value is not equal to the value of the current cell. 1.0 Condition, Address
** 19 Replaces any value with the value of the current cell. 1.0 None
JF 20 Jumps forward the specified amount of instructions. 1.1 Address
JB 21 Jumps backward the specified amount of instructions. 1.1 Address
CF 22 Jumps forward if the condition is not the current cell's value. 1.1 Condition, Address
CB 23 Same as CF, but with backwards. 1.1 Address
GS 24 Get a string and store it across the X axis. 1.2 (Changed 1.6) None
JR 25 Jumps to a subroutine and pushes the pointer on to the stack. 1.3 Address
RR 26 Returns from a subroutine. 1.3 None
RC 27 Jumps to a subroutine conditionally. 1.3 Condition, Address
BC 28 Returns from a subroutine conditionally. 1.3 Condition
RN 29 Generates a random 8-bit integer (0 - 255) and stores it into the current cell. 1.4 (Changed 1.5) None
DB 31 It's a data block. End it with a 0xFF (255) byte. 1.6 Any amount, end with 0xFF (255)
PS 32 Prints a string in memory across the X axis. 1.6 None
+C 33 Add the value of the current cell to the Accumulator. 1.6 None
-C 34 Subtract the value of the current cell from the Accumulator. 1.6 None
IC 35 Increment the value of the Accumulator. 1.6 None
DC 36 Decrement the value of the Accumulator. 1.6 None
SA 37 Set the value of the Accumulator. 1.6 Value
AV 38 Get the value of the Accumulator. 1.6 None
PH 39 Push the value of the current cell onto the Stack. 1.6 None
PL 40 Pull the top value of the Stack into the current cell. 1.6 None

Example Programs

Note: All programs are written for the JavaScript interpreter. Compatibility may vary based on the interpreter.

Hello, World!

."Hello, world!"

Hello Interpreter

GC
CR #H
."Hello, World!"

Adder (created by vivax3794)

DV IX IV DX CR FF IX DV PV GV DX GV RS

Cat Program

GS PC IX CJ FF 01

99 Bottles of Beer

SV 03
SONG:
PV SX 01
."bottles of beer on the wall,"
SV 0A PC
SX 00 PV SX 01
."bottles of beer! Take one down, pass it around,"
SV 0A PC
SX 00 DV PV SX 01
."bottles of beer on the wall!"
SV 0A PC
SX 00
CJ 00 SONG
SX 01
."No more bottles of beer on the wall!" 

Brainfuck interpreter (created by vivax3794)

IX SV FF IY GS IY SV FF
SY 00 SX 00 IX CB FF 01 SV 00 IX SV FF DX IY
CF FF 05 JM XX

CF 3E 12 SY 02 SX 00 IX CB FF 01 SV 00 IX SV FF JM 08
CF 3C 12 SY 02 SX 00 IX CB FF 01 SV 00 DX SV FF JM 08
CF 2B 0F SY 02 SX 00 IX CB FF 01 IY IV JM 08
CF 2D 0F SY 02 SX 00 IX CB FF 01 IY DV JM 08
CF 2C 0F SY 02 SX 00 IX CB FF 01 IY GC JM 08
CF 2E 0F SY 02 SX 00 IX CB FF 01 IY PC JM 08

CF 5B 3B SY 02 SX 00 IX CB FF 01 IY CJ 00 08
SY 00 SX 00 IX CB FF 01 SV 00 DX SV 01
IY DY DV IX IV DX CB 00 04 IX IY CF 5B 07 DY IV JB 0E CB 5D 11 DY DV CB 00 15 
IX SV FF JM 08

CF 5D 3B SY 02 SX 00 IX CB FF 01 IY CF 00 05 JM 08
SY 00 SX 00 IX CB FF 01 SV 00 DX SV 01
IY DY DV DX IV IX CB 00 04 DX IY CF 5D 07 DY IV JB 0E CB 5B 11 DY DV CB 00 15 
IX SV FF JM 08

Adder (by Lim95)

GV IX GV DX +C IX +C IX AV PV

Cat Program (1.6 Version)

GS SX 00 PS

Old IV PC RS (1.6)

IV PC CR 255 SV 0 RS

dbpk

dbpk is the Double Package Manager. Use the terminal to run python3/py dbpk search * to see all packages, and install something with install [name].

Screen

In the 1.5 update of Double, a visual add-on was released. In update 2.0, dbpk was introduced. To install the new graphics engine, type python3/py dbpk install graphics A simple program to test it is:

IMPORT GRAPHICS
IX XV
CR 40
IY
SX 00
YV
CR 40
XV US
RS