2023 Day 18 Complete!

This commit is contained in:
Brian Buller 2023-12-18 06:54:10 -06:00
parent d64a18280f
commit c3ecf7a911
6 changed files with 856 additions and 1 deletions

View File

@ -44,7 +44,7 @@ func part2(m h.CoordByteMap, loop []h.Coordinate) {
for x := m.TLX; x <= m.BRX; x++ {
wrk := h.Coordinate{X: x, Y: y}
wrkV := m.Get(wrk)
if h.CoordListContains(wrk, loop) { //&& (wrkV == NS || wrkV == NE || wrkV == NW) {
if h.CoordListContains(wrk, loop) {
// This coordinate is part of the loop, so it can change the 'inside' flag
// A corner _only_ changes the flag if the 'exiting' corner continues in the same direction
// i.e.: L--J doesn't change the flag, L--7 does change the flag

604
2023/day18/input Normal file
View File

@ -0,0 +1,604 @@
R 2 (#3e6b80)
U 6 (#2b1de3)
R 4 (#1465b0)
U 2 (#549d23)
R 6 (#aa9992)
U 6 (#27e7f3)
R 7 (#aa9990)
U 6 (#5a3933)
R 5 (#1465b2)
U 5 (#23ade3)
R 4 (#49b5b2)
U 6 (#39ad53)
R 7 (#54c4f2)
U 5 (#491513)
R 9 (#4f5960)
U 5 (#357be3)
R 3 (#4f2140)
U 6 (#258b43)
R 4 (#4f9570)
U 3 (#1ea371)
R 8 (#7be6c0)
U 5 (#67bd61)
R 5 (#a31240)
U 6 (#6bf7d1)
R 5 (#a31242)
U 4 (#3464a1)
R 3 (#7be6c2)
U 4 (#33f091)
R 5 (#5c0530)
U 6 (#4c4e11)
R 2 (#611e90)
U 3 (#128231)
R 6 (#5ecef2)
D 9 (#6eb251)
R 5 (#5e54d2)
U 9 (#1e8081)
R 3 (#73a8b0)
U 10 (#6dc731)
R 3 (#84d470)
U 2 (#6b91a1)
R 7 (#64edf0)
U 5 (#4da881)
R 10 (#710072)
D 5 (#4aa4f1)
R 7 (#4dd192)
D 6 (#4aa4f3)
R 3 (#2af062)
D 6 (#6fabe1)
R 5 (#177cc0)
U 5 (#26ba61)
R 5 (#5a3aa0)
U 9 (#3b5401)
R 5 (#012590)
U 2 (#747f11)
R 4 (#753b32)
U 7 (#965a31)
R 4 (#753b30)
U 3 (#20c281)
R 5 (#225830)
U 4 (#7a4da1)
R 4 (#716560)
U 6 (#036ca1)
R 5 (#55fd00)
D 4 (#064ad1)
R 4 (#93a480)
D 6 (#411d21)
R 3 (#990d00)
D 6 (#4af4a1)
R 3 (#0f8880)
D 4 (#0f56c3)
R 3 (#7f2590)
U 7 (#0f56c1)
R 7 (#374e40)
U 6 (#4af4a3)
R 2 (#161a20)
U 3 (#5277d1)
R 5 (#7c6760)
U 4 (#528313)
R 4 (#525840)
U 4 (#267643)
L 10 (#525842)
U 5 (#501273)
L 4 (#447950)
D 10 (#69cdc3)
L 3 (#530a00)
U 10 (#590643)
L 5 (#243450)
D 5 (#74a853)
L 6 (#7c2a42)
U 5 (#1d9673)
L 3 (#3f8d62)
U 8 (#606b43)
L 5 (#576480)
D 8 (#63d243)
L 5 (#86ad60)
U 4 (#63d241)
L 7 (#0be9f0)
U 8 (#4b0801)
L 2 (#64f9c0)
U 4 (#478081)
R 9 (#20b940)
U 4 (#a60cd1)
L 9 (#02c6a0)
U 5 (#0d8be1)
L 4 (#8226e0)
D 6 (#013a81)
L 3 (#5cf860)
D 4 (#985951)
L 5 (#162d72)
D 2 (#1c2c31)
L 2 (#654f82)
D 4 (#51b4e1)
R 10 (#401a32)
D 5 (#32c291)
L 7 (#84ff82)
D 2 (#25cf41)
L 3 (#43b090)
D 4 (#6208d1)
L 3 (#a428a0)
U 9 (#6208d3)
L 3 (#07d9c0)
U 9 (#6e8a01)
L 2 (#3ab640)
U 3 (#187711)
L 4 (#162d70)
U 6 (#8e5a81)
L 6 (#049580)
D 6 (#a81333)
L 2 (#342030)
D 3 (#233073)
L 7 (#510730)
D 4 (#15cbf3)
R 3 (#507520)
D 5 (#3be881)
R 6 (#52f2a0)
D 3 (#a52711)
L 3 (#0d7680)
D 5 (#1db6c3)
L 5 (#5f0450)
U 5 (#6c6d73)
L 2 (#47abc0)
D 5 (#707733)
L 5 (#771be2)
D 2 (#151c53)
L 3 (#413da2)
D 3 (#768703)
R 11 (#640b02)
D 2 (#37b343)
R 4 (#4ac8d0)
D 5 (#016421)
L 2 (#907990)
D 5 (#016423)
L 3 (#412220)
U 5 (#0f5603)
L 9 (#5e11d0)
D 5 (#24abb1)
L 7 (#1ab552)
U 2 (#06e641)
L 2 (#9e07e2)
U 4 (#06e643)
L 6 (#51f692)
U 4 (#763581)
L 8 (#3716a0)
U 4 (#1360d1)
R 5 (#567bc0)
U 2 (#222831)
R 9 (#7d2160)
U 6 (#72b991)
L 6 (#4a6840)
U 3 (#3ef773)
L 4 (#626a10)
U 4 (#4c3d93)
L 4 (#6fa5e2)
D 4 (#6e0b33)
L 4 (#6fa5e0)
U 3 (#38aaf3)
L 5 (#223552)
U 5 (#025c33)
L 4 (#4205c2)
D 4 (#49ddd3)
L 3 (#3aa782)
D 4 (#028fd3)
L 5 (#76e842)
D 3 (#028fd1)
L 3 (#9bc962)
U 4 (#6bde73)
L 9 (#9d6be0)
U 6 (#2db831)
L 5 (#1192c0)
U 3 (#6b5c33)
L 4 (#152940)
U 4 (#746923)
L 5 (#8648a0)
U 3 (#4cb8d1)
L 3 (#877170)
U 5 (#24ca21)
L 4 (#877172)
D 3 (#6e4261)
L 2 (#691310)
D 6 (#655001)
R 6 (#7e7740)
D 3 (#1562b1)
L 6 (#261a00)
D 4 (#700e91)
L 4 (#6ade10)
U 9 (#4a1251)
L 3 (#5a7c00)
U 7 (#5a30e1)
L 6 (#15a832)
U 3 (#152e01)
L 3 (#643622)
U 5 (#977db1)
L 7 (#4b7bc2)
U 2 (#546691)
L 7 (#8cd5a2)
U 7 (#5b7a31)
R 3 (#6c85f2)
U 6 (#6996a1)
R 8 (#458692)
U 3 (#370e51)
R 6 (#7bc6d2)
U 4 (#07aa01)
R 4 (#389dc2)
U 6 (#3de6d3)
R 6 (#54ece2)
U 5 (#625703)
R 10 (#0e9512)
D 5 (#1e8793)
R 3 (#873d92)
U 4 (#2eb4b3)
R 5 (#2d3432)
U 5 (#26b2f1)
R 2 (#2c8c52)
U 3 (#2ff4c1)
R 7 (#0e68f2)
U 3 (#32b371)
R 8 (#0e68f0)
U 4 (#5d6fb1)
R 3 (#128622)
U 5 (#06af41)
R 6 (#a95192)
U 4 (#274af1)
R 3 (#3af302)
U 6 (#50fff3)
R 6 (#3f9cf2)
U 2 (#50fff1)
R 3 (#4734a2)
U 3 (#1a5051)
L 12 (#986ce0)
U 3 (#224b61)
R 9 (#2d66c0)
U 4 (#6f2a31)
R 6 (#0aba80)
U 7 (#0ecb81)
R 4 (#606870)
U 3 (#0ecb83)
L 3 (#4e78e0)
U 3 (#4563f1)
L 11 (#8bed00)
U 3 (#3298c1)
L 5 (#5a39d0)
U 2 (#51d641)
L 8 (#8e6ee0)
U 4 (#233851)
R 4 (#31c7a0)
U 9 (#728831)
R 3 (#670cd0)
U 4 (#1f3621)
L 7 (#8df230)
U 4 (#44a361)
R 7 (#2aed30)
U 7 (#2a0161)
R 4 (#1db2c0)
U 3 (#6387c1)
R 3 (#1886b0)
D 3 (#128c21)
R 3 (#acb330)
D 3 (#3a9d01)
L 4 (#3658a0)
D 6 (#00ec51)
R 4 (#682712)
D 6 (#2440e1)
R 5 (#45f812)
D 9 (#6298d1)
R 3 (#778f22)
U 4 (#6298d3)
R 2 (#271462)
U 10 (#0d5ff1)
L 4 (#6a69e2)
U 5 (#0d5ff3)
R 6 (#24b5e2)
U 3 (#2440e3)
R 5 (#5f3192)
U 4 (#41c313)
R 3 (#236852)
U 7 (#6e15c1)
R 8 (#5187b2)
D 5 (#6e15c3)
R 2 (#65a3d2)
D 4 (#41c311)
R 11 (#3dfa02)
D 4 (#26ca51)
R 5 (#4e3912)
D 6 (#797803)
R 5 (#2f8ee2)
U 5 (#2a9b83)
R 8 (#3d6702)
D 5 (#4646e3)
R 3 (#3d6700)
D 2 (#43a1c3)
R 4 (#592f22)
D 3 (#9d61c1)
R 4 (#1f90f2)
D 5 (#172261)
R 7 (#5a7ba2)
D 8 (#797801)
R 6 (#4e4ad2)
D 8 (#28fda1)
R 5 (#55a862)
D 4 (#28fda3)
R 5 (#1665a2)
D 6 (#3fca41)
R 9 (#850700)
D 3 (#43f8f1)
R 3 (#3cbd90)
D 6 (#620311)
R 8 (#70b2b2)
D 6 (#25cb11)
R 3 (#336c52)
D 4 (#8da331)
R 4 (#336c50)
D 5 (#0594c1)
R 3 (#4a2b92)
U 8 (#31cac1)
R 5 (#392742)
D 8 (#233743)
R 6 (#798b32)
D 4 (#233741)
R 6 (#4fcde2)
D 4 (#1ffd91)
L 9 (#207ed2)
U 5 (#9314d1)
L 9 (#056d22)
D 5 (#56c131)
L 9 (#431340)
D 6 (#94bbb1)
R 8 (#357120)
D 2 (#19ca71)
R 8 (#8bebb0)
D 6 (#4257c1)
R 8 (#0c4fc0)
D 3 (#380131)
R 3 (#07a260)
D 3 (#02a841)
L 11 (#100a10)
D 2 (#07ad11)
L 4 (#4a2b90)
D 3 (#10d091)
R 6 (#609d22)
D 2 (#69a281)
R 9 (#320ed2)
D 5 (#0782c1)
R 2 (#67c382)
D 2 (#19a311)
R 7 (#14e152)
D 3 (#4ee351)
R 5 (#14e150)
D 8 (#54dae1)
R 3 (#428ba2)
D 5 (#0a5431)
R 3 (#1880e2)
D 2 (#2fc091)
R 9 (#440bc0)
D 6 (#758b11)
R 6 (#6a54b0)
D 3 (#31f8d1)
L 6 (#37e190)
D 5 (#0c4af1)
L 4 (#6acc62)
D 2 (#161df1)
L 4 (#72f272)
D 4 (#161df3)
L 7 (#088332)
D 4 (#182831)
L 8 (#82d720)
D 3 (#371df1)
L 7 (#7207b0)
D 6 (#206d61)
R 4 (#0c1082)
D 2 (#796721)
R 6 (#220252)
D 7 (#2948a1)
R 7 (#5f2c02)
U 7 (#137d21)
R 3 (#0fe252)
D 2 (#0164d1)
R 6 (#1ce912)
D 6 (#4e0983)
R 2 (#7d7c72)
D 11 (#598c93)
R 4 (#581202)
D 8 (#0ffba3)
L 4 (#500e32)
D 2 (#42bcf3)
R 4 (#31e852)
D 8 (#2d8913)
R 4 (#1d67d2)
D 5 (#5a03c3)
R 9 (#45c0b0)
D 4 (#3a1e53)
L 9 (#687430)
D 4 (#3a1e51)
L 4 (#25b1b0)
D 8 (#613e03)
L 7 (#4ea210)
D 8 (#366193)
L 3 (#4cb7c2)
D 8 (#452333)
L 6 (#675322)
D 6 (#6ae223)
L 3 (#0d88b2)
D 2 (#23a4a3)
L 8 (#60f512)
D 5 (#568a53)
L 3 (#0cbd02)
D 3 (#4bad03)
L 4 (#588672)
D 4 (#72dfa3)
L 2 (#960472)
D 9 (#394403)
L 5 (#28bcc2)
D 6 (#4eb073)
L 6 (#04e992)
D 3 (#22c803)
L 3 (#a76142)
D 5 (#22c801)
R 10 (#171512)
D 3 (#25f2f3)
R 6 (#581600)
D 7 (#3d0f33)
L 8 (#142a40)
D 4 (#6eb893)
L 5 (#142a42)
U 4 (#02a243)
L 9 (#522a40)
U 2 (#4d2a01)
L 4 (#081760)
D 7 (#17c601)
R 4 (#081762)
D 6 (#497a01)
R 5 (#2fbb50)
D 3 (#4be663)
R 4 (#3b3140)
D 2 (#48f803)
R 3 (#69ec82)
U 3 (#80c993)
R 5 (#3f05f2)
U 8 (#5d5463)
R 4 (#50d1c2)
D 3 (#472973)
R 3 (#1b68a2)
D 5 (#5ebab3)
R 7 (#464fd2)
D 3 (#64c0a1)
L 7 (#4062d2)
D 6 (#8e33b3)
L 5 (#1c3382)
D 6 (#8e33b1)
L 4 (#50b882)
D 4 (#64c0a3)
L 2 (#2bcfb2)
D 7 (#84fc61)
L 3 (#413452)
U 10 (#84fc63)
L 3 (#47ad42)
U 2 (#03ba03)
L 3 (#7197b2)
U 5 (#81aa33)
L 8 (#5c0552)
D 5 (#235433)
L 5 (#4236f2)
D 5 (#4e9bc3)
L 5 (#3740a0)
D 2 (#1e7f23)
L 10 (#3740a2)
U 3 (#5f66a3)
R 4 (#4236f0)
U 7 (#164f83)
R 4 (#5d1a30)
U 3 (#1192e1)
R 4 (#4c67a0)
U 5 (#954a91)
L 8 (#3348c0)
U 3 (#306c01)
L 4 (#694200)
U 8 (#52c163)
L 3 (#6abee0)
U 3 (#26c123)
L 4 (#6abee2)
U 4 (#4c3413)
L 9 (#4e8800)
U 5 (#1192e3)
L 3 (#2bb700)
U 4 (#21ceb1)
L 12 (#4ec360)
U 3 (#21ceb3)
L 4 (#32f940)
U 8 (#5d5f73)
L 4 (#1dcf10)
U 9 (#3cf413)
L 3 (#7cc870)
U 8 (#5f0953)
L 4 (#376c70)
U 6 (#01d623)
L 5 (#697e50)
U 5 (#99e693)
L 5 (#6f63b0)
U 3 (#576c53)
R 10 (#7fa030)
U 3 (#1fd933)
L 5 (#4eb2d2)
U 6 (#39a1f3)
L 4 (#3f0452)
D 4 (#42ffd3)
L 3 (#5b9d52)
U 7 (#25c2d3)
L 8 (#5ba250)
D 7 (#40d763)
L 5 (#5ba252)
D 3 (#5f2a73)
L 7 (#477ce2)
D 3 (#2652d1)
L 5 (#453770)
D 5 (#758781)
L 11 (#453772)
D 3 (#937381)
L 2 (#119e62)
D 5 (#131891)
R 5 (#3285e2)
U 3 (#211fd3)
R 11 (#8349d2)
U 4 (#211fd1)
R 4 (#3246c2)
U 3 (#2515f3)
R 9 (#5a5bd0)
D 7 (#6fbf83)
R 4 (#6a5680)
D 3 (#6fbf81)
R 9 (#329240)
D 7 (#750063)
R 5 (#5e71f2)
D 9 (#3358d3)
L 6 (#1d2652)
D 4 (#6a8ee3)
L 3 (#4e9cd2)
U 6 (#3e8623)
L 2 (#3607d2)
U 5 (#379d43)
L 6 (#3cf342)
U 3 (#853b63)
L 3 (#737102)
D 3 (#1de1b3)
L 2 (#66ff82)
D 10 (#634163)
L 3 (#2eff02)
U 6 (#2ac343)
L 2 (#528a42)
U 7 (#4d81d3)
L 3 (#2ea1e2)
D 5 (#19e063)
L 6 (#8b5a82)
D 7 (#4b8e33)
L 4 (#5e41d0)
D 2 (#159903)
L 5 (#31f3c0)
D 9 (#537013)
L 2 (#31f3c2)
D 7 (#4b7b43)
L 4 (#5bd890)
D 10 (#1be163)
L 5 (#0c3340)
D 3 (#540d83)
L 9 (#2449f0)
U 6 (#9411c1)
L 7 (#766db0)
U 7 (#9411c3)
L 4 (#37ee30)
D 3 (#516ad3)
L 3 (#0991b0)
D 2 (#98a733)
L 5 (#0ea042)
D 3 (#513f83)
L 2 (#a0c682)
D 8 (#616323)
L 4 (#a0c680)
D 3 (#4555b3)
L 3 (#79e032)
U 9 (#673de3)
L 4 (#5904b0)
U 7 (#495bd3)
L 3 (#5904b2)
U 2 (#49a633)
L 5 (#76a9c2)
U 10 (#10de23)

63
2023/day18/main.go Normal file
View File

@ -0,0 +1,63 @@
package main
import (
"fmt"
"strconv"
"strings"
h "git.bullercodeworks.com/brian/adventofcode/helpers"
)
func main() {
inp := h.StdinToStringSlice()
part1(inp)
fmt.Println()
part2(inp)
}
func part1(input []string) {
dirMap := map[byte]h.Coordinate{
'U': h.Coordinate{X: 0, Y: -1},
'R': h.Coordinate{X: 1, Y: 0},
'D': h.Coordinate{X: 0, Y: 1},
'L': h.Coordinate{X: -1, Y: 0},
}
curr, area := h.Coordinate{X: 0, Y: 0}, 0
for i := range input {
pts := strings.Fields(input[i])
dir, length, _ := pts[0][0], h.Atoi(pts[1]), strings.Trim(pts[1], "()")
n := curr.Add(dirMap[dir].Mul(length))
area += curr.X*n.Y - curr.Y*n.X + length
curr = n
}
fmt.Println("# Part 1")
fmt.Println(area/2 + 1)
}
func part2(input []string) {
dirMap := map[byte]h.Coordinate{
'3': h.Coordinate{X: 0, Y: -1},
'0': h.Coordinate{X: 1, Y: 0},
'1': h.Coordinate{X: 0, Y: 1},
'2': h.Coordinate{X: -1, Y: 0},
}
hexToDec := func(hex string) int {
v, _ := strconv.ParseInt(hex, 16, strconv.IntSize)
return int(v)
}
curr, area := h.Coordinate{X: 0, Y: 0}, 0
for i := range input {
pts := strings.Fields(input[i])
pts[2] = strings.Trim(pts[2], "#()")
length := hexToDec(pts[2][:len(pts[2])-1])
dir := pts[2][len(pts[2])-1:][0]
n := curr.Add(dirMap[dir].Mul(length))
area += curr.X*n.Y - curr.Y*n.X + length
curr = n
}
fmt.Println("# Part 2")
fmt.Println(area/2 + 1)
}

168
2023/day18/problem Normal file
View File

@ -0,0 +1,168 @@
[1]Advent of Code
• [2][About]
• [3][Events]
• [4][Shop]
• [5][Settings]
• [6][Log Out]
br0xen [7](AoC++) 36*
   0xffff&[8]2023
• [9][Calendar]
• [10][AoC++]
• [11][Sponsors]
• [12][Leaderboard]
• [13][Stats]
Our [14]sponsors help make Advent of Code possible:
[15]Best Buy - Our purpose is to enrich lives through technology. Join us!
--- Day 18: Lavaduct Lagoon ---
Thanks to your efforts, the machine parts factory is one of the first
factories up and running since the lavafall came back. However, to catch
up with the large backlog of parts requests, the factory will also need a
large supply of lava for a while; the Elves have already started creating
a large lagoon nearby for this purpose.
However, they aren't sure the lagoon will be big enough; they've asked you
to take a look at the dig plan (your puzzle input). For example:
R 6 (#70c710)
D 5 (#0dc571)
L 2 (#5713f0)
D 2 (#d2c081)
R 2 (#59c680)
D 2 (#411b91)
L 5 (#8ceee2)
U 2 (#caa173)
L 1 (#1b58a2)
U 2 (#caa171)
R 2 (#7807d2)
U 3 (#a77fa3)
L 2 (#015232)
U 2 (#7a21e3)
The digger starts in a 1 meter cube hole in the ground. They then dig the
specified number of meters up (U), down (D), left (L), or right (R),
clearing full 1 meter cubes as they go. The directions are given as seen
from above, so if "up" were north, then "right" would be east, and so on.
Each trench is also listed with the color that the edge of the trench
should be painted as an [16]RGB hexadecimal color code.
When viewed from above, the above example dig plan would result in the
following loop of trench (#) having been dug out from otherwise
ground-level terrain (.):
#######
#.....#
###...#
..#...#
..#...#
###.###
#...#..
##..###
.#....#
.######
At this point, the trench could contain 38 cubic meters of lava. However,
this is just the edge of the lagoon; the next step is to dig out the
interior so that it is one meter deep as well:
#######
#######
#######
..#####
..#####
#######
#####..
#######
.######
.######
Now, the lagoon can contain a much more respectable 62 cubic meters of
lava. While the interior is dug out, the edges are also painted according
to the color codes in the dig plan.
The Elves are concerned the lagoon won't be large enough; if they follow
their dig plan, how many cubic meters of lava could it hold?
Your puzzle answer was 42317.
--- Part Two ---
The Elves were right to be concerned; the planned lagoon would be much too
small.
After a few minutes, someone realizes what happened; someone swapped the
color and instruction parameters when producing the dig plan. They don't
have time to fix the bug; one of them asks if you can extract the correct
instructions from the hexadecimal codes.
Each hexadecimal code is six hexadecimal digits long. The first five
hexadecimal digits encode the distance in meters as a five-digit
hexadecimal number. The last hexadecimal digit encodes the direction to
dig: 0 means R, 1 means D, 2 means L, and 3 means U.
So, in the above example, the hexadecimal codes can be converted into the
true instructions:
• #70c710 = R 461937
• #0dc571 = D 56407
• #5713f0 = R 356671
• #d2c081 = D 863240
• #59c680 = R 367720
• #411b91 = D 266681
• #8ceee2 = L 577262
• #caa173 = U 829975
• #1b58a2 = L 112010
• #caa171 = D 829975
• #7807d2 = L 491645
• #a77fa3 = U 686074
• #015232 = L 5411
• #7a21e3 = U 500254
Digging out this loop and its interior produces a lagoon that can hold an
impressive 952408144115 cubic meters of lava.
Convert the hexadecimal color codes into the correct instructions; if the
Elves follow this new dig plan, how many cubic meters of lava could the
lagoon hold?
Your puzzle answer was 83605563360288.
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should [17]return to your Advent calendar and try
another puzzle.
If you still want to see it, you can [18]get your puzzle input.
You can also [Shareon [19]Twitter [20]Mastodon] this puzzle.
References
Visible links
1. https://adventofcode.com/
2. https://adventofcode.com/2023/about
3. https://adventofcode.com/2023/events
4. https://teespring.com/stores/advent-of-code
5. https://adventofcode.com/2023/settings
6. https://adventofcode.com/2023/auth/logout
7. Advent of Code Supporter
https://adventofcode.com/2023/support
8. https://adventofcode.com/2023
9. https://adventofcode.com/2023
10. https://adventofcode.com/2023/support
11. https://adventofcode.com/2023/sponsors
12. https://adventofcode.com/2023/leaderboard
13. https://adventofcode.com/2023/stats
14. https://adventofcode.com/2023/sponsors
15. https://jobs.bestbuy.com/bby?id=career_area&content=technology&career_site=Digital%20and%20Technology,Data%20and%20Analytics&spa=1&s=req_id_num
16. https://en.wikipedia.org/wiki/RGB_color_model#Numeric_representations
17. https://adventofcode.com/2023
18. https://adventofcode.com/2023/day/18/input
19. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Lavaduct+Lagoon%22+%2D+Day+18+%2D+Advent+of+Code+2023&url=https%3A%2F%2Fadventofcode%2Ecom%2F2023%2Fday%2F18&related=ericwastl&hashtags=AdventOfCode
20. javascript:void(0);

14
2023/day18/testinput Normal file
View File

@ -0,0 +1,14 @@
R 6 (#70c710)
D 5 (#0dc571)
L 2 (#5713f0)
D 2 (#d2c081)
R 2 (#59c680)
D 2 (#411b91)
L 5 (#8ceee2)
U 2 (#caa173)
L 1 (#1b58a2)
U 2 (#caa171)
R 2 (#7807d2)
U 3 (#a77fa3)
L 2 (#015232)
U 2 (#7a21e3)

View File

@ -44,6 +44,12 @@ func (c Coordinate) Add(o Coordinate) Coordinate {
Y: c.Y + o.Y,
}
}
func (c Coordinate) Mul(by int) Coordinate {
return Coordinate{
X: c.X * by,
Y: c.Y * by,
}
}
func (c Coordinate) North() Coordinate {
return Coordinate{X: c.X, Y: c.Y - 1}