RCEM
From Esolang
Contents |
[edit] RCEM
Random Code Executation Machine is an esoteric computer language invented in March 2008 by Feuermonster. Data is stored on an infinite tape. In addition, there exists a cell (called I-Cell), which can store numbers. Every cell can have one of the following statements:
- 0 (false)
- 1 (true)
- 2 (maybe)
[edit] Instructions
- r* (Moves the pointer * steps to the right.)
- l* (Moves the pointer * steps to the left.)
- s* (Set the cell to *. * can be 0,1 or 2)
- o_ (Prints out the value which is stored at the current cell.)
- i_ (Reads a value from the input and stores it in the current cell.)
- x_ (Sets the cell to a random value. (0,1 or 2))
- ^* (equal to cells[current] = cells[current] xor cells[current + *])
- +* (equal to cells[current] = cells[current] and cells[current + *])
- c_ (switches the value from 0 to 1 and from 1 to 0.)
- ++ (Add 1 to the current cell.)
- -- (Sub 1 from the current cell.)
- 2* (If the cell has the value 2. The cell gets a new value *.)
- m+ (Adds 1 to the I-Cell)
- m- (Subtracts 1 from the I-Cell)
- mp (Prints out the I-Cell as a number.)
- mo (Prints out the I-Cell as character.)
- mi (Reads a value from the input and stores it in the I-Cell.)
- m::*::* (Reads a binary value and stores it as a number in the I-Cell. m::0::8 Would read cell 0 till cell 8. See example above.)
- z::*::* (Reads a number from I-Cell and stores it in the cell * till * as binary.)
If the value of a cell would be >=3. The value will get the value 3 % 3. (n % 3)
[edit] Loops
- ( ... ) The code will be executed, if the current cell has the value 0.
- { ... } The code will be executed, if the current cell has the value 1.
- < .... > The code will be executed, if the I-Cell is not 0.
- / .... \ The code will be executed, if the cell has the value 2.
- [ ... ] The code will be executed, if Rnd(2) is 1. ( 50% : 50%)
If the value of the current cell is 2, every loop will be executed. (Even if Rnd(2) is 0)
[edit] Examples
s2[r1s2] Infinite loop.
s2o_ This will print 2.
x_[r1x_] Random loop.
x_r9([r1][l2]x_) An other random based loop.
r65s1l65(m+r1)mo This will Print 'A'.
s0r1s1r1s0r1s1l3m::0::3mp This will print '5'.
m+m+m+m+m+z::0::2o_r1o_r1o_ This will print '101'.
x_/x_\o_ Prints out '1' or '0'
<m-> Sets the I-Cell to 0.

