This commit is contained in:
@@ -32,15 +32,15 @@ func run(scan *bufio.Scanner) (*result, error) {
|
||||
|
||||
options := make([]int, 2*(rows+cols)+2)
|
||||
i := 0
|
||||
for j:=0; j<=rows-1; j++ {
|
||||
for j := 0; j <= rows-1; j++ {
|
||||
options[i+0] = runCycle(m, ray{[2]int{j, -1}, RT})
|
||||
options[i+1] = runCycle(m, ray{[2]int{j, cols}, LF})
|
||||
i+=2
|
||||
i += 2
|
||||
}
|
||||
for j:=0; j<=cols-1; j++ {
|
||||
for j := 0; j <= cols-1; j++ {
|
||||
options[i+0] = runCycle(m, ray{[2]int{-1, j}, DN})
|
||||
options[i+1] = runCycle(m, ray{[2]int{rows, j}, UP})
|
||||
i+=2
|
||||
i += 2
|
||||
}
|
||||
|
||||
// fmt.Println(options)
|
||||
@@ -96,7 +96,6 @@ func (m *Map) Get(p [2]int) rune {
|
||||
return (*m)[p[0]][p[1]]
|
||||
}
|
||||
|
||||
|
||||
func runCycle(m Map, r ray) int {
|
||||
current := r
|
||||
|
||||
@@ -186,4 +185,4 @@ func runCycle(m Map, r ray) int {
|
||||
// }
|
||||
|
||||
return len(energized)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,4 +47,4 @@ func TestStack(t *testing.T) {
|
||||
s := stack[int]{}
|
||||
s.Push(5)
|
||||
is.Equal(s.Pop(), 5)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user