[Solved] Command not working in an interpreter I made


This isn’t working because you’re using globals. When you hit if tape[selectedCell] == int(''.join(num)): for the third if statement, nums contains ['1', '1'] because both if statements have added a 1 to num, so when you do int(''.join(num)) you end up with 11 which is not equal to 1.

You need to refactor this code to stop using globals. For a working example of how to not use globals to represent a stack, take a look at the esolang I wrote a couple months back. It’s not as finished as I’d like, but it has a working stack without globals.

7

solved Command not working in an interpreter I made