protocode

package
v0.0.0-...-4d3da1a Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugNone = DebugMode(iota)
	DebugInfo
	DebugVerbose
)
View Source
const (
	NOP      = "nop"
	ACC      = "acc"
	JMP      = "jmp"
	ADD      = "add"
	MUL      = "mul"
	IN       = "in"
	OUT      = "out"
	NON_ZERO = "ifnz"
	ZERO     = "ifz"
	LT       = "lt"
	EQ       = "eq"

	EOF = "eof"
)
View Source
const (
	ModePosition = ParameterMode(iota)
	ModeImmediate
	ModeRelative
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugMode

type DebugMode int

type Instruction

type Instruction struct {
	Opcode string
	Params []int
	Used   int
}

type ParameterMode

type ParameterMode int

type ProtoCode

type ProtoCode struct {
	Name                     string
	Memory                   map[int]*Instruction
	Cursor                   int
	IgnoreNonAddressedMemory bool
	DebugMode                DebugMode
	Acc                      int
	ExitCondition            func(c *ProtoCode) bool
	// contains filtered or unexported fields
}

func New

func New(puzzle string) *ProtoCode

New copy the intcode memory before creating a new IntCode object.

func (*ProtoCode) Reset

func (c *ProtoCode) Reset()

func (*ProtoCode) Run

func (c *ProtoCode) Run() int

Run the IntCode program

func (*ProtoCode) String

func (c *ProtoCode) String() string

Jump to

Keyboard shortcuts

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