fork download
  1. import random as r
  2. out=''
  3. file=open(input('.mm: ')+'.mm','r').readlines();import time;import os;cls=lambda:os.system('cls'if os.name in ('nt','dos')else'clear');row=0;column=0;pointer='';directions=['up','down','left','right'];direction='down';stack=[0]
  4. def move(d):
  5. global row, column
  6. if d=='down':row+=1
  7. if d=='left':column-=1
  8. if d=='right':column+=1
  9. def process(d):
  10. global row, column, direction, stack, out
  11. #print(str(column)+', '+str(row))
  12. #print(stack)
  13. #print(out)
  14. try:
  15. pointer=file[row][column]
  16. direction='down'
  17. if pointer=='\\':
  18. if direction=='down':
  19. direction='right'
  20. if pointer=='/':
  21. if direction=='down':
  22. direction='left'
  23. if pointer in '0123456789':
  24. stack+=[int(pointer)]
  25. if pointer=='#':
  26. stack+=[int(input('> '))]
  27. if pointer=='?':
  28. stack+=[ord(input('> '))]
  29. if pointer=='g':
  30. if stack[-1]>stack[-2]:
  31. stack+=[True]
  32. else: stack+=[False]
  33. if pointer=='{':
  34. if stack[-1]==True:
  35. direction='left'
  36. else: direction='right'
  37. if pointer=='}':
  38. if stack[-1]==True:
  39. direction='right'
  40. else: direction='left'
  41. if pointer=='~':
  42. stack=stack[:-1]
  43. if pointer=='.':
  44. print(stack[-1])
  45. if pointer=='&':
  46. stack[-1],stack[-2]=stack[-2],stack[-1]
  47. if pointer=='+':
  48. stack+=[stack[-2]+stack[-1]]
  49. if pointer=='-':
  50. stack+=[stack[-2]-stack[-1]]
  51. if pointer=='*':
  52. stack+=[stack[-2]*stack[-1]]
  53. if pointer=='`':
  54. stack+=[stack[-2]/stack[-1]]
  55. if pointer=='x':
  56. while not file[row][column]=='o':
  57. row-=1
  58. return
  59. if pointer==',':
  60. out+=chr(stack[-1])
  61. if pointer=='!':
  62. time.sleep(9999*9998*9997);exit()
  63. if pointer=='"':
  64. move(direction)
  65. stack+=[ord(file[row][column])]
  66. if pointer=='p':
  67. print(out)
  68. out=''
  69. if pointer=="'":
  70. stack+=(ord(x) for x in str(stack[-1]))
  71. except:
  72. exit()
  73. move(direction)
  74. cls()
  75. while True:
  76. process('down')
  77. print(out)
Runtime error #stdin #stdout #stderr 0.14s 26136KB
stdin
Standard input is empty
stdout
.mm: 
stderr
Traceback (most recent call last):
  File "./prog.py", line 4, in <module>
EOFError: EOF when reading a line