You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
431 B

package day08
import (
"log"
"github.com/jinzhu/copier"
)
func Solve2() {
for key, row := range rows {
var myRows []Operation
copier.Copy(&myRows, &rows)
if row.Operation == "jmp" {
myRows[key].Operation = "nop"
} else if row.Operation == "nop" {
myRows[key].Operation = "jmp"
}
if result := runProgram(myRows, false); result > 0 {
log.Printf("2020-12-08.02: Answer: %d\n", result)
break
}
}
}