memorize the double-room check on day two

This commit is contained in:
David 2021-12-12 13:05:45 -05:00
parent 6fe9d251bd
commit c2a087abf7
1 changed files with 2 additions and 1 deletions

View File

@ -77,7 +77,8 @@ func descend(rooms map[string]room, currentRoom string, path []string, success c
wg.Add(1)
go func(link string, path []string) {
defer wg.Done()
descend(rooms, link, path, success, canVisitSmallRoomTwice)
// in day 2, skip checks once we know we've visited a small room twice
descend(rooms, link, path, success, canVisitSmallRoomTwice && !doubleSmallAlready(newPath))
}(link, newPath)
}
}