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

Function step

2018/src/13.py:18–27  ·  view source on GitHub ↗
(crosses: dict[tuple[int,int],str], carts: list[list[int]])

Source from the content-addressed store, hash-verified

16 return [r+DR[d],c+DC[d],d,t]
17
18def step(crosses: dict[tuple[int,int],str], carts: list[list[int]]) -> list[int]:
19 carts.sort()
20 crashes = set()
21 for i in range(len(carts)):
22 r,c,d,t = move_cart(crosses, carts[i])
23 for j in range(len(carts)):
24 if carts[j][0] == r and carts[j][1] == c:
25 crashes |= {i,j}
26 carts[i] = [r,c,d,t]
27 return sorted(crashes)
28
29@aoc.main('13')
30def main(indata: str):

Callers 1

mainFunction · 0.70

Calls 1

move_cartFunction · 0.85

Tested by

no test coverage detected