From 6b733982f9f240c1c97f1fa705bfbe4cd93c640e Mon Sep 17 00:00:00 2001 From: mhsn Date: Fri, 12 Sep 2025 20:20:58 +0100 Subject: simplify python file structure --- 2024/10/python/main.py | 41 ----------------------------------------- 2024/10/python/pyproject.toml | 6 ------ 2 files changed, 47 deletions(-) delete mode 100644 2024/10/python/main.py delete mode 100644 2024/10/python/pyproject.toml (limited to '2024/10/python') diff --git a/2024/10/python/main.py b/2024/10/python/main.py deleted file mode 100644 index 4e85b49..0000000 --- a/2024/10/python/main.py +++ /dev/null @@ -1,41 +0,0 @@ -from fileinput import input - -grid = [[int(c) for c in line.strip()] for line in input()] - -starts = { - (idx, idy) for idy, line in enumerate(grid) for idx, n in enumerate(line) if n == 0 -} - -# print(*grid, sep="\n") -# print(starts) - - -def score_trailhead(start, gold): - score = 0 - q = [start] - seen = set() - while q: - x, y = q.pop() - seen.add((x, y)) - - h = grid[y][x] - if h == 9: - score += 1 - continue - for dx, dy in [(0, 1), (0, -1), (1, 0), (-1, 0)]: - nx, ny = x + dx, y + dy - if ((nx, ny) in seen and not gold) or not ( - 0 <= nx < len(grid) and 0 <= ny < len(grid[0]) - ): - continue - - if grid[ny][nx] == h + 1: - q.append((nx, ny)) - return score - - -silver = sum(score_trailhead(start, False) for start in starts) -gold = sum(score_trailhead(start, True) for start in starts) - -print("silver:", silver) -print("gold:", gold) diff --git a/2024/10/python/pyproject.toml b/2024/10/python/pyproject.toml deleted file mode 100644 index 8458dc5..0000000 --- a/2024/10/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-10" -version = "0.1.0" -description = "advent of code 2024-10" -requires-python = ">=3.13" -dependencies = [] -- cgit v1.2.3