day 10
This commit is contained in:
parent
013aca7d41
commit
d57d8e5a0a
@ -46,14 +46,11 @@ func Part2V3(ctx aoc.Context) (out int, err error) {
|
||||
continue
|
||||
}
|
||||
|
||||
sub, err := solve(next)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
cost := candidate.ButtonsPresses + (2 * sub)
|
||||
if cost < best {
|
||||
best = cost
|
||||
if cost, err := solve(next); err == nil {
|
||||
cost = cost*2 + candidate.ButtonsPresses
|
||||
if cost < best {
|
||||
best = cost
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,12 +159,9 @@ func generateButtonsCombinations(s [][]int, joltageLen int) iter.Seq[ButtonSet]
|
||||
return
|
||||
}
|
||||
|
||||
joltages := make([]int, joltageLen)
|
||||
for pattern := range generateCombinations(buttons) {
|
||||
for i := range joltages {
|
||||
joltages[i] = 0
|
||||
}
|
||||
|
||||
joltages := make([]int, joltageLen)
|
||||
|
||||
p2 := make([]int, len(pattern))
|
||||
for i := range p2 {
|
||||
buttonIndex := pattern[i]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user