intcode

package
v0.0.0-...-abdf023 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpAdd      = 1
	OpMul      = 2
	OpInput    = 3
	OpOutput   = 4
	OpJnz      = 5
	OpJz       = 6
	OpLessThan = 7
	OpEquals   = 8
	OpBase     = 9
	OpDone     = 99
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IntCode

type IntCode struct {
	// contains filtered or unexported fields
}

func NewIntCode

func NewIntCode(p []int64, input []int64) *IntCode

func NewIntCodeFromASCII

func NewIntCodeFromASCII(p []int64, ascii string) *IntCode

func (*IntCode) Addr

func (ic *IntCode) Addr(op OpCode, i int) int

func (*IntCode) Done

func (ic *IntCode) Done() bool

func (*IntCode) ForkWithInput

func (ic *IntCode) ForkWithInput(input int64) *IntCode

func (*IntCode) In

func (ic *IntCode) In(inputs ...int64)

func (*IntCode) InStr

func (ic *IntCode) InStr(input string)

func (*IntCode) NextOutput

func (ic *IntCode) NextOutput() int64

func (*IntCode) Out

func (ic *IntCode) Out(n int) []int64

func (*IntCode) OutLen

func (ic *IntCode) OutLen() int

func (*IntCode) Param

func (ic *IntCode) Param(op OpCode, i int) int64

func (*IntCode) Run

func (ic *IntCode) Run() RunExitStatus

func (*IntCode) RunToHalt

func (ic *IntCode) RunToHalt() []int64

func (*IntCode) String

func (ic *IntCode) String() string

type OpCode

type OpCode int64

func (OpCode) Mode

func (o OpCode) Mode(i int) ParamMode

func (OpCode) NoMode

func (o OpCode) NoMode() OpCode

type ParamMode

type ParamMode int
const (
	PositionMode  ParamMode = 0
	ImmediateMode ParamMode = 1
	BaseMode      ParamMode = 2
)

type RunExitStatus

type RunExitStatus int
const (
	Finished RunExitStatus = iota
	FinishedOpError
	NeedInput
	ProducedOutput
)

Jump to

Keyboard shortcuts

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