fork(1) download
  1.  
  2. # └┐┌┘├┴─┬┤│┼█×÷± #
  3.  
  4. import math, random as r
  5. def n_round(n):
  6. if n - math.floor(n) < 0.5:
  7. return math.floor(n)
  8. return math.ceil(n)
  9. out=''
  10. file=open(input('.path: ')+'.path','r').readlines();import time;import os;cls=lambda:os.system('cls'if os.name in ('nt','dos')else'clear')
  11. row=0
  12. column=0
  13. loopstartrow=0
  14. loopstartcolumn=0
  15. pointer=''
  16. directions=['up','down','left','right']
  17. direction='right'
  18. datatype='lit'
  19. stroutput=''
  20. intoutput=''
  21. strsymbol=''
  22. file2=''
  23. stack=[0]
  24.  
  25. def move(d):
  26. global row, column
  27. if d=='up':row-=1
  28. if d=='down':row+=1
  29. if d=='left':column-=1
  30. if d=='right':column+=1
  31.  
  32. cls()
  33.  
  34. while not pointer=='@':
  35. if column+1>len(file[row]):
  36. print("Error: Where did the line go?? (Line "+str(row+1)+", Column "+str(column)+")");time.sleep(1.3);exit()
  37.  
  38. pointer=file[row][column]
  39. if pointer=='─' and (direction=='up' or direction=='down'):
  40. print("Error: That's not how lines work. (Line "+str(row+1)+", Column "+str(column+1)+")");time.sleep(1.3);exit()
  41. if pointer=='│' and (direction=='left' or direction=='right'):
  42. print("Error: That's not how lines work. (Line "+str(row+1)+", Column "+str(column+1)+")");time.sleep(1.3);exit()
  43.  
  44. if pointer=='┐':
  45. if direction=='left' or direction=='down':
  46. print("Error: That's not how lines work. (Line "+str(row+1)+", Column "+str(column+1)+")");time.sleep(1.3);exit()
  47. if direction=='up':
  48. direction='left'
  49. if direction=='right':
  50. direction='down'
  51.  
  52. if pointer=='┘':
  53. if direction=='down':
  54. direction='left'
  55. elif direction=='right':
  56. direction='up'
  57. else:
  58. print("Error: That's not how lines work. (Line "+str(row+1)+", Column "+str(column+1)+")");time.sleep(1.3);exit()
  59.  
  60. if pointer=='┌':
  61. if direction=='up':
  62. direction='right'
  63. elif direction=='left':
  64. direction='down'
  65. else:
  66. print("Error: That's not how lines work. (Line "+str(row+1)+", Column "+str(column)+")");time.sleep(1.3);exit()
  67.  
  68. if pointer=='└':
  69. if direction=='down':
  70. direction='right'
  71. elif direction=='left':
  72. direction='up'
  73. else:
  74. print("Error: That's not how lines work. (Line "+str(row+1)+", Column "+str(column)+")");time.sleep(1.3);exit()
  75.  
  76. if pointer=='┴':
  77. if not direction=='up':
  78. direction='up'
  79. else: print("Error: That's not how lines work. (Line "+str(row+1)+", Column "+str(column)+")");time.sleep(1.3);exit()
  80.  
  81. if pointer=='┬':
  82. if not direction=='down':
  83. direction='down'
  84. else: print("Error: That's not how lines work. (Line "+str(row+1)+", Column "+str(column)+")");time.sleep(1.3);exit()
  85.  
  86. if pointer=='┤':
  87. if not direction=='left':
  88. direction='left'
  89. else: print("Error: That's not how lines work. (Line "+str(row+1)+", Column "+str(column)+")");time.sleep(1.3);exit()
  90.  
  91. if pointer=='├':
  92. if not direction=='right':
  93. direction='right'
  94. else: print("Error: That's not how lines work. (Line "+str(row+1)+", Column "+str(column)+")");time.sleep(1.3);exit()
  95.  
  96. if pointer=='█':
  97. if direction=='down':
  98. direction='u'
  99. if direction=='up':
  100. direction='down'
  101. if direction=='u':
  102. direction='up'
  103. if direction=='right':
  104. direction='l'
  105. if direction=='left':
  106. direction='right'
  107. if direction=='l':
  108. direction='left'
  109.  
  110.  
  111. if pointer=='&':
  112. stack+=[0]
  113.  
  114. if pointer=='+':
  115. stack[-1]+=1
  116.  
  117. if pointer=='-':
  118. stack[-1]-=1
  119.  
  120. if pointer==',':
  121. out+=chr(stack[-1])
  122. stack.pop()
  123.  
  124. if pointer=='.':
  125. out+=str(stack[-1])
  126. stack.pop()
  127.  
  128. if pointer==':':
  129. stack+=[stack[-1]]
  130.  
  131. if pointer=='$':
  132. stack.pop()
  133.  
  134. if pointer=='~':
  135. stack+=[ord(input('" ')[0])]
  136.  
  137. if pointer=='#':
  138. stack+=[int(input('# '))]
  139.  
  140. if pointer=='j':
  141. stack+=[int(str(stack[-1])+str(stack[-2]))]
  142. stack.pop(-2)
  143. stack.pop(-2)
  144. if pointer=='J':
  145. stack+=[int(str(stack[-2])+str(stack[-1]))]
  146. stack.pop(-2)
  147. stack.pop(-2)
  148.  
  149. if pointer in '^v<>' and stack[-1]>stack[-2]:
  150. if pointer=='^':
  151. direction='up'
  152. if pointer=='v':
  153. direction='down'
  154. if pointer=='<':
  155. direction='left'
  156. if pointer=='>':
  157. direction='right'
  158.  
  159. if pointer in '0123456789':
  160. stack+=[int(pointer)]
  161.  
  162. if pointer=='×':
  163. stack+=[stack[-1]*stack[-2]]
  164. stack.pop(-2)
  165. stack.pop(-2)
  166.  
  167. if pointer=='÷':
  168. stack+=[n_round(stack[-1]/stack[-2])]
  169. stack.pop(-2)
  170. stack.pop(-2)
  171.  
  172. if pointer=='=':
  173. if stack[-1]==stack[-2]:
  174. stack+=[1]
  175. else: stack+=[0]
  176.  
  177. if pointer=='p':
  178. print(out)
  179. out=''
  180.  
  181. if pointer=='%':
  182. stack+=[stack[-2]]
  183. stack.insert(-3,stack[-2])
  184. stack.pop()
  185. stack.pop()
  186.  
  187. if pointer=='g':
  188. stack+=[stack[stack[-1]]]
  189. stack.pop(-2)
  190.  
  191. if pointer=='r':
  192. stack.pop(stack[-1])
  193. stack.insert(stack[-1],stack[-2])
  194.  
  195.  
  196. if pointer=='±':
  197. move(direction)
  198. pointer=file[row][column]
  199. if pointer=='+':
  200. stack+=[stack[-1]+stack[-2]]
  201. elif pointer=='-':
  202. stack+=[stack[-1]-stack[-2]]
  203. else:print("Error: That's not how you proceed the '±' instruction. (Line "+str(row+1)+", Column "+str(column)+")");time.sleep(1.3);exit()
  204.  
  205.  
  206. if pointer=='w':
  207. time.sleep(stack[-1]/10)
  208. stack.pop()
  209.  
  210. if pointer=='q':
  211. ln=stack[-1]
  212. stack.pop()
  213. if '\n' in file[ln]:
  214. out+=file[ln][:-1]
  215. else: out+=file[ln]
  216.  
  217. if pointer == '?':
  218. direction=directions[r.randrange(1,4)]
  219.  
  220. if not pointer in '?^v<>Jjqpgrw#~$:.,-+&└┐┌┘%├┴┬┤─│┼█@0123456789×÷±=':
  221. print("Error: Where did the line go?? (Line "+str(row+1)+", Column "+str(column)+")");time.sleep(1.3);exit()
  222.  
  223. move(direction)
  224. if '*' in file:
  225. print(stack)
  226.  
  227. print(out)
  228.  
  229. time.sleep(.5)
Runtime error #stdin #stdout #stderr 0.16s 25920KB
stdin
Standard input is empty
stdout
.path: 
stderr
Traceback (most recent call last):
  File "./prog.py", line 10, in <module>
EOFError: EOF when reading a line