|
@@ -1,6 +1,7 @@
|
|
|
use "collections"
|
|
|
use "files"
|
|
|
use "format"
|
|
|
+use "itertools"
|
|
|
|
|
|
// The cardinal directions
|
|
|
primitive U
|
|
@@ -181,8 +182,7 @@ class Grid
|
|
|
|
|
|
// follow each `LinePlan` and adds the description of the wires to the grid
|
|
|
fun ref addLines(plans: Array[LinePlan]) =>
|
|
|
- var line_number: U8 = 1
|
|
|
- for plan in plans.values() do
|
|
|
+ for (line_number, plan) in Iter[LinePlan](plans.values()).enum[U8]() do
|
|
|
var start_point = Point(0, 0)
|
|
|
var dist: U64 = 1
|
|
|
for instr in plan.plan().values() do
|
|
@@ -192,7 +192,6 @@ class Grid
|
|
|
dist = dist + 1
|
|
|
end
|
|
|
end
|
|
|
- line_number = line_number + 1
|
|
|
end
|
|
|
|
|
|
// print all the intersection values along with the point they map to.
|