Simple2DMachine
Jump to navigation
Jump to search
Simple2DMachine is an esolang.
Introduce
Simple2DMachine is a cell-based esolang like Langton’s ant or 2D Turing machine.
Commands
/Don’t remove it!
/*Shh!
Be quiet!*/ Comments
#{} Define default settings
(''CellMap/RLE''):''pos'',''direction'' Define default patterns, position and direction
''state_name''{''commands''} Define the commands of ''state_name''
>''state_name'' Switch into ''state_name''
(''commands'') Block
-f Go forward
-b Go backward
-r Turn right
-l Turn left
!''char'' Write down ''char''
?''char''(''commands'') If ''char'' on cell, run ''commands''
Note:
The cell is default “ ”;
Commands like -f-l-b is equal to -flb;
If the ''state_name'' or ''char'' is more than one character, use () to quote it.
Examples
Hello, world!
a{-f!H-f!e-f!l-f!l-f!o-f-f!w-f!o-f!r-f!l-f!d-f-!}
Langton’s ant
a{? (!o-fr)?o(! -fl)>a}
Binary adder
#{num1
num2}:(''NumLength''+1,2),W
a{-fl?0(-f?0(-f?+(!1)? (!0))?1(-f?+(!0-rf!+-bl)? (!1)))?1(-f?0(-f?+(!0-rf!+-bl)? (!1))?1(-f?+(!1-rf!+-bl)? (?(!0-rf!+-bl))))-bbr>a}
/*
Example:
#{0011001
01010111}:(8,2)W
Result:
0011001
0101011
1000100
*/