Refactoring Day 23

The normal intcode processor that I built doesn't seem to work for this.
This commit is contained in:
2020-11-04 08:01:21 -06:00
parent d4a45d2b67
commit f6e0792525
3 changed files with 135 additions and 5 deletions

View File

@@ -1,11 +1,9 @@
package main
import (
"fmt"
"time"
intcode "git.bullercodeworks.com/brian/adventofcode/2019/intcode-processor"
//helpers "git.bullercodeworks.com/brian/adventofcode/helpers"
)
func main() {
@@ -19,6 +17,15 @@ func main() {
}
func part1(prog []int) {
p := intcode.NewProgram(prog)
n := StartNetwork(*p)
for !n.CrashOverride {
time.Sleep(1)
}
}
/*
func part1o(prog []int) {
var network []*intcode.Program
msgQueue := make([][]int, 255)
for k := 0; k < 50; k++ {
@@ -30,7 +37,7 @@ func part1(prog []int) {
for !network[addr].NeedsInput() {
time.Sleep(1)
}
network[addr].Input(0)
network[addr].Input(addr)
for {
if !network[addr].NeedsOutput() && !network[addr].NeedsInput() {
time.Sleep(1)
@@ -58,6 +65,7 @@ func part1(prog []int) {
}
fmt.Println(msgQueue[255])
}
*/
func part2(prog []int) {
}