|
@@ -10,7 +10,7 @@ func next_task(status: array[26, array[27, bool]]): int =
|
10
|
10
|
var falses: array[27, bool]
|
11
|
11
|
status.find(falses)
|
12
|
12
|
|
13
|
|
-func execute(status: ptr array[26, array[27, bool]], action: int) =
|
|
13
|
+func execute(status: var array[26, array[27, bool]], action: int) =
|
14
|
14
|
status[action][0] = true
|
15
|
15
|
for i in 0..25:
|
16
|
16
|
status[i][action + 1] = false
|
|
@@ -20,7 +20,7 @@ func part1(dependencies: array[26, array[27, bool]]): string =
|
20
|
20
|
status.deepCopy(dependencies)
|
21
|
21
|
for i in 0..25:
|
22
|
22
|
var task = status.next_task
|
23
|
|
- status.addr.execute(task)
|
|
23
|
+ status.execute(task)
|
24
|
24
|
result &= chr(task + 65)
|
25
|
25
|
|
26
|
26
|
func part2(dependencies: array[26, array[27, bool]]): int =
|
|
@@ -43,7 +43,7 @@ func part2(dependencies: array[26, array[27, bool]]): int =
|
43
|
43
|
if task_times[i] <= time:
|
44
|
44
|
task_times[i] = 0
|
45
|
45
|
completed &= chr(i + 65)
|
46
|
|
- status.addr.execute(i)
|
|
46
|
+ status.execute(i)
|
47
|
47
|
else:
|
48
|
48
|
step = min(step, task_times[i] - time)
|
49
|
49
|
|