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.

main.go 524B

1234567891011121314151617181920212223242526
  1. package main
  2. import (
  3. "github.com/csmith/aoc-2019/common"
  4. "github.com/csmith/aoc-2019/intcode"
  5. )
  6. func main() {
  7. input := common.ReadCsvAsInts("09/input.txt")
  8. memory := make([]int, len(input))
  9. copy(memory, input)
  10. vm := intcode.NewVirtualMachine(memory)
  11. vm.Input = make(chan int, 1)
  12. vm.Output = make(chan int, 1)
  13. vm.Input <- 1
  14. go vm.Run()
  15. println(common.Last(vm.Output))
  16. vm.Reset(input)
  17. vm.Input = make(chan int, 1)
  18. vm.Output = make(chan int, 1)
  19. vm.Input <- 2
  20. go vm.Run()
  21. println(common.Last(vm.Output))
  22. }