intcode

package module
v0.0.0-...-1e51dd0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2019 License: GPL-3.0 Imports: 2 Imported by: 0

README

intcode

Advent of code intcode machine

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Machine

type Machine struct {
	Position         int
	Memory           map[int]int
	Input            []int
	Name             string
	RelativeBase     int
	InstructionCount int
}

Machine is a running environment for an intcode program.

func NewMachine

func NewMachine(m map[int]int) *Machine

NewMachine returns an initialized intcode machine.

func (*Machine) Clone

func (m *Machine) Clone() Machine

Clone provides a clone of the current machine with all the code and positions kept in tact.

func (*Machine) ProcessProgram

func (m *Machine) ProcessProgram() (out []int, done bool)

ProcessProgram will run an intcode.

func (*Machine) Reset

func (m *Machine) Reset()

Reset the machine to zero state.

func (Machine) String

func (m Machine) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL