This commit is contained in:
Stefan Harmuth 2024-11-30 11:26:58 +01:00
parent 8910705d2e
commit 2c9c027eb1
6 changed files with 42 additions and 14 deletions

5
.gitignore vendored
View File

@ -160,3 +160,8 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
answer_cache.json
.session
session.cookie
.aoc_tiles/*
!.aoc_tiles/tiles/

16
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,16 @@
repos:
- repo: https://github.com/LiquidFun/aoc_tiles
rev: 0.6.2
hooks:
- id: aoc-tiles
# Optionally use these arguments. Auto add tiles to git adds the tiles to git,
# possibly amends your commit by creating the tile images and updating the README.
# Language sorting shows the preference of the order of the languages to use.
# Exclude paterns are globs which can be used to exclude files when creating
# the tiles. See the customization section in the README for more flags.
# Simply remove the comments (#) below for args and the flags you want.
args:
- --auto-add-tiles-to-git=amend
- --contrast-improvement-type=dark
# - --language-sorting=py,jl,kt,rs
# - --exclude-patterns=2021/*/*.apl,2021/*/*.py,2021/*/*.cpp

View File

@ -1 +1,4 @@
# aoc2ß23
# Advent of Code 2ß23
<!-- AOC TILES BEGIN -->
<!-- AOC TILES END -->

View File

@ -70,19 +70,21 @@ class Day(AOCDay):
print(f"{i} = {t}")
for i in [Coordinate(0, 0), Coordinate(130, 0), Coordinate(0, 130), Coordinate(130, 130)]:
t = walk(grid, i, 65)
t = walk(grid, i, 131)
print(f"{i} = {t}")
needed_steps = 5000 if self.is_test() else 26501365
t = walk(grid, start, 64)
t = walk(grid, start, 65)
k = walk(grid, start, len(self.getInput()) + 65)
g = walk(grid, start, 2 * len(self.getInput()) + 65)
# v = walk(grid, start, (3 * len(self.getInput())) - 1)
print(f"65={t}, 196={k}, 327={g}, {math.log(k)=}, {math.log(g)=}")
print(((k - t) / 14746) * 3)
print((g - t) / 14746)
print((g - k) / 14746)
print(g % k)
print(k / t)
w2 = walk(grid, start, 2 * len(self.getInput()) + 65)
w3 = walk(grid, start, 3 * len(self.getInput()) + 65)
w4 = walk(grid, start, 4 * len(self.getInput()) + 65)
w5 = walk(grid, start, 5 * len(self.getInput()) + 65)
w6 = walk(grid, start, 6 * len(self.getInput()) + 65)
print(f"65={t}, 196={k}, {w2=}, {w3=}, {w4=}, {w5=}, {w5=}")
print(w3 / w2)
print(w4 / w3)
print(w5 / w4)
print(w6 / w5)
return ""

View File

@ -1,3 +1,4 @@
from collections import defaultdict
from itertools import combinations
from tools.aoc import AOCDay
from tools.coordinate import Coordinate, Line
@ -29,7 +30,7 @@ class Day(AOCDay):
[
(47, "input24_test"),
(None, "input24"),
]
],
]
def parse_input(self, part2: bool = False) -> list[tuple[Coordinate, Coordinate]]:
@ -63,6 +64,6 @@ class Day(AOCDay):
return ""
if __name__ == '__main__':
if __name__ == "__main__":
day = Day(2023, 24)
day.run(verbose=True)

View File

@ -1 +1,2 @@
shs-tools ~= 0.3
pre-commit