From 543b0b7e825157d3fe272580e06a189759170b89 Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Sun, 3 Dec 2023 16:07:42 -0500 Subject: [PATCH] keeping track of which symbol --- 2023/python/day03.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/2023/python/day03.py b/2023/python/day03.py index 0af1f2f..05b9802 100644 --- a/2023/python/day03.py +++ b/2023/python/day03.py @@ -29,7 +29,7 @@ def part1(mat): choose = [] nums = get_all_numbers_and_starting_coords(mat) for coords, num in nums: - valid = process_number(mat, coords, num) + valid, symbol_coord = process_number(mat, coords, num) if valid: choose.append(num) total = 0 @@ -41,10 +41,10 @@ def part1(mat): def process_number(mx, coords, num): line_coords = get_row_coords(*coords, len(num)) for coord in line_coords: - any_symbols = [v for _,v in matrix.get_neighbor_coords(mx, *coord) if v in SYMBOLS] + any_symbols = [(cs, v) for cs,v in matrix.get_neighbor_coords(mx, *coord) if v in SYMBOLS] if any_symbols: - return True - return False + return True, any_symbols[0] + return False, None # @shared.profile