Documentation ¶
Index ¶
- func Abs(num int) int
- func ClearOutput()
- func CreateIntcodeData(line string) ([]int, error)
- func Gcd(num, num2 int) int
- func GridMinMax(area map[int]map[int]int) (int, int, int, int)
- func GridSet(area map[int]map[int]int, pos Pos2D, val int)
- func Lcm(num, num2 int) int
- func ReadFile(filename string) (string, error)
- func ReadFileLines(filename string) ([]string, error)
- func ReadFileLinesRemoveLast(filename string) ([]string, error)
- func TrimFirstChar(s string) (string, string)
- type IntcodeProgram
- type Pos2D
- type Pos3D
- type Pos4D
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateIntcodeData ¶
CreateIntcodeData get an []int for intcode from a string
func GridMinMax ¶
GridMinMax returns minX, maxX, minY, maxY
func ReadFileLines ¶
ReadFileLines reads the file lines to an array
func ReadFileLinesRemoveLast ¶
ReadFileLinesRemoveLast reads the file lines to an array and removes the last line if it's blank
func TrimFirstChar ¶
TrimFirstChar trims the first char from the string
Types ¶
type IntcodeProgram ¶
type IntcodeProgram struct {
// contains filtered or unexported fields
}
IntcodeProgram stores the intcode progrm
func NewProgram ¶
func NewProgram(line string) (*IntcodeProgram, error)
NewProgram create a new intcode program
func NewProgramFromData ¶
func NewProgramFromData(data []int) *IntcodeProgram
NewProgramFromData create a new intcode program from []int
func (*IntcodeProgram) AddInput ¶
func (p *IntcodeProgram) AddInput(data int)
AddInput adds to the input queue
func (*IntcodeProgram) GetData ¶
func (p *IntcodeProgram) GetData(index int) int
GetData Get data at the index
func (*IntcodeProgram) GetStopped ¶
func (p *IntcodeProgram) GetStopped() bool
GetStopped get if the program is really done
func (*IntcodeProgram) RemoveOutput ¶
func (p *IntcodeProgram) RemoveOutput() (int, error)
RemoveOutput removes and returns data from the output queue
func (*IntcodeProgram) Run ¶
func (p *IntcodeProgram) Run() error
Run runs the program until it needs more input or finishes
func (*IntcodeProgram) SetData ¶
func (p *IntcodeProgram) SetData(index, data int)
SetData Set data at the index