Debug day5/part2_time_hog.py
Now Yielding correct result, not in a timely manner, though
This commit is contained in:
parent
8b2bac0791
commit
52001b9e1f
@ -4,7 +4,7 @@ from data import extract
|
||||
import concurrent.futures
|
||||
|
||||
def seed_to_location(seed, maps):
|
||||
print(seed)
|
||||
#print(seed)
|
||||
soil_maps = list(filter(lambda soil_map: soil_map.is_mapped(seed), maps["seed-to-soil"]))
|
||||
soil = seed if soil_maps == [] else soil_maps[0].mapped_value(seed)
|
||||
fertilizer_maps = list(filter(lambda fertilizer_map: fertilizer_map.is_mapped(soil), maps["soil-to-fertilizer"]))
|
||||
@ -24,14 +24,15 @@ def seed_to_location(seed, maps):
|
||||
|
||||
def parallel_loop(seeds, maps, index):
|
||||
lowest_location = None
|
||||
for seed_idx in range(seeds[index]):
|
||||
for seed_idx in range(seeds[index + 1]):
|
||||
seed = seeds[index] + seed_idx
|
||||
location = seed_to_location(seed, maps)
|
||||
if lowest_location is not None:
|
||||
lowest_location = min(lowest_location, location)
|
||||
else:
|
||||
lowest_location = location
|
||||
seeds, maps = extract("input.txt")
|
||||
return lowest_location
|
||||
seeds, maps = extract("example_input.txt")
|
||||
print(seeds)
|
||||
|
||||
|
||||
@ -42,5 +43,5 @@ with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
|
||||
minimums.append(minimum)
|
||||
|
||||
|
||||
|
||||
minimums = map(lambda x: x.result(), minimums)
|
||||
print(min(minimums))
|
||||
|
75
q
Normal file
75
q
Normal file
@ -0,0 +1,75 @@
|
||||
[33mcommit 028c13fbba8bb94d3cad5d5d5d6509923c6be082[m[33m ([m[1;36mHEAD -> [m[1;32mmain[m[33m)[m
|
||||
Author: Fedaya <fedaya@fedaya.net>
|
||||
Date: Wed Dec 6 22:00:00 2023 +0100
|
||||
|
||||
Revert "Debugging of Day5/part2_time_hog.py"
|
||||
|
||||
This reverts commit bf7aac3b22c1e777a13674535ea4a869392acb12.
|
||||
|
||||
[33mcommit bf7aac3b22c1e777a13674535ea4a869392acb12[m
|
||||
Author: Étienne Gille <etienne.gille@ville-lespontsdece.fr>
|
||||
Date: Wed Dec 6 21:58:35 2023 +0100
|
||||
|
||||
Debugging of Day5/part2_time_hog.py
|
||||
|
||||
It now works in parallel, not in a timely manner, though
|
||||
|
||||
[33mcommit 8b2bac07914217eb8b57798e4d0f798953e8db9d[m[33m ([m[1;31morigin/main[m[33m, [m[1;31morigin/HEAD[m[33m)[m
|
||||
Author: Fedaya <fedaya@fedaya.net>
|
||||
Date: Wed Dec 6 08:12:32 2023 +0100
|
||||
|
||||
Day 6 completed
|
||||
|
||||
Day5 part 2 still ongoing
|
||||
|
||||
[33mcommit b588eeb7e5cc84aa6c61791ff7612edfc0116bb9[m
|
||||
Author: Fedaya <fedaya@fedaya.net>
|
||||
Date: Tue Dec 5 08:06:53 2023 +0100
|
||||
|
||||
First solution to part2
|
||||
|
||||
It's kind of a time hog, though
|
||||
|
||||
[33mcommit e46a2717b4c062a7d1bcf92f018a4c91538a9fcc[m
|
||||
Author: Fedaya <fedaya@fedaya.net>
|
||||
Date: Tue Dec 5 07:18:55 2023 +0100
|
||||
|
||||
Day 5 part1 completed
|
||||
|
||||
Also, deleted an example_input.txt, modified .gitignore
|
||||
added a script to get the current day's input
|
||||
|
||||
[33mcommit 9ee98d375a929dd8b690e50f4b62e8b3460fdd8b[m
|
||||
Author: Fedaya <fedaya@fedaya.net>
|
||||
Date: Mon Dec 4 07:47:34 2023 +0100
|
||||
|
||||
Modified .gitignore to not include example_input.txt
|
||||
|
||||
[33mcommit 142696bf6e92ce3e97de220f03c0b57c2b9c0f2a[m
|
||||
Author: Fedaya <fedaya@fedaya.net>
|
||||
Date: Mon Dec 4 07:44:36 2023 +0100
|
||||
|
||||
Day 4 completed
|
||||
|
||||
+ refactored day 1 to 3 with black -l 119
|
||||
|
||||
[33mcommit 97021a58b2d41f64b55e4dcb8257dd859817cd95[m
|
||||
Author: Fedaya <fedaya@fedaya.net>
|
||||
Date: Sun Dec 3 08:41:27 2023 +0100
|
||||
|
||||
Part 3 completed
|
||||
|
||||
[33mcommit fbf1c66a3968f0f300cbb6d1895e71c515278a9e[m
|
||||
Author: Fedaya <fedaya@fedaya.net>
|
||||
Date: Sat Dec 2 12:45:07 2023 +0100
|
||||
|
||||
Nouveau Repository
|
||||
|
||||
Je perd l'historique, mais ne stocke plus les fichiers input.txt
|
||||
entre autre choses
|
||||
|
||||
[33mcommit 3e06d85867ceffb21d59c949bef8049e8b0670ef[m
|
||||
Author: Fedaya <fedaya@fedaya.net>
|
||||
Date: Sat Dec 2 12:42:58 2023 +0100
|
||||
|
||||
Initial commit
|
Loading…
x
Reference in New Issue
Block a user