Cubed

From Esolang
Jump to navigation Jump to search
Cubed
Paradigm(s) Imperative
Designed by Bardosi Benett Barna
Appeared in 2023
Memory system stack-based
Dimensions three-dimensional
Computational class Turing complete
Major implementations [1]
Influenced by Befunge and Argh!
File extension(s) {{{files}}}

Cubed

Cubed is a 3D Programming language

Inspired

Inspired by Befunge mostly

Author

I (Benett0222) created this Programming Language

I originaly named this BefungeCubed , CCPL(Cube Code Programming Language) and ^3


Examples

Layer1:


 |r|!|r|d|#|#|
 |D|#|#|d|#|#|
 |u|#|#|d|#|#|
 |u|l|l|l|#|#|


Layer2:


 |r|r|r|r|r|d|
 |u|#|#|#|#|d|
 |r|p|D|#|#|d|
 |u|l|”|1|”|l|


Layer3:


 |g|#|#|#|#|#|
 |u|”|1|”|l|#|
 |#|#|d|#|u|#|
 |#|#|r|!|u|#|


Commands

 “r” goes right
 “l” goes left
 “u” goes up
 “d” goes down
 ““” starts adding next 
 number(s)/letter(s) to stack
 “”” end adding to stack
 “!” deletes first of stack
 “p” prints out stack’s first value
 “P” prints out ASCII stack’s first value
 “g” goes to layer “stack’s first value” 
 and position “currently located at”
 “G” goes to layer “stack’s first value” 
 and position “stack’s second value”
 “D” goes down one layer
 “U” goes up one layer
 “?” asks for user input turns char into numbers and
 A into A(doesn’t wait)
 “.” asks for user input and skips next command in direction
 “A” asks for user input turns char into ASCII (doesn’t wait)
 and outputs to stack , jumps over next command
 “=” checks if stack’s first value is 
 equal to the second value in the stack 
 and outputs 1 into the stack else outputs a 0
 (deletes first 2)
 “#” does nothing
 “@” ends the program
 “<” if first value in stack is 
 0 then keep moving forward else 
 turn left 90 degrees
 “>” if first value in stack is 
 0 then keep moving forward else 
 turn right 90 degrees
 “+” add first 2 values of stack (deletes 
 top two)
 “-” subtract first 2 values of 
 stack(deletes top two)
 “*” multiply first 2 values of stack 
 (deletes top two)
 “/” divide first 2 values of stack (7/5 is 1,4) 
 (deletes top two)
 “\” divide first 2 values of stack (7/5 is 1) 
 (deletes top two)
 “%” mod first 2 values of stack (20 mod 3 is 2) 
 (deletes top two)
 “:” flip stack
 “&” duplicates top value
 “t” goto top layer with going to the top
 left corner
 “num” goto layer num with going to the 
 top left corner
 “;” move first value of stack to the bottom 
 of the stack
 “,” move last value of stack to the top 
 of the stack


Truth Machine

Truth Machine

Input 0 Output 0

Input 1 Output 111111111…


 |r|.|d|d|d|
 |u|#|d|d|p|
 |u|l|l|d|@|
 |D|l|l|l|#|
 |#|#|#|#|U|
 |#|r|r|d|<|
 |#|u|p|l|=|
 |r|”|1|”|u|


Adder

 |r|?|?|:|d|
 |@|p|l|+|l|


Subtracter

 |r|?|?|:|d|
 |@|p|l|-|l|


Multiplier

 |r|?|?|:|d|
 |@|p|l|*|l|


Divider

 |r|?|?|:|d|
 |@|p|l|/|l|


Calculator

A Calculator has 4 operations

 42 *  
 43 +
 45 -
 47 /


 |r|r|r|r|”|4|3|”|?|=|d|
 |2|!|<|l|l|l|l|l|l|l|l|
 |#|#|r|?|?|:|d|#|#|#|#| 
 |#|#|@|p|l|+|l|#|#|#|#|
 |r|r|r|r|”|4|5|”|?|=|d|
 |3|!|<|l|l|l|l|l|l|l|l|
 |#|#|r|?|?|:|d|#|#|#|#| 
 |#|#|@|p|l|-|l|#|#|#|#|
 |r|r|r|r|”|4|2|”|?|=|d|
 |4|!|<|l|l|l|l|l|l|l|l|
 |#|#|r|?|?|:|d|#|#|#|#| 
 |#|#|@|p|l|*|l|#|#|#|#|
 |r|r|r|r|”|4|7|”|?|=|d|
 |t|!|<|l|l|l|l|l|l|l|l|
 |#|#|r|?|?|:|d|#|#|#|#| 
 |#|#|@|p|l|/|l|#|#|#|#|


Hello World program

Prints “Hello World”

 |r|r|”|7|2|”|d|
 |D|”|1|0|1|”|l|
 |D|”|1|1|1|”|l|
 |r|”|1|0|8|”|u|
 |r|r|”|3|2|”|d|
 |D|”|7|8|”|l|l|
 |D|”|0|0|1|”|l|
 |r|”|1|1|4|”|u|
 |r|:|P|;|P|;|d|
 |D|;|P|;|P|P|l|
 |D|P|;|;|;|P|l|
 |r|P|;|P|,|,|u|
 |r|,|,|,|,|P|d|
 |D|;|;|;|;|;|l|
 |@|l|!|!|!|!|l|
 |r|P|!|!|!|!|u|


cat program

 |r|?|r|”|1|0|”|d|
 |D|!|<|=|:|&|:|l|
 |#|#|@|#|#|#|#|#|
 |#|#|#|#|#|#|#|#|
 |r|?|&|”|1|0|”|d|
 |u|!|<|=|l|l|l|l|
 |d|l|l|r|:|r|P|d|
 |r|!|!|u|#|u|!|l|


Input A B Enter

Stack

 A            ?
 10 A         “”
 A 10         :
 A A 10       &
 10 A A       :
 0 A          =
 A            !
 B A          ?
 B B A        &
 10 B B A     “”
 0 B A        =
 B A          !
 10 B A       ?
 10 10 B A    “”
 10 10 10 B A &
 1 10 B A     =
 10 B A       !
 B A          !
 A B          :
 B            P
 Nothing      P

Output AB

Loops

Loops are defenitely easy to make

1 layer Loops

Square loop

 |r|d|
 |u|l|

Extended loop

 |r|r|d|
 |u|l|l|

Modified loop

 |r|d|r|d|
 |u|r|u|d|
 |u|l|l|l|


Multible layer Loops

Square loop

 |r|D|
 |U|l|

Extended loop

 |r|D|
 |U|D|
 |U|l|

Modified loop

 |r|d|
 |#|D|
 |#|#|
 |#|t|


I/O

I

Can get numerical and alphabetical input

O

Can get numerical and alphabetical output

Examples

 |r|?|p|


Input 1

1


Input +

43


 |r|?|P|


Input 1

Start of Header


Input 48

0


Input +

+


Real inputs

ASCII 32-127

And Enter

Cubed’s Programming Area is an 2^10x2^10x2^8 but that can