From e6c7f036b0fb648e6aa5e3fa4618524ac1c024ab Mon Sep 17 00:00:00 2001 From: Maxim Slipenko <36362599+Maks1mS@users.noreply.github.com> Date: Tue, 28 Sep 2021 09:59:03 +0300 Subject: [PATCH] fix action unpack fix action unpack if new_symbol is same as direction (<.>) --- turinglab/input.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/turinglab/input.py b/turinglab/input.py index 2ace6b9..3ad1693 100644 --- a/turinglab/input.py +++ b/turinglab/input.py @@ -20,8 +20,8 @@ def from_file(filename: str): if not action: continue - new_symbol, direction, new_state = re.split('([<|>|.])', action) - new_state = int(new_state) - 1 + new_symbol, direction, *new_state = action + new_state = int(''.join(new_state)) - 1 movement = { '>': Movemement.R, @@ -31,8 +31,6 @@ def from_file(filename: str): program.set(i, symbol, Action(new_state, new_symbol, movement)) - # program[symbol][i] = ([new_symbol, direction, new_state]) - f.close() return program