Browse Source

(╯°□°)╯︵ ┻━┻

master
Chris Smith 4 years ago
parent
commit
ed6bf00d19
Signed by: Chris Smith <chris@chameth.com> GPG Key ID: 3A2D4BBDC4A3C9A9
3 changed files with 0 additions and 63 deletions
  1. 0
    2
      19/answers.txt
  2. 0
    1
      19/input.txt
  3. 0
    60
      19/main.go

+ 0
- 2
19/answers.txt View File

@@ -1,2 +0,0 @@
1
-141
2
-15641348

+ 0
- 1
19/input.txt View File

@@ -1 +0,0 @@
1
-109,424,203,1,21102,11,1,0,1105,1,282,21102,1,18,0,1105,1,259,1201,1,0,221,203,1,21101,0,31,0,1105,1,282,21102,38,1,0,1106,0,259,21001,23,0,2,22101,0,1,3,21101,0,1,1,21102,1,57,0,1105,1,303,2101,0,1,222,21001,221,0,3,20102,1,221,2,21102,259,1,1,21101,80,0,0,1106,0,225,21101,0,111,2,21102,1,91,0,1105,1,303,2102,1,1,223,20101,0,222,4,21102,1,259,3,21102,1,225,2,21102,1,225,1,21101,0,118,0,1105,1,225,20101,0,222,3,21102,148,1,2,21102,1,133,0,1106,0,303,21202,1,-1,1,22001,223,1,1,21102,148,1,0,1106,0,259,2101,0,1,223,20102,1,221,4,21001,222,0,3,21101,0,17,2,1001,132,-2,224,1002,224,2,224,1001,224,3,224,1002,132,-1,132,1,224,132,224,21001,224,1,1,21101,0,195,0,106,0,109,20207,1,223,2,20102,1,23,1,21102,-1,1,3,21101,0,214,0,1105,1,303,22101,1,1,1,204,1,99,0,0,0,0,109,5,2102,1,-4,249,22101,0,-3,1,21202,-2,1,2,21202,-1,1,3,21102,1,250,0,1105,1,225,22102,1,1,-4,109,-5,2106,0,0,109,3,22107,0,-2,-1,21202,-1,2,-1,21201,-1,-1,-1,22202,-1,-2,-2,109,-3,2105,1,0,109,3,21207,-2,0,-1,1206,-1,294,104,0,99,22102,1,-2,-2,109,-3,2106,0,0,109,5,22207,-3,-4,-1,1206,-1,346,22201,-4,-3,-4,21202,-3,-1,-1,22201,-4,-1,2,21202,2,-1,-1,22201,-4,-1,1,21202,-2,1,3,21101,0,343,0,1105,1,303,1105,1,415,22207,-2,-3,-1,1206,-1,387,22201,-3,-2,-3,21202,-2,-1,-1,22201,-3,-1,3,21202,3,-1,-1,22201,-3,-1,2,21201,-4,0,1,21102,384,1,0,1106,0,303,1105,1,415,21202,-4,-1,-4,22201,-4,-3,-4,22202,-3,-2,-2,22202,-2,-4,-4,22202,-3,-2,-3,21202,-4,-1,-2,22201,-3,-2,1,21202,1,1,-4,109,-5,2106,0,0

+ 0
- 60
19/main.go View File

@@ -1,60 +0,0 @@
1
-package main
2
-
3
-import (
4
-	"fmt"
5
-	"github.com/csmith/aoc-2019/common"
6
-	"github.com/csmith/aoc-2019/intcode"
7
-)
8
-
9
-const shipSize = 100
10
-
11
-func main() {
12
-	input := common.ReadCsvAsInts("19/input.txt")
13
-	vm := intcode.NewVirtualMachine(make([]int, len(input)))
14
-
15
-	var endPositions [shipSize]int
16
-	endIndex := 0
17
-
18
-	sum := 0
19
-	lastStart := 0
20
-	lastWidth := 0
21
-	for y := 0; ; y++ {
22
-		first := 0
23
-
24
-		for x := lastStart; ; x++ {
25
-			vm.Reset(input)
26
-			if *vm.RunForInput(x, y) == 1 {
27
-				if first == 0 {
28
-					first = x
29
-					if y > 50 {
30
-						x += lastWidth
31
-					}
32
-				}
33
-				if x < 50 && y < 50 {
34
-					sum++
35
-				}
36
-			} else if first > 0 || y < 50 && x > 50 {
37
-				// For y < 50 if we hit x > 50 without finding the beam, assume it's not there. (The beam isn't
38
-				// continuous at the start, there's a couple of blanks).
39
-
40
-				if x-first >= shipSize-1 {
41
-					previousEnd := endPositions[endIndex]
42
-
43
-					if previousEnd-shipSize >= first-1 {
44
-						fmt.Println(sum)
45
-						fmt.Println((previousEnd-shipSize)*10000 + (y - 100))
46
-						return
47
-					}
48
-
49
-					endPositions[endIndex] = x
50
-					endIndex = (endIndex + 1) % shipSize
51
-				}
52
-
53
-				lastWidth = x - first - 1
54
-				break
55
-			}
56
-		}
57
-
58
-		lastStart = first
59
-	}
60
-}

Loading…
Cancel
Save