package
0.0.0-20230826031213-3a8fa55f0bc8
Repository: https://github.com/janreggie/aoc.git
Documentation: pkg.go.dev

# Functions

InstallAdderMultiplier installs the Adder and Multiplier modules to the Intcode computer.
InstallJumpers installs the JumpIfFalse, JumpIfTrue, LessThan, and Equals modules.
IsHalt returns true if the error returned is a Halt statement.
New generates an Intcode using a memory reel.
NewFromString generates using a memory reel represented by a string.
NewHaltError returns a halt error where "from" could be any reason e.g., "program halted from HALT (99)".
NewInvalidOpcodeError returns an InvalidOpcodeError with message "invalid opcode OPCODE at position POSITION".
NewModule generates a module object with several attributes using a config struct.
NewOperationError creates an Error object that occurred due to some other error.
NewOutOfBoundsError generates an OutOfBoundsError.

# Variables

Adder is a module that adds values with support for parameterized mode.
ChangeRelativeBase adjusts the relative base of the computer by its parameter.
Equals is a module that stores 1 in the third parameter if the first equals the second; otherwise it will store 0 Memory: 8 ARG1 ARG2 ARG3 Procedure: if mem[ARG1] == mem[ARG2] then mem[ARG3]=1 else mem[ARG3]=0 pc += 4.
Halt is a module that is built in to the Intcode.
Inputter reads from the input and sets it to a specific address Memory: 3 ARG1 Procedure: mem[ARG1], err = ic.GetInput() pc += 2.
JumpIfFalse is a module that sets the instruction pointer to the second parameter if the first parameter is zero Memory: 5 ARG1 ARG2 Procedure: if mem[ARG1] == 0 then jump(mem[ARG2]) pc += 3.
JumpIfTrue is a module that sets the instruction pointer to the second parameter if the first parameter is non-zero Memory: 5 ARG1 ARG2 Procedure: if mem[ARG1] != 0 then jump(mem[ARG2]) pc += 3.
LessThan is a module that stores 1 in the third parameter if the first is less than the second; otherwise it will store 0 Memory: 7 ARG1 ARG2 ARG3 Procedure: if mem[ARG1] < mem[ARG2] then mem[ARG3]=1 else mem[ARG3]=0 pc += 4.
Multiplier is a module that adds values with support for parameterized mode.
OutputAndHalt is a module that outputs the value at its only parameter and, if non-zero, will halt immediately.
Outputter is a module that outputs the value at its only parameter.
OutputToInput is a moule that, instead of pushing its parameter to Output, it pushes the value to Input.
SimpleAdder is a simple program that adds values.
SimpleMultiplier is a simple program that adds values.

# Structs

HaltError is an error that essentially stops the Intcode from running.
Intcode implements an "Intcode" computer consisting of a program counter and a tape of memory as well as a list of "modules" which are functions that take in an Intcode and may return an error.
InvalidOpcodeError returns when the opcode being read is not valid.
Module is a module with an opcode and a ParamCount which does something to an ic computer *Intcode using the next ParamCount memory locations.
ModuleConfig is a structure representing the configuration of a module.
OperationError is an error that occurs during the operation of the Intcode computer.
OutOfBoundsError returns when accessing a memory location that is outside Intcode.mem.