From 41d5d9d6e9169df795616f095d9b94c610e63e2c Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Mon, 25 Dec 2017 16:51:52 +0100 Subject: [PATCH] Slightly more consise reading logic. --- 2017/day-25/solution.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/2017/day-25/solution.py b/2017/day-25/solution.py index e75b29c..0e115db 100755 --- a/2017/day-25/solution.py +++ b/2017/day-25/solution.py @@ -3,6 +3,7 @@ import fileinput import re def read_action(it): + next(it) to_write = 1 if "1" in next(it) else 0 offset = 1 if "right" in next(it) else -1 goto = next(it).strip()[-2] @@ -23,14 +24,7 @@ def read_input(): continue state = line[-2] - next(in_iter) - - if_0 = read_action(in_iter) - next(in_iter) - - if_1 = read_action(in_iter) - - states[state] = (if_0, if_1) + states[state] = (read_action(in_iter), read_action(in_iter)) return initial, runs, states