MCPcopy Create free account
hub / github.com/AxlLind/AdventOfCode / main

Function main

2018/src/18.py:31–43  ·  view source on GitHub ↗
(indata: str)

Source from the content-addressed store, hash-verified

29
30@aoc.main('18')
31def main(indata: str) -> tuple[int,int]:
32 grid = indata.split('\n')
33 p1 = resource_value(step(grid,10))
34 seen = {}
35 for i in range(1000000000):
36 grid = step(grid,1)
37 s = ''.join(''.join(row) for row in grid)
38 if s in seen:
39 left = (1000000000 - seen[s] - 1) % (i-seen[s])
40 grid = step(grid,left)
41 break
42 seen[s] = i
43 return p1, resource_value(grid)
44
45if __name__ == "__main__":
46 main()

Callers 1

18.pyFile · 0.70

Calls 2

resource_valueFunction · 0.85
stepFunction · 0.70

Tested by

no test coverage detected