From 65c325dc96b6a864665aa310823100e1aadd6a1e Mon Sep 17 00:00:00 2001 From: Logan G Date: Tue, 5 Dec 2023 22:29:20 -0700 Subject: [PATCH] Fixed Day 5 Part 1 edge case --- day5/d5p1.gd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/day5/d5p1.gd b/day5/d5p1.gd index 619a10e..2ea70f5 100644 --- a/day5/d5p1.gd +++ b/day5/d5p1.gd @@ -60,7 +60,7 @@ func input_format(input): func is_mapped(map, input): for v in map: #if input in range(v[Column.origin], v[Column.origin]+v[Column.range]): - if input > v[Column.origin] && input < v[Column.origin]+v[Column.range]: + if input >= v[Column.origin] && input <= v[Column.origin]+v[Column.range]: return v[Column.destination] + (input-v[Column.origin]) return input @@ -76,7 +76,7 @@ func map_input(data, seed): func _init(): print("Hello!") - var temp = file_load("res://input.txt").split("\n\n") + var temp = file_load("res://sample.txt").split("\n\n") input_clean(temp) var input = input_format(temp) @@ -90,6 +90,7 @@ func _init(): var locations = [] for v in seeds: + print(v) locations.append(map_input(input, v)) print("Answer: %s" % locations.min())