Refactoring Day 23
The normal intcode processor that I built doesn't seem to work for this.
This commit is contained in:
@@ -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) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user