Whendo
Whendo is an esolang invented by User:None1, inspired by Thue and 开?关!. It is very similar to Thue, but uses numbers instead of strings.
Memory
It uses variables, which contains unbounded signed integers. Variables that are not defined are zero when read, and are defined when modified.
Syntax
Its syntax is very simple:
variable1==variable2=>variable3+=number
If variable1 equals to variable2 then add number to variable3, number can be positive, negative or zero, variable2 can also be a number, but variable1 and variable3 can't.
Both the parts before and after the =>
's are optional, when the part before does not exist, the condition is satisfied by default. When the part after does not exist, it does nothing when the condition is satisfied.
I/O Syntax
Sometimes, the program needs to input or output, in this case, the syntax changes a little bit.
variable1==variable2=>variable3+=number=>y
If variable1 equals to variable2 then add number to variable3, then output y (which can be a number or variable) as ASCII.
variable1==variable2=>variable3+=number->y
If variable1 equals to variable2 then add number to variable3, then output y (which can be a number or variable) as decimal.
variable1==variable2=>variable3+=number<=y
If variable1 equals to variable2 then add number to variable3, then input y (which can only be a variable) as ASCII.
variable1==variable2=>variable3+=number<-y
If variable1 equals to variable2 then add number to variable3, then input y (which can only be a variable) as decimal.
Execution
When the program is executed, it picks a random line where the condition in that line is satisfied, and than executes it. When there are no lines like that, the program terminates.
Examples
a==0=>a+=4->a
a==0=>a+=1=>72 a==1=>a+=1=>101 a==2=>a+=1=>108 a==3=>a+=1=>108 a==4=>a+=1=>111 a==5=>a+=1=>44 a==6=>a+=1=>32 a==7=>a+=1=>87 a==8=>a+=1=>111 a==9=>a+=1=>114 a==10=>a+=1=>108 a==11=>a+=1=>100 a==12=>a+=1=>33
The following is an example that demonstrates Whendo's nondeterminism:
a==0?a+=1=>65 b==0?b+=1=>66
When the program starts, both the first and second lines have their conditions satisfied, so any one might be executed first, after that, only the condition in the other line is satisfied. Thus, AB
and BA
are two possible outputs of this program.
Infinite loop:
=>
There is one line, with its condition always satisfies, so the program never terminates.