appending method

This commit is contained in:
Sven Weidauer 2021-12-12 12:14:49 +01:00
parent 76784119c0
commit 0e3b825b3b

View file

@ -20,6 +20,10 @@ struct Day12: Puzzle {
struct Path {
var rooms: [Int] = []
func appending(_ room: Int) -> Path {
Path(rooms: rooms + [room])
}
}
struct Matrix {
@ -37,8 +41,7 @@ struct Day12: Puzzle {
return [continuing]
}
var current = continuing
current.rooms.append(from)
let current = continuing.appending(from)
var result: [Path] = []
for next in neighbors(of: from) {