From fcd169e92375c3e3369c993c22e7cbeec6ba889d Mon Sep 17 00:00:00 2001 From: FrederikBaerentsen Date: Sat, 30 Nov 2024 20:13:48 +0100 Subject: [PATCH] Started 2017/24 part 1 --- 2017/24/solution.py | 27 ++++++++++++++++++++++++++- README.md | 2 +- __pycache__/fred.cpython-311.pyc | Bin 6163 -> 6402 bytes fred.py | 4 ++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/2017/24/solution.py b/2017/24/solution.py index 4b5e09c..8d1471c 100644 --- a/2017/24/solution.py +++ b/2017/24/solution.py @@ -2,11 +2,12 @@ import sys,re from pprint import pprint sys.path.insert(0, '../../') -from fred import list2int +from fred import list2int, lprint,get_re input_f = 'test' part = 1 +log = True ######################################### # # # Part 1 # @@ -14,8 +15,32 @@ part = 1 ######################################### if part == 1: + components = [] with open(input_f) as file: for line in file: + components.append(line.rstrip()) + + lprint(components,log) + + pairs = [] + + for i in components: + t = [] + i_match = get_re(r"^(\d+)\/(\d+)$",i) + + if i_match.group(1) == '0': #can start + pairs.append([i]) + + for j in (components): + j_match = get_re(r"^(\d+)\/(\d+)$",j) + if i_match.group(2) == j_match.group(1) or i_match.group(2) == j_match.group(2): + #if i[2] == j[0] or i[2] == j[2]: + t.append(j) + pairs.append(t) + lprint(t,log) + input() + lprint(pairs,log) + diff --git a/README.md b/README.md index d4f7f77..234f6bb 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ ## 2015 >@>o>O<<>>*>>*<*>>*>@<< 6 ** - >@<@>>o<>O@>@>>>@>>o<*<<<*<<<@<< 5 * + >@<@>>o<>O@>@>>>@>>o<*<<<*<<<@<< 5 ** >*>>O>@>>>@>>@>>>o<<<*<<<@>>@<>o>O<@>>oo<<>*<<>O<<>o<< 3 ** >>O<>>o>>@o>*<<@>>*>o<<<@Ufb8CsfhvGTH6L~jip7Yr6|2A1Z}loZnm2iAvSeiidBRL z$)SRvWert9^j6eU34-FEu+W19d-I^TLh<6snN2+CKK7fLZ)Rs_=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