aboutsummaryrefslogtreecommitdiff
path: root/2019
diff options
context:
space:
mode:
Diffstat (limited to '2019')
-rw-r--r--2019/eight.go87
-rw-r--r--2019/five.go131
-rw-r--r--2019/four.go68
-rw-r--r--2019/input/eight.txt1
-rw-r--r--2019/input/five.txt1
-rw-r--r--2019/input/four.txt1
-rw-r--r--2019/input/nine.txt1
-rw-r--r--2019/input/one.txt100
-rw-r--r--2019/input/seven.txt1
-rw-r--r--2019/input/six.txt1107
-rw-r--r--2019/input/ten.txt20
-rw-r--r--2019/input/three.txt2
-rw-r--r--2019/input/two.txt1
-rw-r--r--2019/nine.go166
-rw-r--r--2019/one.go40
-rw-r--r--2019/seven.go141
-rw-r--r--2019/six.go25
-rw-r--r--2019/ten.go47
-rw-r--r--2019/three.go156
-rw-r--r--2019/two.go66
20 files changed, 2162 insertions, 0 deletions
diff --git a/2019/eight.go b/2019/eight.go
new file mode 100644
index 0000000..74be0e1
--- /dev/null
+++ b/2019/eight.go
@@ -0,0 +1,87 @@
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "os"
+ "strconv"
+)
+
+func main() {
+ if len(os.Args) < 2 {
+ panic("runtime error: missing operand")
+ }
+ file, err := ioutil.ReadFile(os.Args[1])
+ if err != nil {
+ panic(err)
+ }
+ image := sliceify(file, 25, 6, len(file)/(25*6))
+
+ checksum(image)
+ decode(image)
+}
+
+func sliceify(file []byte, width int, height int, depth int) [][][]int {
+ var image [][][]int
+ pointer := 0
+
+ for i := 0; i < depth; i++ {
+ var b [][]int
+ for j := 0; j < height; j++ {
+ var a []int
+ for k := 0; k < width; k++ {
+ element, err := strconv.Atoi(string(file[pointer]))
+ if err != nil {
+ panic(err)
+ }
+ a = append(a, element)
+ pointer++
+ }
+ b = append(b, a)
+ }
+ image = append(image, b)
+ }
+ return image
+}
+
+func count(layer [][]int, val int) int {
+ total := 0
+ for i := 0; i < len(layer); i++ {
+ for j := 0; j < len(layer[i]); j++ {
+ if layer[i][j] == val {
+ total++
+ }
+ }
+ }
+ return total
+}
+
+func checksum(image [][][]int) {
+ min := count(image[0], 0)
+ layer := -1
+ for i := 0; i < len(image); i++ {
+ total := count(image[i], 0)
+ if total < min {
+ min = total
+ layer = i
+ }
+ }
+ fmt.Println(count(image[layer], 1) * count(image[layer], 2))
+}
+
+func decode(image [][][]int) {
+ for i := 0; i < len(image[0]); i++ {
+ for j := 0; j < len(image[0][0]); j++ {
+ for k := 0; k < len(image); k++ {
+ if image[k][i][j] == 0 {
+ fmt.Print(" ")
+ break
+ } else if image[k][i][j] == 1 {
+ fmt.Print("X")
+ break
+ }
+ }
+ }
+ fmt.Println()
+ }
+}
diff --git a/2019/five.go b/2019/five.go
new file mode 100644
index 0000000..9ea4699
--- /dev/null
+++ b/2019/five.go
@@ -0,0 +1,131 @@
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "os"
+ "strconv"
+)
+
+func main() {
+ var memory []int
+ start, size := 0, 0
+ if len(os.Args) < 2 {
+ panic("runtime error: missing operand")
+ }
+ file, err := ioutil.ReadFile(os.Args[1])
+ if err != nil {
+ panic(err)
+ }
+ for i := 0; i < len(file); i++ {
+ if file[i] == ',' || file[i] == '\n' {
+ arg, err := strconv.Atoi(string(file[start:i])) // i-1??
+ if err != nil {
+ panic(err)
+ }
+ memory = append(memory, arg)
+ start = i + 1
+ size++
+ }
+ }
+
+ // fmt.Println(execute(memory, size))
+ // noun, verb := etucexe(memory, size, 19690720)
+ // fmt.Println(100*noun + verb)
+ execute(memory, size)
+}
+
+func split(memory []int, i, size int) (int, int, int) {
+ mode := memory[i] / 100
+ three, two, one := i+3, i+2, i+1
+ if size-i > 1 {
+ if mode%10 == 0 {
+ one = memory[i+1]
+ }
+ if size-i > 2 {
+ if mode/10%10 == 0 {
+ two = memory[i+2]
+ }
+ if size-i > 3 {
+ if mode/100 == 0 {
+ three = memory[i+3]
+ }
+ }
+ }
+ }
+ return three, two, one
+}
+
+func execute(memory []int, size int) []int {
+ for i := 0; i < len(memory); {
+ opcode := memory[i] % 100
+ three, two, one := split(memory, i, size)
+ switch opcode {
+ case 1: // adds
+ memory[three] = memory[one] + memory[two]
+ i += 4
+ case 2: // multiplies
+ memory[three] = memory[one] * memory[two]
+ i += 4
+ case 3: // input
+ var input int
+ fmt.Print("Input: ")
+ resp, err := fmt.Scanf("%d", &input)
+ if err != nil {
+ fmt.Println(resp, err)
+ os.Exit(0)
+ }
+ memory[one] = input // not affected by modes
+ i += 2
+ case 4: // output
+ fmt.Println(memory[one])
+ i += 2
+ case 5: // jump-if-true
+ if memory[one] != 0 {
+ i = memory[two] // ???
+ } else {
+ i += 3
+ }
+ case 6: // jump-if-false
+ if memory[one] == 0 {
+ i = memory[two] // ???
+ } else {
+ i += 3
+ }
+ case 7: // less than
+ if memory[one] < memory[two] {
+ memory[memory[i+3]] = 1
+ } else {
+ memory[memory[i+3]] = 0
+ }
+ i += 4
+ case 8: // equals
+ if memory[one] == memory[two] {
+ memory[memory[i+3]] = 1
+ } else {
+ memory[memory[i+3]] = 0
+ }
+ i += 4
+ case 99: // terminate
+ return memory
+ default:
+ fmt.Println("Unsupported code", opcode, "at", i)
+ os.Exit(0)
+ }
+ }
+ return memory
+}
+
+func etucexe(memory []int, size, output int) (int, int) {
+ var volatile []int
+ for i := 0; i < len(memory); i++ {
+ for j := 0; j < len(memory); j++ {
+ volatile = append([]int(nil), memory...) // reset volatile to memory
+ volatile[1], volatile[2] = i, j
+ if execute(volatile, size)[0] == output {
+ return i, j
+ }
+ }
+ }
+ return -1, -1
+}
diff --git a/2019/four.go b/2019/four.go
new file mode 100644
index 0000000..7c901dc
--- /dev/null
+++ b/2019/four.go
@@ -0,0 +1,68 @@
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "math"
+ "os"
+ "strconv"
+)
+
+func main() {
+ smallest, largest, total, details := -1, -1, 0, 0
+ if len(os.Args) < 2 {
+ panic("runtime error: missing operand")
+ }
+ file, err := ioutil.ReadFile(os.Args[1])
+ if err != nil {
+ panic(err)
+ }
+ for i := 0; i < len(file); i++ {
+ if string(file[i]) == "-" {
+ smallest, err = strconv.Atoi(string(file[0:i]))
+ if err != nil {
+ panic(err)
+ }
+ largest, err = strconv.Atoi(string(file[i+1 : len(file)-1]))
+ if err != nil {
+ panic(err)
+ }
+ break
+ }
+ }
+
+ for i := smallest; i <= largest; i++ {
+ if criteria(i, false) {
+ total++
+ }
+ if criteria(i, true) {
+ details++
+ }
+ }
+ fmt.Println(total)
+ fmt.Println(details)
+}
+
+func criteria(password int, stage bool) bool {
+ prev := 0
+ for i := 0; i < 6; i++ {
+ if password/int(math.Pow(10, float64(5-i)))%10 < prev {
+ return false
+ }
+ prev = password / int(math.Pow(10, float64(5-i))) % 10
+ }
+ pascii := strconv.Itoa(password)
+ for i := 0; i < len(pascii)-1; i++ {
+ if string(pascii[i]) == string(pascii[i+1]) {
+ if !(len(pascii)-i > 2 && string(pascii[i]) == string(pascii[i+2])) {
+ if !stage { // Gross hack
+ return true
+ }
+ if !(i > 0 && string(pascii[i]) == string(pascii[i-1])) {
+ return true
+ }
+ }
+ }
+ }
+ return false
+}
diff --git a/2019/input/eight.txt b/2019/input/eight.txt
new file mode 100644
index 0000000..046a733
--- /dev/null
+++ b/2019/input/eight.txt
@@ -0,0 +1 @@
+221222222022222222222222020222222222022220012102002220222222222222222222220122202222022122222222220212222122222222222222222202221222222222102222212222220222222222222222222222220222222222022220222102122220222222222222222222222122212222122122222222220202222222222222222222222212220222222222002222222222222222222122222222222222121222222222222220012202222221222222222222222222221122212222122222222222222202222222222222222222222222221222222222002222202222222222022222222222222222220222122222122221202102112222222222222222222222220022212022022222222222222212222022222222222222222202221022222222022222202222220222122022222222222222222222122222122220012002022221222222222222222222221222202022022122222222222222222022222222222222222222220022222222222222202222222222222022222222222222222222222222022222122122222221222222222222222222222222212122122122222222220222222122202222222222222222220222222222002222222222221222122022222222222222220222222222122221122022022221222222222222222222220222212122122122222222222202222222212222222222222202221220222222022222202222220222222222222222222222220222122222222222012012012220222222222222222222222022222222222022222222221212222122212222222222222202222021222222102222202222220222122222222222222222221222122222122220212112222220222220222222222222221022202222022022222222220202222122202222222222222212222221222222122222212222220222222222222222222221222222022222222221102102222221222222222222222222221022212122222022222222222202222222202222222222222222222220212222222222222222220222022222222222222220122222022222122220112022222220222222222222222222221022202222122122222122220222222022212222212222222222220220202222012222202222220122022122222222222221220222122222022221212102202221222221222222222222220122222022122122222222222222222222222222202220222212122121212222102222222222212222022022222222221222120222022222122220112002202220222220222222222222202222222122022122222122220212222122222222212221222202220222222222002222222222220122022222222222222220120222122222022222122212002222222221222222222222210222212222122222222121222202222122222222202220222202121222222222102222212222220022122022222222220222022222222222122222212222202222222220222222222222212022222122022022222121220212222222222220002222222212121221212222202222202222212222122022222222221222220222222222122222102112012221222222222222222222221122212122122222222221221222222122212221122220222212122221202222112222222222222022022222222222221220122222022222222220122202202220222222222222222222212222212122022122222021221202222222202221022222222202022220212222202222222222200022022222222222220221022222222222022221002222022220222221222222222222221222222222222122222222222202222122212221012220222211222021222222102222222222212122122122222222220220221222222222022221202222102220222221222222222222211122202122022122222220221212222222202222112221222201222121202222022222222222200122222222222222221221221222222222122221012112212222222222222222222222212222202222222122220220220212222122202221212221222221021222222222002222202222201222222122222222222220222222122222222222002022212222222220222222222222201122202022022022220220222202222222222220112221222212121120202222022222202222221022222222222222222221022222222222022220102102222221222222222222222222211222202122022022222021220222222122212220022221222220222220222222212222202222211122022222222222222221220222222222122220122202102220222222222222222222220122212222122122220122220202222122222220212221222220121022212222000222222222212022122222222222221221122222222222122222202202102220222220220222221222211022222022022222220020220212222022212220120221122200221220202222022222202222220122022022222222200220220222122222122222012212202222222221220222220022201122202222122222220121221222222022202221121220222200220222212222220222212222222122122222222222222222222222222222222221122122022220022220221222220022211222202222122122222122220222222022212220100220022220222222222222101222222222210122222222222222200222020222122222122220012002022220222220221222221122211022212222222122220021220202222222212221100221122221221120202222212222212222201022222022222222202220122222022222122221222122002222022221221222222222200222222122122122220020221222222122212221020220022211220121202222101222212222210122022022222222200222220222222222022220012012022221122221222222220222212022202122122122220120222202222222222222010220022211221122022222210222212222220222122222222222221222022222022222022222022112022222122221221222220222201122202222022222222222222202222222212222000221022212022120202222012222222222212122122022222222212221022222022222122221102202102220122220220222220022222222222122022122221121222212222122202220120212222211022021112222212222222222201222022022222222212221221222222222222222012122102222122220222222221022202022222222022022220021221202222222202222201212122211222221222222222222212222201022122122222222200221121222122222122222002202102220222220220222222122201222212022222122220122221222222022212222212201022222121122222222100222202222212022122222222222210220022222022222222221122002222220122220221222222222222122212122122022222121220222222222202220010211022212121021002222202222012222222122122022222222220222022222122222022221002112202220222221221222220022210022222122022022221222221212222122202222202210022220122120112222002222102222220122122022222222201222221222022222022221112112102220222222220222221222220122212122122122221122221212222122212221120202122210120220102222221222012222202122022022222222211222121222022222022221122222122221222222201222222022221022212122122222220222221202222222222220110222022201121222202222211222202222211222122122222222211221021222122222122220112122002222222221202222220022201122202222222122222022222202222222222222101212222220221221122222021222012222200222122122222222201221022222122222022220012002002221122220222222220022212222212222222222220220021212222122222220001201022222122022122222110222202222221222222022222222202222220222022222022222002102222222022222221222222222201122212022022022220220120202222122222222211200122200020222212222222222022222200222222022222222201221120222222222022222122112012222122220211222222022200122212022122122221222020202222022212221012202122201222122122222220222102222220122222022222222210221122222022222202220002102112222222221202222222222211022222022222022220220220202222122222222101222022212122121102222110222122222212122122122222222212220121222022222122221002222202220122221220222221022212022212022122222221022122212222122212222220202122220120022122222201222112222210122222022222222221221221222222222102222222012122222222222212222220022202222022222222122221020122202222222222222102220122210120122002222212222202222201122122122222222201221220222222202112222202102002222022222211221221022222122212022222222221120220212022022212222222221022212221221122222211222222222200022122022222222222221122222222212122221012122012222022220212220222222222122212122122022221121220222222222202222110202002220120021122222110222202122210022022022222222201221222222122212212220002122002120122221221222221122201022202222022222221020021212222222202220002210112220220221102222211222212022220122222222222222200220020222122202012221112102102022122222200201222122210022122022022022221220222202122122202222211222212202022120012222101222002122201122022222222222222220122222022202212221022112202220122220221201221022210222202122022222220022222202122222222221120202022222020022122222202222212022202122222212222222221221220222022212122220022002022021122222212212221022201222112122022022222122220212122022222220001211202220220021212222001222122122210022122002222222221222121222122222102222222202002222122220200211221022202222112022022022220122221212022222222222002200022211122022222222222222202122202122022012222220222222121222220222212221002112222222122220202220221122221222201022222222221220120202122022202222200201012211022022102222100222122122202222222102222220202221022222220212002221202102012022212220201202222022210022022022122222220020020202222122212221222011002211120122122222021222022122201222122002222222200222222222220222202221122022102021221221212212221122210122022122022122222020022222122022222221210012112222221221202222200222212022220122222212222221221220121222221112022221102202212220112220220220221022222022220222022222222020020212222222212220210002022200220122222222212222122220202122222122222221200220121222221202222221112222122021210222220212220122211122020222022122220220220222122022202220012111102212120120102222022222022221221222222022222221221220221222122002102221202202022022210220220220221022200022022122122222221021021222022122212222202101022211221122002222121222222121212222222222202220222220121222020202222221112022012022112221211222222122202222212122122122220022122212022122212222021220122222122120212222022222202022200122022202212220201221120222121122012220212002002221001222202200221022202222112222122222220122220202022022222221012002202201022120122222010222022021201022222012202221212221221222221112222222112102202120102220201210221022201022122122012222221021022222222122212221122002212201121021202222112222022120220122022012212220202222021222121112222222122002112121011220210222220122210222010022022122221021122212222020222222102210212200222022022222021222112221222222122102212220211221022222022212212220112002102021120220210211222222221122111122002022222221021222022221202222012222012221222021112222021222022221200122222212222222221221020222222022212220122222122120112222211221220022222122102222202222222021020212222121212220002002222220121020202222101222122120100222122102202220211222120222120212202221212102202220012221202222221022222222202121022022222220222212222020222221121011112220011022022222200222012220110222122002202221221221120222021202012221022002022021010221221202222022200022011221002122220222020222022122222220220020212201202022122222222222202221110022222212212222201221010222021222122222002202122221110220200212222222201022000220012222221222221212222121202222100211002222200021212222111222212022201122022112212221210222102222021112202220022012122020120210211201220122202122000020002022221022220212022222212221011222022220011021022222210222202120222022022002212202210222020222120022202222102022212122210222201220222222200122212220022022220122221222122022212221001000012222120220102222220222102022110122222122222201122222121222021012212221112102222220110200220222222222200020202121122022222222220202222022222222221010222210101020102222212222212021102022222202222221012220010222021002012220112222212122011211201201221222222120112222222122221020020202122221222222221010022201022222122222221222122020211222221212212200002212000222222012102221122022222121000200212201222022212021011120012222220120022212022120202220201100112222220221102222021222112211122222122022222212011200110222222102002222122202222220222211210200220121200120202220212022222121120222122122222220101100212221110122112222102222222020021222121012202211002212202222122002012220112122112021100202212221221120211220221221112122222221021212122020202220201100022220022220102222202222222012000222220012222222011221222222121212212221102010102220210222222202220022201221110201102022222222221202022121212222220212222201201222122222122222112021000022220022212220000210001222020202212221002202122022110222211221220121212121111002222022221220020222022021202221222011122022011222102222210222212120100122122122202220121222000222022222022222222210002220122222210210220221201022201111202222220220020202222220222220100211002001200122122222120222202202022221120012212210202201010222220022112220102100112221020222211212220221210120101110022022220121122222022220202221221001022101022221112222111222102102111022021102202220010202211222222202112220202022022020020221210200221020210221102222112222221220021222022022212222121212212211121121012222112222102101200102020202222211112202022222221202002021122211202021111200202201221021220022001020202022222020122212022122222220222000012211021122012222111222212011200021022112212212120210112202121122202221112100222122101211202202221021210022201001122022221220120212222221222222002020012011122220122222011222002220000102120222202210211220201202021222102010002221022120101211221222222120220122210210112122220121121212022022212222011010012201010222202222211222212000022102022022202212100212200212221222112112202022022220212202210221220121202020201022202022220120121222222022212220221000012202220020122222220222122121212120022012202220022212210202022022012101022120022222220200221211022220210120101001122022220120020212122020222221010210002200202222012222100222122202012111002022212201200110021222121112011111102220222120012210211200122121210120010202012022220221121202022122212221110002202021100121222222221222212101222102220012212221112222222212222122221010102202012220002220202202222222200121100222021022122021222222122122212220220022212012011122122222112222212202011100200222222222021112210202022202002120002201022122220211220201120122220121112212122022222021121212222120222222021210002120110020022222221222222000020021211112202222200000001222222222102000002222122121010211221110120122222022001221010222120022222202222021202221020011222200002022022222211222012120120020012222212201220012002202220022010112022111122121020201201000002021220122021001000122022021122222122121202221002201012011222222022222102222012012022220110022202220221121120212221012002200012020002020201202221022101110221021222021122122121000122212222221202221221011122021102221022222101212212021000100000212222221122112100212121122100121222001102220121202220220101110211122102010122222222222121202122122202222202101202120212021012222220202112102021000021002212200002221211212022002001112212110012121112221222101112211222100211211122222120112122212022121222022220011012101020020012222100212002001000120102102202201121000211212020102211222122202202121122221202112220102202002122211120022102101000202122120222121011011200101110221212222122112012012021201201022212220110120120222121112102120222202122022002212221000012122202222001110202122112112020222022022202122011001111211112021202222211002022212011210122202222201011011212212221122000210212121012020221220212002022102201212120202202122120112001212022220212220210202210121121022112222120122012222221202201222202201122201111212022101120022022210002120111212201120022010212021211222211022202010100212222220202122011100112100220020122222010102202122100110201202202211212201010222122122021220022111102122011120202211100121202120122001112222211212022212222022212222101111121022000020102222112122222202011200211002202200222002201202122222012022122022111121221012211202210210221122201202122122122201011222022220202220211112201211110221202222210102002002210221220212202222010212011202220112102210112101220121011211222010201111201200012020111122202100102202022200212012220012021002211220102222121022212202102100010212202201001012222222120221010020102021202121110010212121110200210121121210020122102002120202222210212121012222010012101222122222010012112011120220200201100101000011111000001020000010110011122111011121101102000010112021002010011100202212110010000002121101010110222221001011100100210100021201
diff --git a/2019/input/five.txt b/2019/input/five.txt
new file mode 100644
index 0000000..a97e6c1
--- /dev/null
+++ b/2019/input/five.txt
@@ -0,0 +1 @@
+3,225,1,225,6,6,1100,1,238,225,104,0,1101,65,39,225,2,14,169,224,101,-2340,224,224,4,224,1002,223,8,223,101,7,224,224,1,224,223,223,1001,144,70,224,101,-96,224,224,4,224,1002,223,8,223,1001,224,2,224,1,223,224,223,1101,92,65,225,1102,42,8,225,1002,61,84,224,101,-7728,224,224,4,224,102,8,223,223,1001,224,5,224,1,223,224,223,1102,67,73,224,1001,224,-4891,224,4,224,102,8,223,223,101,4,224,224,1,224,223,223,1102,54,12,225,102,67,114,224,101,-804,224,224,4,224,102,8,223,223,1001,224,3,224,1,224,223,223,1101,19,79,225,1101,62,26,225,101,57,139,224,1001,224,-76,224,4,224,1002,223,8,223,1001,224,2,224,1,224,223,223,1102,60,47,225,1101,20,62,225,1101,47,44,224,1001,224,-91,224,4,224,1002,223,8,223,101,2,224,224,1,224,223,223,1,66,174,224,101,-70,224,224,4,224,102,8,223,223,1001,224,6,224,1,223,224,223,4,223,99,0,0,0,677,0,0,0,0,0,0,0,0,0,0,0,1105,0,99999,1105,227,247,1105,1,99999,1005,227,99999,1005,0,256,1105,1,99999,1106,227,99999,1106,0,265,1105,1,99999,1006,0,99999,1006,227,274,1105,1,99999,1105,1,280,1105,1,99999,1,225,225,225,1101,294,0,0,105,1,0,1105,1,99999,1106,0,300,1105,1,99999,1,225,225,225,1101,314,0,0,106,0,0,1105,1,99999,108,226,226,224,102,2,223,223,1005,224,329,101,1,223,223,1107,226,677,224,1002,223,2,223,1005,224,344,101,1,223,223,8,226,677,224,102,2,223,223,1006,224,359,101,1,223,223,108,677,677,224,1002,223,2,223,1005,224,374,1001,223,1,223,1108,226,677,224,1002,223,2,223,1005,224,389,101,1,223,223,1007,677,677,224,1002,223,2,223,1006,224,404,1001,223,1,223,1108,677,677,224,102,2,223,223,1006,224,419,1001,223,1,223,1008,226,677,224,102,2,223,223,1005,224,434,101,1,223,223,107,677,677,224,102,2,223,223,1006,224,449,1001,223,1,223,1007,226,677,224,102,2,223,223,1005,224,464,101,1,223,223,7,677,226,224,102,2,223,223,1005,224,479,101,1,223,223,1007,226,226,224,102,2,223,223,1005,224,494,101,1,223,223,7,677,677,224,102,2,223,223,1006,224,509,101,1,223,223,1008,677,677,224,1002,223,2,223,1006,224,524,1001,223,1,223,108,226,677,224,1002,223,2,223,1006,224,539,101,1,223,223,8,226,226,224,102,2,223,223,1006,224,554,101,1,223,223,8,677,226,224,102,2,223,223,1005,224,569,1001,223,1,223,1108,677,226,224,1002,223,2,223,1006,224,584,101,1,223,223,1107,677,226,224,1002,223,2,223,1005,224,599,101,1,223,223,107,226,226,224,102,2,223,223,1006,224,614,1001,223,1,223,7,226,677,224,102,2,223,223,1005,224,629,1001,223,1,223,107,677,226,224,1002,223,2,223,1005,224,644,1001,223,1,223,1107,677,677,224,102,2,223,223,1006,224,659,101,1,223,223,1008,226,226,224,1002,223,2,223,1006,224,674,1001,223,1,223,4,223,99,226
diff --git a/2019/input/four.txt b/2019/input/four.txt
new file mode 100644
index 0000000..693a14b
--- /dev/null
+++ b/2019/input/four.txt
@@ -0,0 +1 @@
+123257-647015
diff --git a/2019/input/nine.txt b/2019/input/nine.txt
new file mode 100644
index 0000000..bb2d334
--- /dev/null
+++ b/2019/input/nine.txt
@@ -0,0 +1 @@
+1102,34463338,34463338,63,1007,63,34463338,63,1005,63,53,1101,0,3,1000,109,988,209,12,9,1000,209,6,209,3,203,0,1008,1000,1,63,1005,63,65,1008,1000,2,63,1005,63,902,1008,1000,0,63,1005,63,58,4,25,104,0,99,4,0,104,0,99,4,17,104,0,99,0,0,1102,32,1,1019,1101,0,500,1023,1101,0,636,1025,1102,36,1,1010,1101,0,29,1013,1102,864,1,1029,1102,21,1,1000,1102,1,507,1022,1102,1,28,1011,1102,38,1,1008,1101,0,35,1004,1101,25,0,1018,1102,24,1,1005,1102,30,1,1009,1102,1,869,1028,1101,0,37,1007,1102,1,23,1017,1102,1,20,1015,1102,1,22,1003,1101,0,39,1001,1102,1,31,1012,1101,701,0,1026,1101,0,641,1024,1101,0,34,1016,1102,1,0,1020,1102,698,1,1027,1102,33,1,1002,1102,26,1,1006,1101,0,1,1021,1101,0,27,1014,109,12,21101,40,0,0,1008,1012,40,63,1005,63,203,4,187,1105,1,207,1001,64,1,64,1002,64,2,64,109,-11,1207,7,37,63,1005,63,223,1105,1,229,4,213,1001,64,1,64,1002,64,2,64,109,14,1206,5,247,4,235,1001,64,1,64,1105,1,247,1002,64,2,64,109,-2,1207,-4,31,63,1005,63,269,4,253,1001,64,1,64,1105,1,269,1002,64,2,64,109,-6,1208,-5,35,63,1005,63,289,1001,64,1,64,1106,0,291,4,275,1002,64,2,64,109,9,21108,41,39,-1,1005,1015,311,1001,64,1,64,1105,1,313,4,297,1002,64,2,64,109,-5,2101,0,-9,63,1008,63,33,63,1005,63,339,4,319,1001,64,1,64,1106,0,339,1002,64,2,64,1205,10,351,4,343,1106,0,355,1001,64,1,64,1002,64,2,64,109,-18,2108,35,9,63,1005,63,375,1001,64,1,64,1105,1,377,4,361,1002,64,2,64,109,18,1205,9,389,1105,1,395,4,383,1001,64,1,64,1002,64,2,64,109,7,21107,42,41,-8,1005,1010,415,1001,64,1,64,1106,0,417,4,401,1002,64,2,64,109,-12,2102,1,0,63,1008,63,29,63,1005,63,437,1106,0,443,4,423,1001,64,1,64,1002,64,2,64,109,3,1208,0,30,63,1005,63,461,4,449,1105,1,465,1001,64,1,64,1002,64,2,64,109,5,1202,-5,1,63,1008,63,31,63,1005,63,489,1001,64,1,64,1106,0,491,4,471,1002,64,2,64,109,15,2105,1,-6,1001,64,1,64,1106,0,509,4,497,1002,64,2,64,109,-10,1206,2,525,1001,64,1,64,1106,0,527,4,515,1002,64,2,64,109,-18,1202,0,1,63,1008,63,39,63,1005,63,553,4,533,1001,64,1,64,1106,0,553,1002,64,2,64,109,1,2107,21,1,63,1005,63,571,4,559,1105,1,575,1001,64,1,64,1002,64,2,64,109,7,2102,1,-8,63,1008,63,39,63,1005,63,601,4,581,1001,64,1,64,1105,1,601,1002,64,2,64,109,2,1201,-7,0,63,1008,63,35,63,1005,63,623,4,607,1106,0,627,1001,64,1,64,1002,64,2,64,109,20,2105,1,-7,4,633,1106,0,645,1001,64,1,64,1002,64,2,64,109,-16,21107,43,44,-4,1005,1011,663,4,651,1105,1,667,1001,64,1,64,1002,64,2,64,109,-11,2107,36,0,63,1005,63,687,1001,64,1,64,1106,0,689,4,673,1002,64,2,64,109,19,2106,0,4,1106,0,707,4,695,1001,64,1,64,1002,64,2,64,109,-14,21108,44,44,6,1005,1015,725,4,713,1105,1,729,1001,64,1,64,1002,64,2,64,109,1,1201,-6,0,63,1008,63,36,63,1005,63,749,1106,0,755,4,735,1001,64,1,64,1002,64,2,64,109,-1,21101,45,0,10,1008,1019,42,63,1005,63,775,1105,1,781,4,761,1001,64,1,64,1002,64,2,64,109,16,21102,46,1,-7,1008,1018,44,63,1005,63,801,1105,1,807,4,787,1001,64,1,64,1002,64,2,64,109,-3,21102,47,1,-4,1008,1018,47,63,1005,63,833,4,813,1001,64,1,64,1105,1,833,1002,64,2,64,109,-14,2108,38,0,63,1005,63,851,4,839,1105,1,855,1001,64,1,64,1002,64,2,64,109,17,2106,0,3,4,861,1106,0,873,1001,64,1,64,1002,64,2,64,109,-31,2101,0,10,63,1008,63,36,63,1005,63,897,1001,64,1,64,1106,0,899,4,879,4,64,99,21101,0,27,1,21101,0,913,0,1106,0,920,21201,1,53612,1,204,1,99,109,3,1207,-2,3,63,1005,63,962,21201,-2,-1,1,21102,940,1,0,1106,0,920,21202,1,1,-1,21201,-2,-3,1,21101,955,0,0,1106,0,920,22201,1,-1,-2,1105,1,966,21201,-2,0,-2,109,-3,2106,0,0
diff --git a/2019/input/one.txt b/2019/input/one.txt
new file mode 100644
index 0000000..199bf78
--- /dev/null
+++ b/2019/input/one.txt
@@ -0,0 +1,100 @@
+81893
+122450
+81968
+135462
+127082
+94016
+100999
+88954
+111500
+89232
+149706
+70377
+114053
+116799
+57368
+117222
+134050
+58097
+113145
+67710
+115082
+109484
+76183
+87768
+85164
+141183
+120410
+85101
+139190
+120483
+89111
+122940
+103010
+127018
+85178
+73893
+145037
+115786
+149613
+122956
+96325
+123513
+126850
+124733
+116615
+131598
+94544
+94431
+97681
+86617
+56739
+104904
+129964
+80862
+92125
+127108
+110565
+131296
+88192
+81824
+134198
+87363
+122455
+123441
+60907
+95023
+113940
+98328
+79989
+146133
+122356
+70932
+106379
+125641
+124905
+89699
+129133
+112173
+127629
+135485
+140068
+95229
+141276
+109807
+69951
+100792
+62683
+145565
+149063
+99523
+88881
+64337
+145012
+142380
+60028
+131565
+53041
+88489
+81712
+132728
diff --git a/2019/input/seven.txt b/2019/input/seven.txt
new file mode 100644
index 0000000..26f287d
--- /dev/null
+++ b/2019/input/seven.txt
@@ -0,0 +1 @@
+3,8,1001,8,10,8,105,1,0,0,21,38,63,76,89,106,187,268,349,430,99999,3,9,1001,9,5,9,102,3,9,9,1001,9,2,9,4,9,99,3,9,101,4,9,9,102,3,9,9,101,4,9,9,1002,9,3,9,101,2,9,9,4,9,99,3,9,101,5,9,9,1002,9,4,9,4,9,99,3,9,101,2,9,9,1002,9,5,9,4,9,99,3,9,1001,9,5,9,1002,9,5,9,1001,9,5,9,4,9,99,3,9,1001,9,2,9,4,9,3,9,102,2,9,9,4,9,3,9,1001,9,1,9,4,9,3,9,1002,9,2,9,4,9,3,9,101,1,9,9,4,9,3,9,1001,9,2,9,4,9,3,9,1001,9,1,9,4,9,3,9,101,1,9,9,4,9,3,9,102,2,9,9,4,9,3,9,1002,9,2,9,4,9,99,3,9,101,2,9,9,4,9,3,9,101,2,9,9,4,9,3,9,101,2,9,9,4,9,3,9,1001,9,2,9,4,9,3,9,102,2,9,9,4,9,3,9,1001,9,2,9,4,9,3,9,1001,9,1,9,4,9,3,9,1002,9,2,9,4,9,3,9,1001,9,1,9,4,9,3,9,101,2,9,9,4,9,99,3,9,1002,9,2,9,4,9,3,9,1001,9,2,9,4,9,3,9,101,2,9,9,4,9,3,9,1001,9,2,9,4,9,3,9,102,2,9,9,4,9,3,9,1001,9,1,9,4,9,3,9,1002,9,2,9,4,9,3,9,101,2,9,9,4,9,3,9,102,2,9,9,4,9,3,9,102,2,9,9,4,9,99,3,9,102,2,9,9,4,9,3,9,1001,9,2,9,4,9,3,9,101,1,9,9,4,9,3,9,1002,9,2,9,4,9,3,9,1001,9,2,9,4,9,3,9,1001,9,2,9,4,9,3,9,102,2,9,9,4,9,3,9,101,1,9,9,4,9,3,9,101,1,9,9,4,9,3,9,101,2,9,9,4,9,99,3,9,1002,9,2,9,4,9,3,9,101,1,9,9,4,9,3,9,1002,9,2,9,4,9,3,9,102,2,9,9,4,9,3,9,1001,9,1,9,4,9,3,9,101,1,9,9,4,9,3,9,1002,9,2,9,4,9,3,9,101,1,9,9,4,9,3,9,1001,9,2,9,4,9,3,9,102,2,9,9,4,9,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P
+Q4L)J2S
+27N)WWX
+B7T)YW7
+BNF)51F
+1TP)Q7L
+JK9)GTJ
+WM2)S1H
+RXL)2RY
+JWT)G86
+JT8)5LH
+XW4)G9M
+JKB)ZDJ
+7VN)1T2
+JPJ)J9R
+PR3)FF4
+D7D)SFK
+519)Q4L
+NYW)GHQ
+2G1)QGM
+Y7S)SAN
+VGZ)WWN
+NKY)G55
+LC7)BQJ
+DV7)27F
+P27)36R
+8CS)CT4
+3WP)KKX
+LNP)MKP
+V5G)WXV
+TCS)GT1
+5S9)V5N
+YKC)G3G
+FK8)GJ8
+ZNN)FL2
+68F)P6P
+M39)2DH
+MZB)LBQ
+HFZ)GRD
+PQH)8Y6
+KGT)8VB
+FPS)ZRH
+MG2)6H8
+2KL)D23
+MYQ)NDY
+159)B8L
+NJT)7VG
+87J)41Z
+V17)34F
+8GT)C9X
+ZF9)RFV
+G55)YQ3
+6JV)M9B
+4DN)CWR
+DCH)CH3
+Q89)WBP
+P3Z)XS5
+GRV)9PK
+4V2)GC4
+LBQ)7FG
+ZWR)ZG1
+RZD)N67
+7J5)542
+SHF)CNJ
+LQQ)2TB
+YDW)BMN
+8NR)8RY
+28S)QCF
+QC2)KTR
+31N)1L2
+FRF)C32
+X7P)LX1
+YGH)7QW
+XK8)7XL
+SW2)ZF9
+M6M)S3D
+8XR)DFQ
+V5N)JHQ
+MHN)Z6X
+J64)D4W
+LDP)R5Z
+W2J)G6S
+SVX)Z6B
+W1L)71V
+ZYJ)2G1
+5ZJ)D8G
+9Q1)Z54
+51M)QZZ
+Y1S)F31
+S12)Q16
+L1Q)1WM
diff --git a/2019/input/ten.txt b/2019/input/ten.txt
new file mode 100644
index 0000000..716efc4
--- /dev/null
+++ b/2019/input/ten.txt
@@ -0,0 +1,20 @@
+.###.###.###.#####.#
+#####.##.###..###..#
+.#...####.###.######
+######.###.####.####
+#####..###..########
+#.##.###########.#.#
+##.###.######..#.#.#
+.#.##.###.#.####.###
+##..#.#.##.#########
+###.#######.###..##.
+###.###.##.##..####.
+.##.####.##########.
+#######.##.###.#####
+#####.##..####.#####
+##.#.#####.##.#.#..#
+###########.#######.
+#.##..#####.#####..#
+#####..#####.###.###
+####.#.############.
+####.#.#.##########.
diff --git a/2019/input/three.txt b/2019/input/three.txt
new file mode 100644
index 0000000..fcb8502
--- /dev/null
+++ b/2019/input/three.txt
@@ -0,0 +1,2 @@
+R998,U547,L703,D251,L776,U837,R100,U240,R197,D216,L220,U606,L437,U56,R940,U800,L968,D464,L870,D797,L545,D824,R790,U5,R347,D794,R204,U538,L247,U385,L103,D260,L590,U813,L549,U309,L550,U321,R862,D686,R368,D991,R451,D836,R264,D138,L292,D319,L784,D369,R849,U865,R776,D726,R223,D118,L790,D208,L836,D592,R310,D36,R991,U674,L205,U407,R422,U350,L126,D320,L239,U353,L509,U48,R521,D544,L157,D551,R614,D493,R407,D965,R498,U248,R826,U573,L782,D589,R616,D992,L806,D745,R28,U142,L333,D849,L858,D617,R167,U341,R46,U940,L615,D997,L447,D604,R148,U561,R925,D673,R441,U200,R458,U193,L805,D723,L208,U600,L926,U614,R660,D183,L408,D834,R248,U354,L110,U391,L37,U599,L287,U28,R859,D936,L404,D952,R11,U20,R708,U218,L800,U750,R936,D213,R6,D844,R728,D391,R114,U406,R390,U791,L199,D397,R476,D583,R99,U419,R575,D836,L896,U780,L77,U964,R441,U723,R248,D170,R527,D94,L39,U645,L338,D728,R503,U641,L358,D287,R171,U368,R176,D986,R821,U912,L231,D206,L451,U900,L35,D490,R190,D180,L937,D500,R157,U989,L336,U202,R178,U52,R931,U306,L85,D866,R756,U715,L521,D977,R936,U4,R207,D384,L785,U138,L682,U488,L537,U250,L877,D446,R849,U35,R258,U784,R263,D494,L324,U601,R302,U473,L737,D143,R184,D967,R95,U51,L713,U733,R297,U740,R677,D715,R750,U143,L980,U260,R915,D535,R202,U460,R365,U956,L73,U441,R182,D982,L869,D755,L837,D933,L856,D341,R189,D519,L387,D144,R575,U682,R317,U838,R154,D201,R237,D410,L43,U853,L495,U983,L953,U220,R697,D592,R355,U377,R792,U824,L441,U783,R258,D955,R451,D178,L151,D435,L232,U923,L663,U283,L92,D229,R514
+L995,U122,R472,U470,R725,U906,L83,U672,R448,U781,L997,U107,R66,D966,L780,D181,L662,U158,R804,D837,L237,U164,L98,U582,R925,D806,L153,D843,R601,U941,L968,D528,R482,D586,R15,U370,L592,U836,R828,U676,R606,D20,R841,U117,L262,U377,R375,U503,R166,D398,R161,D9,R140,D188,R895,D226,R77,U28,L727,D72,L51,U425,R370,D377,L801,D525,R102,D568,L416,D300,R415,U199,R941,U211,R285,U719,L259,U872,L959,U350,L196,D830,R515,U899,R298,U875,R946,U797,R108,U461,R999,D49,L369,D472,R83,D265,L825,D163,R162,U906,L816,D241,L587,D801,R601,D630,R937,U954,L379,D347,R831,D337,L192,D649,L853,U270,R162,D892,L26,D663,L276,U891,R843,U67,R225,D88,R686,U662,R794,D814,L200,D887,R567,U363,L863,U16,R975,D470,R714,U771,L267,D402,R75,U98,L686,U565,R584,D402,L824,D927,R71,U39,L174,D494,L358,D626,R616,D369,R471,U881,L428,U53,R862,U749,L847,D944,L887,D695,R442,U870,L993,U315,L878,U100,L480,D354,L12,D533,L236,D364,R450,U679,L926,D391,R313,D953,L560,D740,L974,D119,L370,U404,R339,U233,R901,U514,R584,D495,R308,U170,R759,U592,R388,U396,R477,U670,R906,D687,L874,U352,R124,U700,R289,D524,L93,D817,R408,D776,L235,D928,L534,D296,R116,U995,L63,D903,R758,U881,L530,U498,R573,D626,L26,U269,R237,U287,L840,D603,R948,D567,R89,U552,L299,D774,R863,D182,R773,D108,L137,U88,L731,U793,L267,U902,L41,U258,L156,U361,R389,D839,L976,U960,L342,D489,R816,U391,L393,U601,R255,D629,R832,U877,L34,D373,L809,D679,L104,U901,R157,U468,R143,U896,L637,D577,L545,D486,L970,D130,L305,D909,R984,D500,L935,U949,R525,D547,L786,U106,L269,D511,L919
diff --git a/2019/input/two.txt b/2019/input/two.txt
new file mode 100644
index 0000000..54b87b7
--- /dev/null
+++ b/2019/input/two.txt
@@ -0,0 +1 @@
+1,0,0,3,1,1,2,3,1,3,4,3,1,5,0,3,2,10,1,19,1,6,19,23,2,23,6,27,1,5,27,31,1,31,9,35,2,10,35,39,1,5,39,43,2,43,10,47,1,47,6,51,2,51,6,55,2,55,13,59,2,6,59,63,1,63,5,67,1,6,67,71,2,71,9,75,1,6,75,79,2,13,79,83,1,9,83,87,1,87,13,91,2,91,10,95,1,6,95,99,1,99,13,103,1,13,103,107,2,107,10,111,1,9,111,115,1,115,10,119,1,5,119,123,1,6,123,127,1,10,127,131,1,2,131,135,1,135,10,0,99,2,14,0,0
diff --git a/2019/nine.go b/2019/nine.go
new file mode 100644
index 0000000..432d780
--- /dev/null
+++ b/2019/nine.go
@@ -0,0 +1,166 @@
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "os"
+ "strconv"
+)
+
+func main() {
+ var memory []int
+ start, size := 0, 0
+ if len(os.Args) < 2 {
+ panic("runtime error: missing operand")
+ }
+ file, err := ioutil.ReadFile(os.Args[1])
+ if err != nil {
+ panic(err)
+ }
+ for i := 0; i < len(file); i++ {
+ if file[i] == ',' || file[i] == '\n' {
+ arg, err := strconv.Atoi(string(file[start:i])) // i-1??
+ if err != nil {
+ panic(err)
+ }
+ memory = append(memory, arg)
+ start = i + 1
+ size++
+ }
+ }
+ // fmt.Println(execute(memory, size))
+ // noun, verb := etucexe(memory, size, 19690720)
+ // fmt.Println(100*noun + verb)
+ execute(memory, size)
+}
+
+func split(memory []int, i, size, relative int) (int, int, int) {
+ mode := memory[i] / 100
+ three, two, one := i+3, i+2, i+1
+ if size-i > 1 {
+ if mode%10 == 0 {
+ one = memory[i+1]
+ } else if mode%10 == 2 {
+ one = relative + memory[i+1]
+ }
+ if size-i > 2 {
+ if mode/10%10 == 0 {
+ two = memory[i+2]
+ } else if mode%10 == 2 {
+ two = relative + memory[i+2]
+ }
+ if size-i > 3 {
+ if mode/100 == 0 {
+ three = memory[i+3]
+ } else if mode%10 == 2 {
+ three = relative + memory[i+3]
+ }
+ }
+ }
+ }
+ return three, two, one
+}
+
+func execute(memory []int, size int) []int {
+ /* todo: said "memory" functionality could be [pos, value]int
+ * i.e. when memory outside initial bounds wants to be accessed,
+ * it writes to a new element of this slice
+ * to access elements of the array, iterate through while checking each position
+ * additionally, to ensure there aren't conflicting "positions" in the array,
+ * do the above iteration process, if not, appends (this requires a total int)
+ */
+ /*
+ var swap [][2]int
+ */
+
+ // off-topic todo: https://www.golangprograms.com/example-arrays-of-arrays-arrays-of-slices-slices-of-arrays-and-slices-of-slices.html
+ // does this mean i can remove total / size because if so YES
+ for i := 0; i < 4000; i++ { // bad (example: no auto-termination due to 0 replacing nothingness)
+ memory = append(memory, 0)
+ }
+ relative := 0 // initial value of the relative base
+ for i := 0; i < len(memory); {
+ // bounds check
+ opcode := memory[i] % 100
+ three, two, one := split(memory, i, size, relative)
+ //fmt.Println("test:", opcode)
+ // actually what might work better than replacing all below would be
+ // checking if the next three values are out of bounds or not
+ // and then replacing them
+ // no bad idea large addition exists
+ switch opcode {
+ case 1: // adds
+ memory[three] = memory[one] + memory[two]
+ i += 4
+ case 2: // multiplies
+ // if out of bounds
+ // swap = append(swap, {memory[three], memory[one] * memory[two]})
+ // else
+ memory[three] = memory[one] * memory[two]
+ i += 4
+ case 3: // input
+ var input int
+ fmt.Print("Input: ")
+ resp, err := fmt.Scanf("%d", &input) // interesting note: anything following a valid integer is run by bash
+ if err != nil {
+ fmt.Println(resp, err)
+ os.Exit(0)
+ }
+ // out of bounds check
+ memory[one] = input // not affected by modes
+ i += 2
+ case 4: // output
+ fmt.Println(memory[one])
+ i += 2
+ case 5: // jump-if-true
+ if memory[one] != 0 {
+ i = memory[two]
+ } else {
+ i += 3
+ }
+ case 6: // jump-if-false
+ if memory[one] == 0 {
+ i = memory[two]
+ } else {
+ i += 3
+ }
+ case 7: // less than
+ if memory[one] < memory[two] {
+ memory[memory[i+3]] = 1 // instructions: _position_ given by the third parameter
+ } else {
+ memory[memory[i+3]] = 0
+ }
+ i += 4
+ case 8: // equals
+ if memory[one] == memory[two] {
+ memory[memory[i+3]] = 1
+ } else {
+ memory[memory[i+3]] = 0
+ }
+ i += 4
+ case 9: // adjusts the relative base
+ relative += memory[one] // interesting behavior when changing to i+1
+ i += 2
+ case 99: // terminate
+ return memory
+ default:
+ fmt.Println("Unsupported code", opcode, "at", i)
+ os.Exit(0)
+ }
+ }
+ return memory
+}
+
+func etucexe(memory []int, size, output int) (int, int) {
+ var volatile []int
+ for i := 0; i < len(memory); i++ {
+ for j := 0; j < len(memory); j++ {
+ volatile = append([]int(nil), memory...) // reset volatile to memory
+ volatile[1], volatile[2] = i, j
+ if execute(volatile, size)[0] == output {
+ return i, j
+ }
+ }
+ }
+ return -1, -1
+}
diff --git a/2019/one.go b/2019/one.go
new file mode 100644
index 0000000..cf27820
--- /dev/null
+++ b/2019/one.go
@@ -0,0 +1,40 @@
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "os"
+ "strconv"
+)
+
+func main() {
+ start, sum, fuelsum := 0, 0, 0
+ if len(os.Args) < 2 {
+ panic("runtime error: missing operand")
+ }
+ file, err := ioutil.ReadFile(os.Args[1])
+ if err != nil {
+ panic(err)
+ }
+ for i := 0; i < len(file); i++ {
+ if file[i] == '\n' {
+ arg, err := strconv.Atoi(string(file[start:i])) // i-1??
+ if err != nil {
+ panic(err)
+ }
+ start = i + 1
+ sum += (arg / 3) - 2
+ fuelsum += tyranny(arg)
+ }
+ }
+ fmt.Println(sum)
+ fmt.Println(fuelsum)
+}
+
+func tyranny(mass int) int {
+ subtotal := 0
+ for fuel := (mass / 3) - 2; fuel >= 0; fuel = (fuel / 3) - 2 {
+ subtotal += fuel
+ }
+ return subtotal
+}
diff --git a/2019/seven.go b/2019/seven.go
new file mode 100644
index 0000000..d71d827
--- /dev/null
+++ b/2019/seven.go
@@ -0,0 +1,141 @@
+package main
+
+import (
+ "fmt"
+ "os"
+ "strconv"
+)
+
+func main() {
+ var memory []int
+ size := 0
+ for i := 1; i < len(os.Args); i++ {
+ arg, err := strconv.Atoi(os.Args[i])
+ if err != nil {
+ panic(err)
+ }
+ memory = append(memory, arg)
+ size++
+ }
+ // fmt.Println(execute(memory, size))
+ // noun, verb := etucexe(memory, size, 19690720)
+ // fmt.Println(100*noun + verb)
+ // execute(memory, size)
+ fmt.Println(thrust(memory, size))
+}
+
+func thrust(memory []int, size int) int { // 120 total
+ max := 0
+ for a := 0; a < 5; a++ {
+ for b:=0; b < 4; b++ {
+ for c:=0;
+ }
+
+
+
+ a, b, c, d, e := i/10000, i/1000%10, i/100%100, i/10%1000, i%10000
+ a = execute(memory, size) // stdin fill this with a, 0
+ b = execute(memory, size) // stdin fill this with b, 0
+ c = execute(memory, size) // stdin fill this with c, 0
+ d = execute(memory, size) // stdin fill this with d, 0
+ e = execute(memory, size) // stdin fill this with e, 0
+ if (e > max) {
+ max = e
+ }
+ return max
+}
+
+func split(memory []int, i, size int) (int, int, int) {
+ mode := memory[i] / 100
+ three, two, one := i+3, i+2, i+1
+ if size-i > 1 {
+ if mode%10 == 0 {
+ one = memory[i+1]
+ }
+ if size-i > 2 {
+ if mode/10%10 == 0 {
+ two = memory[i+2]
+ }
+ if size-i > 3 {
+ if mode/100 == 0 {
+ three = memory[i+3]
+ }
+ }
+ }
+ }
+ return three, two, one
+}
+
+func execute(memory []int, size int) []int {
+ for i := 0; i < len(memory); {
+ opcode := memory[i] % 100
+ three, two, one := split(memory, i, size)
+ switch opcode {
+ case 1: // adds
+ memory[three] = memory[one] + memory[two]
+ i += 4
+ case 2: // multiplies
+ memory[three] = memory[one] * memory[two]
+ i += 4
+ case 3: // input
+ var input int
+ fmt.Print("Input: ")
+ resp, err := fmt.Scanf("%d", &input)
+ if err != nil {
+ fmt.Println(resp, err)
+ os.Exit(0)
+ }
+ memory[one] = input // not affected by modes
+ i += 2
+ case 4: // output
+ fmt.Println(memory[one])
+ i += 2
+ case 5: // jump-if-true
+ if memory[one] != 0 {
+ i = memory[two] // ???
+ } else {
+ i += 3
+ }
+ case 6: // jump-if-false
+ if memory[one] == 0 {
+ i = memory[two] // ???
+ } else {
+ i += 3
+ }
+ case 7: // less than
+ if memory[one] < memory[two] {
+ memory[memory[i+3]] = 1
+ } else {
+ memory[memory[i+3]] = 0
+ }
+ i += 4
+ case 8: // equals
+ if memory[one] == memory[two] {
+ memory[memory[i+3]] = 1
+ } else {
+ memory[memory[i+3]] = 0
+ }
+ i += 4
+ case 99: // terminate
+ return memory
+ default:
+ fmt.Println("Unsupported code", opcode, "at", i)
+ os.Exit(0)
+ }
+ }
+ return memory
+}
+
+func etucexe(memory []int, size, output int) (int, int) {
+ var volatile []int
+ for i := 0; i < len(memory); i++ {
+ for j := 0; j < len(memory); j++ {
+ volatile = append([]int(nil), memory...) // reset volatile to memory
+ volatile[1], volatile[2] = i, j
+ if execute(volatile, size)[0] == output {
+ return i, j
+ }
+ }
+ }
+ return -1, -1
+}
diff --git a/2019/six.go b/2019/six.go
new file mode 100644
index 0000000..646313d
--- /dev/null
+++ b/2019/six.go
@@ -0,0 +1,25 @@
+package main
+
+import (
+ "io/ioutil"
+ "os"
+)
+
+func main() {
+ if len(os.Args) < 2 {
+ panic("runtime error: missing operand")
+ }
+ file, err := ioutil.ReadFile(os.Args[1])
+ if err != nil {
+ panic(err)
+ }
+
+ for i := 0
+}
+
+func orbits(planet string) []string {
+
+ var chain []string
+
+ return chain
+}
diff --git a/2019/ten.go b/2019/ten.go
new file mode 100644
index 0000000..562299a
--- /dev/null
+++ b/2019/ten.go
@@ -0,0 +1,47 @@
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "os"
+)
+
+func main() {
+ var region [][]bool
+ x, y, size := 0, 0, 0
+ if len(os.Args) < 2 {
+ panic("runtime error: missing operand")
+ }
+ file, err := ioutil.ReadFile(os.Args[1])
+ if err != nil {
+ panic(err)
+ }
+ for i := 0; i < len(file); i++ {
+ if file[i] == '#' {
+ region[x][y] = true
+ x++
+ } else if file[i] == '\n' {
+ x = 0
+ y++
+ }
+ }
+ max := 0
+ fmt.Println("Maximum detectable asteroids:", detect(region, x, y))
+}
+
+func detect(region [][]bool, width, height int) int {
+ for i:= 0; i < width; i++ {
+ for j := 0; j < height; j++ {
+ if region[i][j] {
+ for k:= 0; k < width; k++ {
+ for l := 0; l < width; l++ {
+
+ }
+ }
+ }
+ }
+ }
+
+ slope :=
+ return
+}
diff --git a/2019/three.go b/2019/three.go
new file mode 100644
index 0000000..2c79a18
--- /dev/null
+++ b/2019/three.go
@@ -0,0 +1,156 @@
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "os"
+)
+
+func main() {
+ var directions [][]string
+ var temp []string
+ start := 0
+
+ if len(os.Args) < 2 {
+ panic("runtime error: missing operand")
+ }
+ file, err := ioutil.ReadFile(os.Args[1])
+ if err != nil {
+ panic(err)
+ }
+ for i := 0; i < len(file); i++ {
+ if string(file[i]) == "," || file[i] == '\n' {
+ temp = append(temp, string(file[start:i]))
+ start = i + 1
+ if file[i] == '\n' {
+ directions[] = append(directions[], temp)
+ temp = nil
+ }
+ }
+ }
+ fmt.Println(directions)
+
+ // grid [][]int := boolgrid(directions)
+
+}
+
+// ax, ay, at := taxi(directions[0])
+// bx, by, bt := taxi(directions[1])
+// for i := 0; i < at; i++ {
+// for j := 0; j < at; j++ {
+// for k := 0; k <
+// ax[i][j]
+// }
+// }
+// abx, aby
+
+// grid = taxi(directions, taxi(directions2, grid))
+// min, x, y := 4000, 0, 0
+// for i := 0; i < len(grid); i++ {
+// for j := 0; j < len(grid); j++ {
+// x, y = int(math.Abs(float64(i-500))), int(math.Abs(float64(j-500)))
+// if grid[i][j] == 2 && x+y < min {
+// fmt.Println(i-500, j-500)
+// min = x + y
+// }
+
+// }
+// }
+// fmt.Println("Manhattan distance to intersection:", min)
+// }
+
+// func taxi(directions []string) ([]int, []int, int) {
+// var horislice, vertslice []int
+// total := 0
+// for i := 0; i < len(directions); i++ {
+// direction := directions[i][0]
+// displacement, err := strconv.Atoi(directions[i][1:])
+// if err != nil {
+// panic(err)
+// }
+// switch direction {
+// case 'L':
+// for j := 0; j < displacement; j++ {
+// horislice = append(horislice, horislice[total]-j)
+// vertslice = append(vertslice, vertslice[total])
+// total++
+// }
+// case 'R':
+// for j := 0; j < displacement; j++ {
+// horislice = append(horislice, horislice[total]+j)
+// vertslice = append(vertslice, vertslice[total])
+// total++
+// }
+// case 'U':
+// for j := 0; j < displacement; j++ {
+// vertslice = append(vertslice, vertslice[total]+j)
+// horislice = append(horislice, horislice[total])
+// total++
+// }
+// case 'D':
+// for j := 0; j < displacement; j++ {
+// vertslice = append(vertslice, vertslice[total]-j)
+// horislice = append(horislice, horislice[total])
+// total++
+// }
+// default:
+// fmt.Println("Unhandled direction", string(direction))
+// os.Exit(0)
+// }
+// }
+// return horislice, vertslice, total
+// }
+
+// func taxi(directions []string, grid [4000][4000]int) [4000][4000]int { // sign convention: an array, left to right, top to bottom, beginning in the top left corner
+// x, y := len(grid)/2, len(grid[0])/2 // start in center
+// var boolgrid [4000][4000]bool
+// for i := 0; i < len(directions); i++ {
+// direction := directions[i][0]
+// displacement, err := strconv.Atoi(directions[i][1:])
+// if err != nil {
+// panic(err)
+// }
+// switch direction {
+// case 'L':
+// for j := 0; j < displacement; j++ {
+// x--
+// if !boolgrid[x][y] {
+// boolgrid[x][y] = true
+// }
+// }
+// case 'R':
+// for j := 0; j < displacement; j++ {
+// x++
+// if !boolgrid[x][y] {
+// boolgrid[x][y] = true
+// }
+// }
+// case 'U':
+// for j := 0; j < displacement; j++ {
+// y--
+// if !boolgrid[x][y] {
+// boolgrid[x][y] = true
+// }
+// }
+// case 'D':
+// for j := 0; j < displacement; j++ {
+// y++
+// if !boolgrid[x][y] {
+// boolgrid[x][y] = true
+// }
+// }
+// default:
+// fmt.Println("Unhandled direction", string(direction))
+// os.Exit(0)
+// }
+// fmt.Println(string(direction), displacement, x, y)
+// }
+// for i := 0; i < len(grid); i++ {
+// for j := 0; j < len(grid[0]); j++ {
+// if boolgrid[i][j] {
+// grid[i][j]++
+// }
+// }
+// }
+// return grid // each element is equal to the numbers of wires on it
+// }
diff --git a/2019/two.go b/2019/two.go
new file mode 100644
index 0000000..8108c87
--- /dev/null
+++ b/2019/two.go
@@ -0,0 +1,66 @@
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "os"
+ "strconv"
+)
+
+func main() {
+ var slice []int
+ start, size := 0, 0
+ if len(os.Args) < 2 {
+ panic("runtime error: missing operand")
+ }
+ file, err := ioutil.ReadFile(os.Args[1])
+ if err != nil {
+ panic(err)
+ }
+ for i := 0; i < len(file); i++ {
+ if file[i] == ',' || file[i] == '\n' {
+ arg, err := strconv.Atoi(string(file[start:i])) // i-1??
+ if err != nil {
+ panic(err)
+ }
+ slice = append(slice, arg)
+ start = i + 1
+ size++
+ }
+ }
+ noun, verb := edocpo(slice, 19690720)
+ slice[1] = 12
+ slice[2] = 2
+ fmt.Println(opcode(slice)[0])
+ fmt.Println(100*noun + verb)
+}
+
+func opcode(slice []int) []int {
+ for i := 0; i < len(slice); i += 4 {
+ if slice[i] == 1 {
+ slice[slice[i+3]] = slice[slice[i+1]] + slice[slice[i+2]]
+ } else if slice[i] == 2 {
+ slice[slice[i+3]] = slice[slice[i+1]] * slice[slice[i+2]]
+ } else if slice[i] == 99 {
+ return slice
+ } else {
+ fmt.Println("Unsupported code", slice[i], "at", i)
+ os.Exit(0)
+ }
+ }
+ return slice
+}
+
+func edocpo(slice []int, output int) (int, int) {
+ var ecils []int
+ for i := 0; i < len(slice); i++ {
+ for j := 0; j < len(slice); j++ {
+ ecils = append([]int(nil), slice...) // reset ecils to slice
+ ecils[1], ecils[2] = i, j
+ if opcode(ecils)[0] == output {
+ return i, j
+ }
+ }
+ }
+ return -1, -1
+}