Started 2017/24 part 1
This commit is contained in:
parent
0e83d8f589
commit
fcd169e923
@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -95,7 +95,7 @@
|
||||
## 2015
|
||||
|
||||
>@>o<O>>O<<<O>>>*>>*<*>>*<O<<o<<<O>>@<< 6 **
|
||||
>@<@<O>>>o<<O>>O<O>@>@>>>@>>o<*<<<*<<<@<< 5 *
|
||||
>@<@<O>>>o<<O>>O<O>@>@>>>@>>o<*<<<*<<<@<< 5 **
|
||||
>*>>O>@>>>@>>@>>>o<<<*<<<@>>@<<O<<<@<<O<<<< 4 **
|
||||
>>o<o<<o>>O<@>>o<o>o<<<o>>*<<<O<*>>O<<<O>>o<< 3 **
|
||||
>>O<<o<@<<<O<@>>>o>>@<o>o>*<<<o>@>>*>o<<<@<o<<< 2 **
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user