U (Ractangle)

From Esolang
(Redirected from User:Ractangle/U)
Jump to navigation Jump to search

U is an esoteric programming language created by User:Ractangle based on mostly bf

Syntax

Commands

CMD ACTION
>   Move the cell pointer right
<   Move the cell pointer left
:   Duplicate the current cell's value to the cell next to it
+   Increment the current cell
-   Decrement the current cell
.   Output the current cell's value as an ASCII character
,   Output the current cell's value as an Integer
*   Multiplies the two cells together
/   Divides the two cells together
s   Sum of the two cells
d   Difference of the two cells
?   Prints the cells and the current position of the pointer

Implementation

"this was made a really while ago. managed to find it using the \"Everything\" tool"
a=p=t=0;ce=[0]*5;print("py-U")
c=input("code:")
while len(c)!=p:
  if c[p]==">":t+=1
  elif c[p]=="<":t-=1
  elif c[p]==":":ce[t+1]=ce[t]
  elif c[p]=="+":ce[t]+=1
  elif c[p]=="-":ce[t]-=1
  elif c[p]==".":print(end=chr(ce[t]%256))
  elif c[p]==",":print(end=str(ce[t]%256))
  elif c[p]=="*":ce[t]=ce[t]*ce[t+1];ce[t]=0
  elif c[p]=="/":ce[t]=ce[t]//ce[t+1];ce[t]=0
  elif c[p]=="s":ce[t]=ce[t]+ce[t+1];ce[t]=0
  elif c[p]=="d":ce[t]=ce[t]-ce[t+1];ce[t]=0
  elif c[p]=="?":print(ce);print(f"Currently pointing at {t}")
  p+=1