package days import ( "fmt" "strings" u "parnic.com/aoc2019/utilities" ) type Day21 struct { program u.IntcodeProgram } func (d *Day21) Parse() { d.program = u.LoadIntcodeProgram("21p") d.program.SetDebugASCIIPrint(true) } func (d Day21) Num() int { return 21 } func (d *Day21) Part1() string { cmds := []string{ "NOT D T", "OR T J", "WALK", } instructionStr := strings.Join(cmds, "\n") + "\n" d.program.FeedInputString(instructionStr) res := d.program.Run() return fmt.Sprintf("%s%d%s", u.TextBold, res, u.TextReset) } func (d *Day21) Part2() string { return fmt.Sprintf("%s%d%s", u.TextBold, 0, u.TextReset) }