Working on 2015-12-05 part 2
This commit is contained in:
+7
-4
@@ -11,8 +11,8 @@ seeds, *maps = open(input_f).read().split('\n\n')
|
||||
|
||||
seeds = seeds.split(':')[1].split()
|
||||
|
||||
pprint(seeds)
|
||||
pprint(maps)
|
||||
#pprint(seeds)
|
||||
#pprint(maps)
|
||||
|
||||
tmp_seeds = []
|
||||
|
||||
@@ -22,20 +22,23 @@ for i in range(0,len(seeds)-1,2):
|
||||
tmp_seeds.append(j)
|
||||
|
||||
seeds = tmp_seeds
|
||||
#print(seeds)
|
||||
|
||||
total=len(seeds)*7
|
||||
count = 0
|
||||
|
||||
for i in maps:
|
||||
tmp = []
|
||||
i = i.split()
|
||||
#print(i)
|
||||
|
||||
for ldx,l in enumerate(seeds):
|
||||
l = int(l)
|
||||
count += 1
|
||||
for x in range(2,len(i)-2,3):
|
||||
d = int(i[x])
|
||||
s = int(i[x+1])
|
||||
r = int(i[x+2])
|
||||
#print('Looking for ' + str(l) + ' in range ' + str(s) + ' > ' + str((s+r)),end='')
|
||||
print(str(round(count/total*100,2)))
|
||||
if s <= l and l < s + r:
|
||||
seeds[ldx] = d + (l - s)
|
||||
#print('. Found!')
|
||||
|
||||
Reference in New Issue
Block a user