Skip to content

Commit

Permalink
2023-d5 known bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
vLabayen committed Dec 5, 2023
1 parent d7b21f7 commit d98d578
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion vLabayen/2023/d5/d5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])]
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit d98d578

Please sign in to comment.