computer

package
v0.0.0-...-06eecd2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Computer

type Computer struct {
	AwaitingInput bool
	OneOutput     bool
	// contains filtered or unexported fields
}

Computer represents a IntCode computer.

func New

func New(path string) *Computer

New creates a new Computer from an input text file.

func (*Computer) Compute

func (c *Computer) Compute(in <-chan int) <-chan int

Compute runs the computation of the program for a set of inputs.

func (*Computer) Dumps

func (c *Computer) Dumps() (ret string)

Dumps returns the state of the computer memory as a string which can be used by Loads().

func (*Computer) Hack

func (c *Computer) Hack(addr, val int)

Hack allows a user to alter the memory of a specified address.

func (*Computer) Loads

func (c *Computer) Loads(s string)

Loads restores a computer's memory state from a Dumps() output.

func (*Computer) Reset

func (c *Computer) Reset()

Reset restores the computer's program memory to its original state.

Jump to

Keyboard shortcuts

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