Talk:A Queue which can't grow
Jump to navigation
Jump to search
confused about / command
does / jump to the matching \ in the front or back?
for example if I give input "0;" to the program \/\|
would it ever reach |
? --Pro465 (talk) 15:12, 16 September 2023 (UTC)
In the front--ChuckEsoteric08 (talk) 16:48, 18 September 2023 (UTC)
Interpreter?
Written in python3. It has bound feature and it shows the results after each program execution.
code = input("Enter code: ") in_cond = input("Input: ") in_cond = [int(e) for e in in_cond.split(";")] bound = abs( int(input("Bound: ")) ) while bound: ip = 0 while ip < len(code): deq = in_cond[-1] if(code[ip] == "|"): in_cond = [deq+1] + in_cond[:-1] elif(code[ip] == "/"): if(deq): in_cond = [deq-1] + in_cond[:-1] else: in_cond = [0] + in_cond[:-1] nest = 1 while nest: ip += 1 if code[ip] == "/": nest += 1 elif code[ip] == "\\": nest -= 1 ip += 1 print(in_cond) bound -= 1
Written by Слон из ЖЕЛЕЗА (talk) 15:02, 18 September 2023 (UTC).