15b slow version, do not use
This commit is contained in:
parent
f6fa8e6b6a
commit
07ac0b2fc5
@ -49,6 +49,27 @@ class Day15: Runnable {
|
|||||||
lastRow = parts.count - 1
|
lastRow = parts.count - 1
|
||||||
lastCol = (parts.first?.count ?? 0) - 1
|
lastCol = (parts.first?.count ?? 0) - 1
|
||||||
|
|
||||||
|
var tmpParts = parts
|
||||||
|
for (rowNum, row) in tmpParts.enumerated() {
|
||||||
|
let newRow = [Int](0...4).flatMap { cr in
|
||||||
|
row
|
||||||
|
.map { rv in cr + rv }
|
||||||
|
.map { $0 > 9 ? $0 - 9 : $0 }
|
||||||
|
}
|
||||||
|
parts[rowNum] = newRow
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpParts = parts
|
||||||
|
for num in 1...4 {
|
||||||
|
for i in tmpParts.indices {
|
||||||
|
let tr = tmpParts[i]
|
||||||
|
let ntr = tr.map { $0 + num }.map { $0 > 9 ? $0 - 9 : $0 }
|
||||||
|
parts.append(ntr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastRow = parts.count - 1
|
||||||
|
lastCol = (parts.first?.count ?? 0) - 1
|
||||||
|
|
||||||
var unvisited = Set<Coord>()
|
var unvisited = Set<Coord>()
|
||||||
// Distances to startNode
|
// Distances to startNode
|
||||||
|
Loading…
Reference in New Issue
Block a user