From d1c56fa6a5dcc024c6a1ab76f15870455592c2b2 Mon Sep 17 00:00:00 2001 From: Brandon Rozek Date: Sat, 15 Jun 2024 08:46:53 -0700 Subject: [PATCH] Parsing as regular decimal integers instead of hexadecimal. --- parse_magic.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/parse_magic.py b/parse_magic.py index 5c7b746..7cc1fe0 100644 --- a/parse_magic.py +++ b/parse_magic.py @@ -80,9 +80,8 @@ def carrier_set_from_size(size: int): def parse_size(infile: TextIO) -> Optional[int]: """ Parse the line representing the matrix size. - NOTE: Elements are represented in hexidecimal. """ - size = int(next(infile), 16) + size = int(next(infile)) if size == -1: return None assert size > 0, "Unexpected size" @@ -110,16 +109,16 @@ def parse_negation(infile: TextIO, size: int) -> Optional[ModelFunction]: def mvalue_from_index(i: int): """ - Given an index, return the hexidecimal + Given an index, return the representation of the model value. """ - return ModelValue(f"a{hex(i)[-1]}") + return ModelValue(f"a{i}") def parse_mvalue(x: str) -> ModelValue: """ Parse an element and return the model value. """ - return mvalue_from_index(int(x, 16)) + return mvalue_from_index(int(x)) def determine_cresult(size: int, ordering: Dict[ModelValue, ModelValue], a: ModelValue, b: ModelValue) -> ModelValue: """