RANDo

From Esolang
Jump to navigation Jump to search

Language RANDo was created User:Kamish.

Commands

Consists of 5 commands:

Command Value
r adds random values to the variable(0 to 4)
a subtracts the value from the variable(0 to 2)
n prints the value of the variable(number)
d prints a character based on the value of variables(ASCII-table)
o zeroes the variable

If the value of the variable is greater than 9999, the program ends.

Hello World

In this case, the code is:

rrrrrrrrrrnrrrrrrrrrrnrrrrrrrrrrnrrrrrrrrrrndo
rrrrrrrrrrnrrrrrrrrrrnrrrrrrrrrrnrrrnrnanananrnando
rrrrrrrrrrnrrrrrrrrrrnrrrrrrrrrrrrrrrnaaaaaanaaaaaando
rrrrrrrrrrrrrrrrrrrrnrrrrrrrrrrnrrrrrnrrnrndo
rrrrrrrrrrrrrrrrrrrrnrrrrrrrrrrnrrrrrnrrnrndo
ond
rrrrrrrrrrrrrrrrrrrrrrrrrnrrrrrrrrrrnrrrrrnrrrrnrnaananando
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrnrrrrrnrnrnaanananrnaanananando
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrnrrrrrrrrrrnrnananrnrnando
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrnaaaaanaaaaanrnrnando
rrrrrrrrrrrrrrrrrrrrnrrrrrrrnrnrnanananando

Interpreter in Python 3

import random
def RANDo(code):
  v = 0
  for c in code:
    if c == "r":
      v += random.randint(0, 4)
      if v > 9999:
        return
    elif c == "a":
      v -= random.randint(0, 2)
    elif c == "n":
      print(v)
    elif c == "d":
      print(chr(v), end="")
    elif c == "o":
      v = 0