move to alan branch
This commit is contained in:
128
2024/go/day20/day20.go
Normal file
128
2024/go/day20/day20.go
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
package day20
|
||||||
|
|
||||||
|
import (
|
||||||
|
"adventofcode2024/utils/dijkstra"
|
||||||
|
"adventofcode2024/utils/grid2d"
|
||||||
|
"adventofcode2024/utils/inputs"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
Vec struct{ x, y int }
|
||||||
|
Dir struct{ x, y int }
|
||||||
|
Cell rune
|
||||||
|
Move struct {
|
||||||
|
p Vec
|
||||||
|
d Dir
|
||||||
|
}
|
||||||
|
Maze struct {
|
||||||
|
height, width int
|
||||||
|
start Vec
|
||||||
|
end Vec
|
||||||
|
grid *grid2d.Grid[Cell]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
WALL Cell = '#'
|
||||||
|
CORRIDOR Cell = '.'
|
||||||
|
START Cell = 'S'
|
||||||
|
END Cell = 'E'
|
||||||
|
PATH Cell = '*'
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
NORTH = Dir{0, -1}
|
||||||
|
EAST = Dir{1, 0}
|
||||||
|
SOUTH = Dir{0, 1}
|
||||||
|
WEST = Dir{-1, 0}
|
||||||
|
DIRECTIONS = []Dir{NORTH, EAST, SOUTH, WEST}
|
||||||
|
)
|
||||||
|
|
||||||
|
func Part1(input string) int {
|
||||||
|
maze := Maze{}.Parse(input)
|
||||||
|
fmt.Println(maze)
|
||||||
|
data := inputGraph(*maze)
|
||||||
|
graph := dijkstra.CreateGraph(data)
|
||||||
|
path, dist := dijkstra.GetShortestPath(data.From, data.To, graph)
|
||||||
|
for _, p := range path {
|
||||||
|
maze.grid.Set(p.X, p.Y, PATH)
|
||||||
|
}
|
||||||
|
fmt.Println(maze)
|
||||||
|
return dist
|
||||||
|
}
|
||||||
|
func Part2(input string) int {
|
||||||
|
maze := Maze{}.Parse(input)
|
||||||
|
fmt.Println(maze)
|
||||||
|
data := inputGraph(*maze)
|
||||||
|
graph := dijkstra.CreateGraph(data)
|
||||||
|
_, count := dijkstra.GetShortestPath(data.From, data.To, graph)
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
func inputGraph(maze Maze) dijkstra.InputGraph {
|
||||||
|
data := dijkstra.InputGraph{}
|
||||||
|
data.From = dijkstra.Point{X: maze.start.x, Y: maze.start.y}
|
||||||
|
data.To = dijkstra.Point{X: maze.end.x, Y: maze.end.y}
|
||||||
|
for y := 0; y < maze.height; y++ {
|
||||||
|
for x := 0; x < maze.width; x++ {
|
||||||
|
if maze.grid.Get(x, y) == WALL {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, dir := range DIRECTIONS {
|
||||||
|
nx, ny := x+dir.x, y+dir.y
|
||||||
|
if nx < 0 || ny < 0 || nx >= maze.width || ny >= maze.height {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if maze.grid.Get(nx, ny) == WALL {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
data.Graph = append(data.Graph, dijkstra.InputData{
|
||||||
|
Source: dijkstra.Point{X: x, Y: y},
|
||||||
|
Destination: dijkstra.Point{X: nx, Y: ny},
|
||||||
|
Weight: 1,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Maze) Parse(input string) *Maze {
|
||||||
|
m.grid = inputs.ToGrid2D(input, "\n", "", '?', func(c string) Cell { return Cell(c[0]) })
|
||||||
|
m.height, m.width = m.grid.SizeY(), m.grid.SizeX()
|
||||||
|
for y := 0; y < m.height; y++ {
|
||||||
|
for x := 0; x < m.width; x++ {
|
||||||
|
c := m.grid.Get(x, y)
|
||||||
|
switch c {
|
||||||
|
case WALL, CORRIDOR:
|
||||||
|
m.grid.Set(x, y, c)
|
||||||
|
case START:
|
||||||
|
m.grid.Set(x, y, CORRIDOR)
|
||||||
|
m.start = Vec{x, y}
|
||||||
|
case END:
|
||||||
|
m.grid.Set(x, y, CORRIDOR)
|
||||||
|
m.end = Vec{x, y}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &m
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Maze) String() string {
|
||||||
|
s := ""
|
||||||
|
for y := 0; y < m.height; y++ {
|
||||||
|
for x := 0; x < m.width; x++ {
|
||||||
|
if y == m.start.y && x == m.start.x {
|
||||||
|
s += string(START)
|
||||||
|
} else if y == m.end.y && x == m.end.x {
|
||||||
|
s += string(END)
|
||||||
|
} else {
|
||||||
|
s += string(m.grid.Get(x, y))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s += "\n"
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
31
2024/go/day20/day20_test.go
Normal file
31
2024/go/day20/day20_test.go
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
package day20
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestPart1(t *testing.T) {
|
||||||
|
r := Part1(`###############
|
||||||
|
#...#...#.....#
|
||||||
|
#.#.#.#.#.###.#
|
||||||
|
#S#...#.#.#...#
|
||||||
|
#######.#.#.###
|
||||||
|
#######.#.#...#
|
||||||
|
#######.#.###.#
|
||||||
|
###..E#...#...#
|
||||||
|
###.#######.###
|
||||||
|
#...###...#...#
|
||||||
|
#.#####.#.###.#
|
||||||
|
#.#...#.#.#...#
|
||||||
|
#.#.#.#.#.#.###
|
||||||
|
#...#...#...###
|
||||||
|
###############`)
|
||||||
|
require.Equal(t, 100, r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPart2(t *testing.T) {
|
||||||
|
r := Part2("")
|
||||||
|
require.Equal(t, 0, r)
|
||||||
|
}
|
||||||
141
2024/go/day20/input.txt
Normal file
141
2024/go/day20/input.txt
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
#############################################################################################################################################
|
||||||
|
#.........#...#...###...#...###...###...###...........#.....#...#.....#...###...#...#...#...#...###...#.....#.......#...###.............#...#
|
||||||
|
#.#######.#.#.#.#.###.#.#.#.###.#.###.#.###.#########.#.###.#.#.#.###.#.#.###.#.#.#.#.#.#.#.#.#.###.#.#.###.#.#####.#.#.###.###########.#.#.#
|
||||||
|
#.......#.#.#.#.#.#...#...#.#...#...#.#.....#...#...#.#...#.#.#.#...#.#.#.#...#...#.#.#.#.#.#.#...#.#.#.#...#...#...#.#.#...#...#.......#.#.#
|
||||||
|
#######.#.#.#.#.#.#.#######.#.#####.#.#######.#.#.#.#.###.#.#.#.###.#.#.#.#.#######.#.#.#.#.#.###.#.#.#.#.#####.#.###.#.#.###.#.#.#######.#.#
|
||||||
|
###...#.#.#.#.#.#.#.......#...#...#.#.#.......#...#...#...#.#.#.###.#.#.#.#.#.......#.#.#.#.#...#.#.#...#.#...#.#.#...#.#.#...#...###...#.#.#
|
||||||
|
###.#.#.#.#.#.#.#.#######.#####.#.#.#.#.###############.###.#.#.###.#.#.#.#.#.#######.#.#.#.###.#.#.#####.#.#.#.#.#.###.#.#.#########.#.#.#.#
|
||||||
|
#...#...#.#.#.#.#.###...#.....#.#...#.#.#...#...#...###...#.#.#.....#.#.#...#.......#.#.#.#.#...#.#.....#.#.#.#.#...#...#.#.#...#...#.#.#.#.#
|
||||||
|
#.#######.#.#.#.#.###.#.#####.#.#####.#.#.#.#.#.#.#.#####.#.#.#######.#.###########.#.#.#.#.#.###.#####.#.#.#.#.#####.###.#.#.#.#.#.#.#.#.#.#
|
||||||
|
#...#.....#.#...#.....#.#.....#...#...#.#.#.#.#...#.#.....#.#.......#.#.#...........#.#.#.#.#...#.......#...#.#.....#...#.#.#.#.#.#.#.#...#.#
|
||||||
|
###.#.#####.###########.#.#######.#.###.#.#.#.#####.#.#####.#######.#.#.#.###########.#.#.#.###.#############.#####.###.#.#.#.#.#.#.#.#####.#
|
||||||
|
#...#.#...#...........#.#.....#...#...#.#.#...#.....#.#...#...###...#.#.#.###...#...#.#.#.#...#.#...#.......#.###...#...#.#...#...#...#.....#
|
||||||
|
#.###.#.#.###########.#.#####.#.#####.#.#.#####.#####.#.#.###.###.###.#.#.###.#.#.#.#.#.#.###.#.#.#.#.#####.#.###.###.###.#############.#####
|
||||||
|
#...#.#.#.###.....#...#.......#.....#.#.#...#...#...#...#...#...#...#.#.#...#.#.#.#...#.#.#...#...#...#...#.#.#...#...#...#...#.........#...#
|
||||||
|
###.#.#.#.###.###.#.###############.#.#.###.#.###.#.#######.###.###.#.#.###.#.#.#.#####.#.#.###########.#.#.#.#.###.###.###.#.#.#########.#.#
|
||||||
|
#...#...#.....#...#...#...........#.#.#.....#...#.#.###...#.#...###.#.#.#...#.#...#.....#.#.#...#####...#.#.#.#.#...#...#...#.#...........#.#
|
||||||
|
#.#############.#####.#.#########.#.#.#########.#.#.###.#.#.#.#####.#.#.#.###.#####.#####.#.#.#.#####.###.#.#.#.#.###.###.###.#############.#
|
||||||
|
#.......#.....#...###...#...#.....#.#.....#.....#.#...#.#.#.#.......#...#...#.....#.#...#.#.#.#...#...#...#.#.#.#.....#...###.......#.......#
|
||||||
|
#######.#.###.###.#######.#.#.#####.#####.#.#####.###.#.#.#.###############.#####.#.#.#.#.#.#.###.#.###.###.#.#.#######.###########.#.#######
|
||||||
|
#.....#...###...#...###...#.#.#...#.#.....#...###.#...#.#.#.......#.......#...#...#.#.#.#.#.#...#.#...#.#...#...#.....#.........###.#.......#
|
||||||
|
#.###.#########.###.###.###.#.#.#.#.#.#######.###.#.###.#.#######.#.#####.###.#.###.#.#.#.#.###.#.###.#.#.#######.###.#########.###.#######.#
|
||||||
|
#...#...###...#...#...#...#...#.#...#.......#.....#.###.#.....###...#.....#...#.#...#.#...#.#...#.#...#.#.#.......###.#.......#.#...#...#...#
|
||||||
|
###.###.###.#.###.###.###.#####.###########.#######.###.#####.#######.#####.###.#.###.#####.#.###.#.###.#.#.#########.#.#####.#.#.###.#.#.###
|
||||||
|
#...#...#...#...#...#...#.....#...#.....#...#.......#...#.....#.....#.....#.#...#.#...#.....#...#.#...#.#.#.........#.#.....#...#.....#...###
|
||||||
|
#.###.###.#####.###.###.#####.###.#.###.#.###.#######.###.#####.###.#####.#.#.###.#.###.#######.#.###.#.#.#########.#.#####.#################
|
||||||
|
#...#...#.....#.###...#.#...#...#.#.#...#...#.###...#...#.....#...#...#...#...#...#...#.....#...#.#...#...#.....#...#.......#...#.....#.....#
|
||||||
|
###.###.#####.#.#####.#.#.#.###.#.#.#.#####.#.###.#.###.#####.###.###.#.#######.#####.#####.#.###.#.#######.###.#.###########.#.#.###.#.###.#
|
||||||
|
#...#...###...#.#.....#...#.....#.#.#.#.....#...#.#.#...#.....#...#...#...#.....#####.....#...#...#...#.....###...#...###...#.#...#...#.#...#
|
||||||
|
#.###.#####.###.#.###############.#.#.#.#######.#.#.#.###.#####.###.#####.#.#############.#####.#####.#.###########.#.###.#.#.#####.###.#.###
|
||||||
|
#.#...#...#...#.#.......#...#...#...#.#.#.......#.#...#...#...#...#.#####.#.#...###...###...#...#...#.#...#.....###.#.....#.#.#.....###.#...#
|
||||||
|
#.#.###.#.###.#.#######.#.#.#.#.#####.#.#.#######.#####.###.#.###.#.#####.#.#.#.###.#.#####.#.###.#.#.###.#.###.###.#######.#.#.#######.###.#
|
||||||
|
#.#...#.#...#.#.#.......#.#...#.#...#.#.#.#.....#.....#.....#.#...#...#...#.#.#...#.#.#.....#...#.#.#.#...#.#...#...#.......#.#.........#...#
|
||||||
|
#.###.#.###.#.#.#.#######.#####.#.#.#.#.#.#.###.#####.#######.#.#####.#.###.#.###.#.#.#.#######.#.#.#.#.###.#.###.###.#######.###########.###
|
||||||
|
#.#...#.#...#.#...#.......#...#.#.#.#.#.#.#.#...#...#.......#.#...#...#...#.#.#...#.#.#.....#...#.#.#.#.###.#.....#...#...###.#.........#...#
|
||||||
|
#.#.###.#.###.#####.#######.#.#.#.#.#.#.#.#.#.###.#.#######.#.###.#.#####.#.#.#.###.#.#####.#.###.#.#.#.###.#######.###.#.###.#.#######.###.#
|
||||||
|
#.#.#...#...#.......#...###.#.#...#.#...#.#.#.#...#...#...#.#...#.#.#...#.#.#.#...#.#.#...#.#.#...#.#.#.....#.....#.....#.....#.......#...#.#
|
||||||
|
#.#.#.#####.#########.#.###.#.#####.#####.#.#.#.#####.#.#.#.###.#.#.#.#.#.#.#.###.#.#.#.#.#.#.#.###.#.#######.###.###################.###.#.#
|
||||||
|
#.#.#.....#.#...#.....#...#.#.....#.....#.#.#.#...#...#.#.#...#.#.#...#.#.#...###...#...#.#.#...###.#...#.....###...#.......#...#...#.#...#.#
|
||||||
|
#.#.#####.#.#.#.#.#######.#.#####.#####.#.#.#.###.#.###.#.###.#.#.#####.#.###############.#.#######.###.#.#########.#.#####.#.#.#.#.#.#.###.#
|
||||||
|
#.#.......#.#.#.#.......#.#.....#.......#...#...#.#.#...#...#.#...#.....#...........#.....#...#...#.....#.........#.#.....#.#.#...#.#.#...#.#
|
||||||
|
#.#########.#.#.#######.#.#####.###############.#.#.#.#####.#.#####.###############.#.#######.#.#.###############.#.#####.#.#.#####.#.###.#.#
|
||||||
|
#.........#.#.#.#...#...#...###.............#...#.#.#...#...#.#.....#.....#.....#...#.....#...#.#.................#.......#...#...#...#...#.#
|
||||||
|
#########.#.#.#.#.#.#.#####.###############.#.###.#.###.#.###.#.#####.###.#.###.#.#######.#.###.###############################.#.#####.###.#
|
||||||
|
#.........#...#...#...#...#...#.........#...#...#.#.#...#...#.#...#...#E..#...#.#...#.....#...#.....#...........................#.....#...#.#
|
||||||
|
#.#####################.#.###.#.#######.#.#####.#.#.#.#####.#.###.#.#########.#.###.#.#######.#####.#.###############################.###.#.#
|
||||||
|
#.........#...#.........#.#...#.......#.#.....#...#.#.#...#...###...#########.#.#...#.#...#...#.....#.#.........#.............#...#...#...#.#
|
||||||
|
#########.#.#.#.#########.#.#########.#.#####.#####.#.#.#.###################.#.#.###.#.#.#.###.#####.#.#######.#.###########.#.#.#.###.###.#
|
||||||
|
#.........#.#.#.#.........#.....###...#.#.....#.....#...#.....###############.#.#.#...#.#.#...#.......#.......#...#.........#...#.#...#.....#
|
||||||
|
#.#########.#.#.#.#############.###.###.#.#####.#############.###############.#.#.#.###.#.###.###############.#####.#######.#####.###.#######
|
||||||
|
#.........#.#.#.#.......#.....#.....###...#...#.....#...#.....###############.#...#.#...#...#.#...............#...#.#.....#.....#...#.#.....#
|
||||||
|
#########.#.#.#.#######.#.###.#############.#.#####.#.#.#.###################.#####.#.#####.#.#.###############.#.#.#.###.#####.###.#.#.###.#
|
||||||
|
#.........#.#.#.#.....#...###.......#...#...#.....#.#.#.#.....###############.....#...#...#...#...#.............#...#...#.......#...#...#...#
|
||||||
|
#.#########.#.#.#.###.#############.#.#.#.#######.#.#.#.#####.###################.#####.#.#######.#.###################.#########.#######.###
|
||||||
|
#...#...#...#...#...#.............#...#...#.......#...#.#.....###################.....#.#.........#.#...........#.......#.....###.......#...#
|
||||||
|
###.#.#.#.#########.#############.#########.###########.#.###########################.#.###########.#.#########.#.#######.###.#########.###.#
|
||||||
|
###...#...#.........#...#.......#.....#...#.....#...#...#.....###################...#.#...#.........#.........#...#...#...#...#...#...#.....#
|
||||||
|
###########.#########.#.#.#####.#####.#.#.#####.#.#.#.#######.###################.#.#.###.#.#################.#####.#.#.###.###.#.#.#.#######
|
||||||
|
#...###...#...........#...#.....#...#...#.......#.#.#.........###################.#...###...#...............#.......#.#.#...###.#...#.......#
|
||||||
|
#.#.###.#.#################.#####.#.#############.#.#############################.###########.#############.#########.#.#.#####.###########.#
|
||||||
|
#.#...#.#.#...#...#.........#.....#...............#.......#...###################...#...#...#.....#.......#.....#...#...#.#...#.#...........#
|
||||||
|
#.###.#.#.#.#.#.#.#.#########.###########################.#.#.#####################.#.#.#.#.#####.#.#####.#####.#.#.#####.#.#.#.#.###########
|
||||||
|
#...#...#...#.#.#.#...#.......#...#...#...#...#...#...#...#.#...#############...#...#.#...#.......#.#.....#...#...#.....#...#...#.....#.....#
|
||||||
|
###.#########.#.#.###.#.#######.#.#.#.#.#.#.#.#.#.#.#.#.###.###.#############.#.#.###.#############.#.#####.#.#########.#############.#.###.#
|
||||||
|
###.....#...#...#.###...#...#...#...#...#.#.#...#.#.#...#...#...#############.#.#.#...#...#.........#.......#...#.....#...............#.#...#
|
||||||
|
#######.#.#.#####.#######.#.#.###########.#.#####.#.#####.###.###############.#.#.#.###.#.#.###################.#.###.#################.#.###
|
||||||
|
###...#...#.....#.....#...#...#.....#...#...#...#...#...#...#.###############.#...#.....#.#.#.........###.......#.#...#.......#...###...#...#
|
||||||
|
###.#.#########.#####.#.#######.###.#.#.#####.#.#####.#.###.#.###############.###########.#.#.#######.###.#######.#.###.#####.#.#.###.#####.#
|
||||||
|
#...#...........#...#...#...#...###...#...#...#.......#.....#...#...###...#S..###...#...#...#...#...#.....#...#...#...#.#.....#.#...#.#...#.#
|
||||||
|
#.###############.#.#####.#.#.###########.#.###################.#.#.###.#.#######.#.#.#.#######.#.#.#######.#.#.#####.#.#.#####.###.#.#.#.#.#
|
||||||
|
#...#.....#...#...#...#...#...#.......#...#...#...........#...#...#.....#...#.....#.#.#.###...#...#.........#...#...#...#...###.#...#.#.#...#
|
||||||
|
###.#.###.#.#.#.#####.#.#######.#####.#.#####.#.#########.#.#.#############.#.#####.#.#.###.#.###################.#.#######.###.#.###.#.#####
|
||||||
|
###...#...#.#.#.#...#...#...###.....#.#...#...#.....#...#.#.#.#...#.....#...#...#...#.#.....#.......#...........#.#.#.....#.....#.....#.....#
|
||||||
|
#######.###.#.#.#.#.#####.#.#######.#.###.#.#######.#.#.#.#.#.#.#.#.###.#.#####.#.###.#############.#.#########.#.#.#.###.#################.#
|
||||||
|
###...#.....#...#.#.......#.......#.#.....#.#.......#.#.#...#...#.#...#.#.#.....#...#.............#.#.........#...#...###.....#.....#.......#
|
||||||
|
###.#.###########.###############.#.#######.#.#######.#.#########.###.#.#.#.#######.#############.#.#########.###############.#.###.#.#######
|
||||||
|
#...#.#...#...###...............#.#.....#...#.#...#...#.....#.....#...#...#.......#...#...#.......#.....#...#.........#...###...###.#.......#
|
||||||
|
#.###.#.#.#.#.#################.#.#####.#.###.#.#.#.#######.#.#####.#############.###.#.#.#.###########.#.#.#########.#.#.#########.#######.#
|
||||||
|
#...#.#.#...#...................#.....#.#...#...#...#.......#.......###.....#...#...#.#.#.#...........#...#.#.......#...#.........#.#.......#
|
||||||
|
###.#.#.#############################.#.###.#########.#################.###.#.#.###.#.#.#.###########.#####.#.#####.#############.#.#.#######
|
||||||
|
#...#...#.....#.....................#.#.....#.......#.......#.....#...#...#...#.....#...#.....#.....#.....#.#.....#...#...#...#...#.#.#...###
|
||||||
|
#.#######.###.#.###################.#.#######.#####.#######.#.###.#.#.###.###################.#.###.#####.#.#####.###.#.#.#.#.#.###.#.#.#.###
|
||||||
|
#...#.....###.#.#.................#.#.#.....#.#...#.......#...#...#.#.###.........#...#.....#.#...#.###...#.....#...#.#.#.#.#...#...#...#...#
|
||||||
|
###.#.#######.#.#.###############.#.#.#.###.#.#.#.#######.#####.###.#.###########.#.#.#.###.#.###.#.###.#######.###.#.#.#.#.#####.#########.#
|
||||||
|
###.#.#.....#...#...............#...#.#.#...#...#.......#.......#...#.#...#...#...#.#.#.#...#.###.#...#.......#.....#...#...#...#.....#...#.#
|
||||||
|
###.#.#.###.###################.#####.#.#.#############.#########.###.#.#.#.#.#.###.#.#.#.###.###.###.#######.###############.#.#####.#.#.#.#
|
||||||
|
#...#.#...#.#...###.............#...#...#...#.....#...#...#...###...#...#.#.#.#...#.#.#.#...#.....#...#.......#.......#...###.#...###...#...#
|
||||||
|
#.###.###.#.#.#.###.#############.#.#######.#.###.#.#.###.#.#.#####.#####.#.#.###.#.#.#.###.#######.###.#######.#####.#.#.###.###.###########
|
||||||
|
#.....###.#.#.#.#...#.....#.......#.......#.#...#...#.....#.#.....#...#...#.#...#...#...###...#...#...#.......#.#.....#.#...#...#.#.........#
|
||||||
|
#########.#.#.#.#.###.###.#.#############.#.###.###########.#####.###.#.###.###.#############.#.#.###.#######.#.#.#####.###.###.#.#.#######.#
|
||||||
|
#...#.....#.#.#.#.....#...#.#.............#.#...#.......###.#.....#...#...#...#...#...#...###...#...#.......#.#.#...###...#.....#.#.#.......#
|
||||||
|
#.#.#.#####.#.#.#######.###.#.#############.#.###.#####.###.#.#####.#####.###.###.#.#.#.#.#########.#######.#.#.###.#####.#######.#.#.#######
|
||||||
|
#.#.#.....#.#.#.#...###.....#...#...#...###.#...#.....#.#...#...#...#.....#...#...#.#.#.#.#...#.....#.....#...#.#...#...#.#.....#...#.......#
|
||||||
|
#.#.#####.#.#.#.#.#.###########.#.#.#.#.###.###.#####.#.#.#####.#.###.#####.###.###.#.#.#.#.#.#.#####.###.#####.#.###.#.#.#.###.###########.#
|
||||||
|
#.#.#.....#...#...#.#...#.....#...#...#...#.#...#.....#.#.....#.#.#...#...#.#...###.#.#.#.#.#.#.......###.......#.....#...#...#.#...#...#...#
|
||||||
|
#.#.#.#############.#.#.#.###.###########.#.#.###.#####.#####.#.#.#.###.#.#.#.#####.#.#.#.#.#.###############################.#.#.#.#.#.#.###
|
||||||
|
#.#.#.....#.......#.#.#.#...#.#...........#...###.....#...###.#.#.#...#.#...#.....#.#...#.#.#...#...........#.....#...#...#...#...#.#.#...###
|
||||||
|
#.#.#####.#.#####.#.#.#.###.#.#.#####################.###.###.#.#.###.#.#########.#.#####.#.###.#.#########.#.###.#.#.#.#.#.#######.#.#######
|
||||||
|
#.#.......#.#.....#...#...#.#.#.................#.....#...#...#.#.#...#.........#.#...#...#...#.#.........#.#...#...#...#.#.......#.#...#...#
|
||||||
|
#.#########.#.###########.#.#.#################.#.#####.###.###.#.#.###########.#.###.#.#####.#.#########.#.###.#########.#######.#.###.#.#.#
|
||||||
|
#.#.........#...........#...#.....#.............#.....#.#...#...#.#.###...#.....#.#...#.#.....#.#...#.....#.....###...###.........#.....#.#.#
|
||||||
|
#.#.###################.#########.#.#################.#.#.###.###.#.###.#.#.#####.#.###.#.#####.#.#.#.#############.#.###################.#.#
|
||||||
|
#...#.......###...#.....#...#...#...#.....#.....#.....#.#...#.#...#...#.#.#.#...#.#.#...#...#...#.#.#...........#...#.....###...###.......#.#
|
||||||
|
#####.#####.###.#.#.#####.#.#.#.#####.###.#.###.#.#####.###.#.#.#####.#.#.#.#.#.#.#.#.#####.#.###.#.###########.#.#######.###.#.###.#######.#
|
||||||
|
###...#...#.....#...#...#.#...#.....#.#...#...#.#.....#.###.#.#...#...#.#.#...#.#.#.#.#...#.#.###.#.#...#.....#...#.......#...#.....#.......#
|
||||||
|
###.###.#.###########.#.#.#########.#.#.#####.#.#####.#.###.#.###.#.###.#.#####.#.#.#.#.#.#.#.###.#.#.#.#.###.#####.#######.#########.#######
|
||||||
|
#...#...#.......#...#.#...###.......#.#...#...#...#...#.#...#.#...#.#...#...#...#.#.#.#.#.#.#.#...#...#.#...#.#...#.#...#...#.....#...#.....#
|
||||||
|
#.###.#########.#.#.#.#######.#######.###.#.#####.#.###.#.###.#.###.#.#####.#.###.#.#.#.#.#.#.#.#######.###.#.#.#.#.#.#.#.###.###.#.###.###.#
|
||||||
|
#...#.#.........#.#.#.#.......#.....#.#...#...###...###.#...#.#.#...#.#.....#.###.#.#.#.#.#.#.#.....###...#.#.#.#.#...#.#...#.###.#.###.#...#
|
||||||
|
###.#.#.#########.#.#.#.#######.###.#.#.#####.#########.###.#.#.#.###.#.#####.###.#.#.#.#.#.#.#####.#####.#.#.#.#.#####.###.#.###.#.###.#.###
|
||||||
|
###...#.......#...#.#.#.#.......#...#.#...#...#.........#...#.#.#.....#.#...#...#.#.#.#.#.#.#.#.....#.....#.#.#.#.....#.....#...#.#.....#...#
|
||||||
|
#############.#.###.#.#.#.#######.###.###.#.###.#########.###.#.#######.#.#.###.#.#.#.#.#.#.#.#.#####.#####.#.#.#####.#########.#.#########.#
|
||||||
|
#...#.........#.###...#...#.......#...###.#.###...#.....#.#...#.......#...#.#...#.#.#.#.#.#.#.#.#.....#...#.#.#.....#...#...#...#.....#...#.#
|
||||||
|
#.#.#.#########.###########.#######.#####.#.#####.#.###.#.#.#########.#####.#.###.#.#.#.#.#.#.#.#.#####.#.#.#.#####.###.#.#.#.#######.#.#.#.#
|
||||||
|
#.#.#.....#...#.......#.....#...#...#...#.#.#.....#...#...#...#.....#.#.....#...#...#.#.#...#...#...#...#.#.#...#...###.#.#.#.......#.#.#.#.#
|
||||||
|
#.#.#####.#.#.#######.#.#####.#.#.###.#.#.#.#.#######.#######.#.###.#.#.#######.#####.#.###########.#.###.#.###.#.#####.#.#.#######.#.#.#.#.#
|
||||||
|
#.#.......#.#.#.......#.....#.#.#.#...#...#.#.#...#...###.....#.###...#.....#...#...#...#...........#.###.#...#.#.#.....#.#.........#.#.#.#.#
|
||||||
|
#.#########.#.#.###########.#.#.#.#.#######.#.#.#.#.#####.#####.###########.#.###.#.#####.###########.###.###.#.#.#.#####.###########.#.#.#.#
|
||||||
|
#...........#.#.###...###...#.#.#.#...#.....#...#.#.#.....#...#.......#.....#.....#.....#...........#...#...#.#...#.#...#...###.....#.#.#.#.#
|
||||||
|
#############.#.###.#.###.###.#.#.###.#.#########.#.#.#####.#.#######.#.###############.###########.###.###.#.#####.#.#.###.###.###.#.#.#.#.#
|
||||||
|
#...#.......#.#.....#...#.#...#.#.###...###.......#.#.......#...#.....#...#...#...#...#...#.........#...###.#...#...#.#...#...#...#.#...#...#
|
||||||
|
#.#.#.#####.#.#########.#.#.###.#.#########.#######.###########.#.#######.#.#.#.#.#.#.###.#.#########.#####.###.#.###.###.###.###.#.#########
|
||||||
|
#.#.#.....#...#.....#...#.#...#.#.#.........#...#...#.........#...#...#...#.#.#.#...#...#.#.#.......#.....#.#...#.#...#...#...###.#.........#
|
||||||
|
#.#.#####.#####.###.#.###.###.#.#.#.#########.#.#.###.#######.#####.#.#.###.#.#.#######.#.#.#.#####.#####.#.#.###.#.###.###.#####.#########.#
|
||||||
|
#.#.......#...#...#.#.#...#...#.#.#.#.....#...#.#...#...#...#...###.#...#...#.#.......#.#.#...#.....#.....#.#...#.#...#...#.......#...#...#.#
|
||||||
|
#.#########.#.###.#.#.#.###.###.#.#.#.###.#.###.###.###.#.#.###.###.#####.###.#######.#.#.#####.#####.#####.###.#.###.###.#########.#.#.#.#.#
|
||||||
|
#.#.......#.#.#...#.#.#...#...#...#...#...#.#...#...#...#.#...#.....#.....###.#.......#...#.....#...#.....#.....#.....###.......#...#...#.#.#
|
||||||
|
#.#.#####.#.#.#.###.#.###.###.#########.###.#.###.###.###.###.#######.#######.#.###########.#####.#.#####.#####################.#.#######.#.#
|
||||||
|
#.#.#.....#.#.#.###...###...#...###...#.....#...#...#...#.###...#...#.......#.#...#.......#.#.....#.#...#...............#.......#.....###...#
|
||||||
|
#.#.#.#####.#.#.###########.###.###.#.#########.###.###.#.#####.#.#.#######.#.###.#.#####.#.#.#####.#.#.###############.#.###########.#######
|
||||||
|
#.#.#...#...#.#.....#...#...#...#...#.#...#.....#...###.#.#.....#.#.#...#...#...#...#...#.#.#...#...#.#.#.......#.....#.#...#...#...#...#...#
|
||||||
|
#.#.###.#.###.#####.#.#.#.###.###.###.#.#.#.#####.#####.#.#.#####.#.#.#.#.#####.#####.#.#.#.###.#.###.#.#.#####.#.###.#.###.#.#.#.#.###.#.#.#
|
||||||
|
#...#...#...#.#...#.#.#...#...###...#...#...#...#...#...#.#.#...#.#.#.#.#.....#...#...#...#...#.#...#.#.#.....#.#...#...#...#.#.#.#.#...#.#.#
|
||||||
|
#####.#####.#.#.#.#.#.#####.#######.#########.#.###.#.###.#.#.#.#.#.#.#.#####.###.#.#########.#.###.#.#.#####.#.###.#####.###.#.#.#.#.###.#.#
|
||||||
|
#...#...#...#.#.#...#.#...#.###.....#...#.....#.#...#...#.#...#...#...#.#...#.###.#.....#####...###.#.#.......#.#...#.....#...#.#.#.#.....#.#
|
||||||
|
#.#.###.#.###.#.#####.#.#.#.###.#####.#.#.#####.#.#####.#.#############.#.#.#.###.#####.###########.#.#########.#.###.#####.###.#.#.#######.#
|
||||||
|
#.#.....#...#.#.#.....#.#.#...#...#...#...#.....#...###.#.###...........#.#...#...#...#...#...#.....#.........#.#.###.....#.###.#.#.#...#...#
|
||||||
|
#.#########.#.#.#.#####.#.###.###.#.#######.#######.###.#.###.###########.#####.###.#.###.#.#.#.#############.#.#.#######.#.###.#.#.#.#.#.###
|
||||||
|
#.#...#...#.#.#.#...#...#...#...#.#.#.......#...#...#...#.#...#...#...#...#.....#...#...#...#.#...#...#...#...#.#.#.......#...#.#.#.#.#.#...#
|
||||||
|
#.#.#.#.#.#.#.#.###.#.#####.###.#.#.#.#######.#.#.###.###.#.###.#.#.#.#.###.#####.#####.#####.###.#.#.#.#.#.###.#.#.#########.#.#.#.#.#.###.#
|
||||||
|
#...#...#...#...###...#####.....#...#.........#...###.....#.....#...#...###.......#####.......###...#...#...###...#...........#...#...#.....#
|
||||||
|
#############################################################################################################################################
|
||||||
@@ -99,7 +99,7 @@ func main() {
|
|||||||
|
|
||||||
// Reads day from os.Args.
|
// Reads day from os.Args.
|
||||||
func day() int {
|
func day() int {
|
||||||
latest := 18
|
latest := 19
|
||||||
if len(os.Args) == 1 {
|
if len(os.Args) == 1 {
|
||||||
return latest
|
return latest
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user