appending method
This commit is contained in:
parent
76784119c0
commit
0e3b825b3b
1 changed files with 5 additions and 2 deletions
|
@ -20,6 +20,10 @@ struct Day12: Puzzle {
|
||||||
|
|
||||||
struct Path {
|
struct Path {
|
||||||
var rooms: [Int] = []
|
var rooms: [Int] = []
|
||||||
|
|
||||||
|
func appending(_ room: Int) -> Path {
|
||||||
|
Path(rooms: rooms + [room])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Matrix {
|
struct Matrix {
|
||||||
|
@ -37,8 +41,7 @@ struct Day12: Puzzle {
|
||||||
return [continuing]
|
return [continuing]
|
||||||
}
|
}
|
||||||
|
|
||||||
var current = continuing
|
let current = continuing.appending(from)
|
||||||
current.rooms.append(from)
|
|
||||||
var result: [Path] = []
|
var result: [Path] = []
|
||||||
|
|
||||||
for next in neighbors(of: from) {
|
for next in neighbors(of: from) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue