Onechar
Simple Introduction
Onechar(onch for short) is a esolang. It was inspired by a sentence in TypeInt. Its code can be a number or any character string. If it is a character string, the length of the character string will be used as the code.
The Syntax
When the program begins, it goes:
- generate a list. The content of the list is the code (hereinafter referred to as N). those are
round(N mod 2)
,round(N mod 3)
,... That is, all odd numbers starting with 3 after the first item is 1 and 2. The list stops building after the 1 occurs. - Generate a queue of two values for each item, and the queue initially has an item with a value of 0 and a value of 1.
- Begins to traverse each item (the value of each item is hereinafter referred to as k). The result of dividing k by 2, 3, 4, 5, 7, and 9 respectively determines the operation.
- If the second value of the top value in the queue equals 2, let k plus the first value of the top value.
- If k mods 4 is 0 or 2, we have operations below:
- If k mods 5 is 0, let p be the place in the list of k(p is a number), let k be the no.p-2(if p-2 < 0, we will use 0) term in the list.
- If k mods 5 is 1 do the operations up but replace 2 to 1.
- If k mods 5 is 2 if the top of queue is less than or equals 0, use next k and back to the place where begin.
- If k mods 5 is 3, swap the top of queue and the bottom of the queue.
- If k mods 5 is 4, swap 2 terms on the top of queue.
- If k mods 3 greater than 0, add a term in the queue whose first value is k mods 7 and second value is k mods 3.
- If k mods 9 is 1, let the top of queue's first value round k mods 7.
- If k mods 9 is 2, let i be the first value of the top of the queue, if i is 0 let i be 1, let i be 0 if not that.
- If k mods 9 is 3, delete the bottom of the queue.
- If k mods 9 is 4, if i mods 2 is 1, output the first value of the top of queue; if i mods 2 is 0, let the first value of the top of the queue be the input character's place in the ASCII.
Some simple programs(?)
this program exactly can output 5 but it will get input then...
5
because of many reasons(???) so i dont know is this a cat, you should know writing a program in onch is so diffcult...
70
One of the Quine of Onechar is one.
1(or the No.1(starts from 0) character in ASCII and the text in () is not code, it is only a tip)
The interpreter of Onechar
this interpreter only support number code and output.
code=5#you can also len("some strings") values=[code] k=2 q=[[0,1]] while code//k>1: values.append(code//k) code=code//k k+=1 if k==2 else 2 pointer=0 while pointer<len(values): j=pointer i=values[j] ttype=0 ttype=i%3 if q[-1][1]==2: values[j+1 if j<len(values)-1 else 0]+=q[-1][0] tnext=i%4 in (0,2) if tnext: if i%5==0: pointer-=2 if pointer>1 else pointer continue elif i%5==1: pointer-=1 if pointer>0 else pointer continue elif i%5==2: top=q[-1][0] if len(q)>0 else 0 if top<=0: continue elif i%5==3: q[0],q[-1]=q[-1],q[0] elif i%5==4: q[-1],q[-2]=q[-2],q[-1] if ttype>0: q.append([i%7,ttype]) if i%9==1: q[-1][0]//=i%7 elif i%9==2: q[-1][0]=int(not q[-1][0]) elif i%9==3: q.pop(0) if len(q)>1 else 0 if i%9 != 4: if i%2: print(q[-1][0])#you can also use chr function. else: q[-1][0]=ord(input()[0]) pointer+=1
idk why it here is
If you have any questions but cant answer it by yourself, please look the interpreter, I think it can help you... Do you want to know what the sentence in the begin of text is? Here is it: "If there's only one char for this esolang. will it still Turing Complete?" But I dont know is it TC I hope that.