From d98d5783cf9b108b7cf97f28955719d5df058d57 Mon Sep 17 00:00:00 2001 From: vlabayen Date: Wed, 6 Dec 2023 00:28:51 +0100 Subject: [PATCH] 2023-d5 known bugs --- vLabayen/2023/d5/d5.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vLabayen/2023/d5/d5.py b/vLabayen/2023/d5/d5.py index cebbc89..b4de96c 100644 --- a/vLabayen/2023/d5/d5.py +++ b/vLabayen/2023/d5/d5.py @@ -3,7 +3,6 @@ import re from data_models import Map, Transformation, Range - parse_seeds_rgx = re.compile('[0-9]+') def read_seeds(lines: Generator[str, None, None]) -> List[int]: return [int(seed) for seed in parse_seeds_rgx.findall(next(lines).split(':')[1])] @@ -59,6 +58,13 @@ def p2(args): print(union.start + transform.add_src2dst) return + # KNOWN BUG: If there is no mapped seeds, the loop above will not return. + # In that case, just print(min(seed_range.start for seed_range in seeds_as_ranges(seeds)) + + # KNOWN BUG: If there is an unmapped seed closer that the closest mapped seed + # We actually should get the closest mapped seed wrapping the loop above in a function, and returning instead of printing + # Then compute the closest unmapped seed, and take the min between those values + if __name__ == '__main__': import argparse parser = argparse.ArgumentParser()