2024 Day 4 Complete!
This commit is contained in:
parent
9a8de11888
commit
b852b3951a
140
2024/day04/input
Normal file
140
2024/day04/input
Normal file
@ -0,0 +1,140 @@
|
||||
XMSSMSSMXSXSAMMMAMMMASAMXSSMAMSSSMMXSMMSSSMSAXAAMMMSMSMSMAMMMMXMMMMXAMXXMMMSMMMAMXMMSASMSSSMSMMMXMSSMSMSXMMXXMASXMMMMMMMXMASXAMSXSXSXSMAMSXS
|
||||
SMAAXSAMMAAAMAASMSAXSXMXXXMMAXAAMAXASAASXMAMXAASXAXMMAXAXXXSXSAMASXMSSMMSASXSASAMXXXSASAASAXAXAMMMAAAAASMMMSSMAMSAAMAMAXAXAXAMXXAMAAASMSMSAA
|
||||
MMSSMSAMAMXMMSXSAMMXMAMMMMMMXMMMMXMASMMSAMXMSXMAMMSMSSSMXSAMXSASAXAMXAAAMSMASMSAXAMXMAMMMMSSMSMSAMSMMMMMAAAXAMAMMMMSMSMMXMMSMSMMAMAMXMAAAMXM
|
||||
XAAAAMAMXXAXAXMMXMMASAMAASAMMXSAMXMMMMAMXMMMXASMMMAMMMMAASAXASAMXSXMSSMMXAMXMXSMMSXSMAMAMAAXMAMAXXXSMAASMMSSMMMSSMMAASASMMXAMAAMSMSMXMSMSMXA
|
||||
MSSSSSMMMSMSMSSSSXSASASXMSAMAASXMMMSMMXSXMAMSXMAMSMXAAMMMSXMMXMAMAMMXXMXSASMSXMMSAAXMAXAMMSMSXSASMXAMSXSAAMAXXAAAMMMXMAXAXSSMSSMAAAXAMAXAMXS
|
||||
XAAXAAXAXAAAAMAAAAMAXXMAXSXMSAMASAAAXSASASXMSAMMMAAMSMSAMXXMXAMMXXAXAXXMAAXAXAASAMSMSSSMSAMAMAMMSMSSMXASMMMSMMMMSMSMSMSMXMAXXAMMMMMSSSSSXSAM
|
||||
SMSMSMSXSMSMXMMMMMMSMMMXASXXMAXMMMMSSMASAMXAMMXASMSMXASXSAMMSXSMASXMMSMSMMMSSMMMMXMASMAASAMMMASAMXAM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ASXSAMXSMSSXMASMMSAMXMXXXSXSMSSXMMSMXSXMASMXMSSSMASMMMSASXMMSAMXMXXMMASMSSXSXSASMSMSMSMSSMS
|
85
2024/day04/main.go
Normal file
85
2024/day04/main.go
Normal file
@ -0,0 +1,85 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
h "git.bullercodeworks.com/brian/adventofcode/helpers"
|
||||
)
|
||||
|
||||
func main() {
|
||||
inp := h.StdinToCoordMap()
|
||||
part1(inp)
|
||||
part2(inp)
|
||||
}
|
||||
|
||||
func part1(m h.CoordByteMap) {
|
||||
var total int
|
||||
for y := m.TLY; y <= m.BRY; y++ {
|
||||
for x := m.TLX; x <= m.BRX; x++ {
|
||||
total += checkPos(m, h.Coordinate{X: x, Y: y})
|
||||
}
|
||||
}
|
||||
fmt.Println("# Part 1")
|
||||
fmt.Println("Instances of XMAS:", total)
|
||||
}
|
||||
|
||||
func part2(m h.CoordByteMap) {
|
||||
var total int
|
||||
for y := m.TLY; y <= m.BRY; y++ {
|
||||
for x := m.TLX; x <= m.BRX; x++ {
|
||||
if checkXPos(m, h.Coordinate{X: x, Y: y}) {
|
||||
total++
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Println("# Part 2")
|
||||
fmt.Println("Instances of X-MAS:", total)
|
||||
}
|
||||
|
||||
// checkPos takes an x,y and returns how many instances of
|
||||
// 'XMAS' occur starting there.
|
||||
func checkPos(m h.CoordByteMap, c h.Coordinate) int {
|
||||
if m.Get(c) != 'X' {
|
||||
return 0
|
||||
}
|
||||
|
||||
var total int
|
||||
for _, dir := range []h.Coordinate{
|
||||
{X: -1, Y: 0}, // North
|
||||
{X: -1, Y: 1}, // Northeast
|
||||
{X: 0, Y: 1}, // East
|
||||
{X: 1, Y: 1}, // Southeast
|
||||
{X: 1, Y: 0}, // South
|
||||
{X: 1, Y: -1}, // Southwest
|
||||
{X: 0, Y: -1}, // West
|
||||
{X: -1, Y: -1}, // Northwest
|
||||
} {
|
||||
if checkDir(m, c, dir, []byte{'X', 'M', 'A', 'S'}) {
|
||||
total++
|
||||
}
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
||||
// checkDir follows a direction to look for the word returning true if found.
|
||||
func checkDir(m h.CoordByteMap, c h.Coordinate, dir h.Coordinate, word []byte) bool {
|
||||
if len(word) == 0 {
|
||||
return true
|
||||
}
|
||||
if m.Get(c) != word[0] {
|
||||
return false
|
||||
}
|
||||
return checkDir(m, c.Relative(dir), dir, word[1:])
|
||||
}
|
||||
|
||||
func checkXPos(m h.CoordByteMap, c h.Coordinate) bool {
|
||||
if m.Get(c) != 'A' {
|
||||
return false
|
||||
}
|
||||
// A X-Mas can be:
|
||||
// M S S M M M S S
|
||||
// A A A A
|
||||
// M S S M S S M M
|
||||
wrk := string([]byte{m.Get(c.NE()), m.Get(c.SW()), m.Get(c.NW()), m.Get(c.SE())})
|
||||
return wrk == "MSMS" || wrk == "SMSM" || wrk == "MSSM" || wrk == "SMMS"
|
||||
}
|
107
2024/day04/problem
Normal file
107
2024/day04/problem
Normal file
@ -0,0 +1,107 @@
|
||||
[1]Advent of Code
|
||||
|
||||
• [2][About]
|
||||
• [3][Events]
|
||||
• [4][Shop]
|
||||
• [5][Settings]
|
||||
• [6][Log Out]
|
||||
|
||||
br0xen [7](AoC++) 6*
|
||||
|
||||
{year=>[8]2024}
|
||||
|
||||
• [9][Calendar]
|
||||
• [10][AoC++]
|
||||
• [11][Sponsors]
|
||||
• [12][Leaderboard]
|
||||
• [13][Stats]
|
||||
|
||||
Our [14]sponsors help make Advent of Code possible:
|
||||
[15]Boot.dev - Do Adventers-of-Code make the best backend devs? We think
|
||||
so! If you want to master backend development in Python, SQL, and Go, then
|
||||
try our hands-on courses on Boot.dev! Get 25% off first payment w/promo
|
||||
ADVENTOFCODE
|
||||
|
||||
--- Day 4: Ceres Search ---
|
||||
|
||||
"Looks like the Chief's not here. Next!" One of The Historians pulls out a
|
||||
device and pushes the only button on it. After a brief flash, you
|
||||
recognize the interior of the [16]Ceres monitoring station!
|
||||
|
||||
As the search for the Chief continues, a small Elf who lives on the
|
||||
station tugs on your shirt; she'd like to know if you could help her with
|
||||
her word search (your puzzle input). She only has to find one word: XMAS.
|
||||
|
||||
This word search allows words to be horizontal, vertical, diagonal,
|
||||
written backwards, or even overlapping other words. It's a little unusual,
|
||||
though, as you don't merely need to find one instance of XMAS - you need
|
||||
to find all of them. Here are a few ways XMAS might appear, where
|
||||
irrelevant characters have been replaced with .:
|
||||
|
||||
..X...
|
||||
.SAMX.
|
||||
.A..A.
|
||||
XMAS.S
|
||||
.X....
|
||||
|
||||
The actual word search will be full of letters instead. For example:
|
||||
|
||||
MMMSXXMASM
|
||||
MSAMXMSMSA
|
||||
AMXSXMAAMM
|
||||
MSAMASMSMX
|
||||
XMASAMXAMM
|
||||
XXAMMXXAMA
|
||||
SMSMSASXSS
|
||||
SAXAMASAAA
|
||||
MAMMMXMMMM
|
||||
MXMXAXMASX
|
||||
|
||||
In this word search, XMAS occurs a total of 18 times; here's the same word
|
||||
search again, but where letters not involved in any XMAS have been
|
||||
replaced with .:
|
||||
|
||||
....XXMAS.
|
||||
.SAMXMS...
|
||||
...S..A...
|
||||
..A.A.MS.X
|
||||
XMASAMX.MM
|
||||
X.....XA.A
|
||||
S.S.S.S.SS
|
||||
.A.A.A.A.A
|
||||
..M.M.M.MM
|
||||
.X.X.XMASX
|
||||
|
||||
Take a look at the little Elf's word search. How many times does XMAS
|
||||
appear?
|
||||
|
||||
To begin, [17]get your puzzle input.
|
||||
|
||||
Answer: [18]_____________________ [19][ [Submit] ]
|
||||
|
||||
You can also [Shareon [20]Bluesky [21]Twitter [22]Mastodon] this puzzle.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
1. https://adventofcode.com/
|
||||
2. https://adventofcode.com/2024/about
|
||||
3. https://adventofcode.com/2024/events
|
||||
4. https://cottonbureau.com/people/advent-of-code
|
||||
5. https://adventofcode.com/2024/settings
|
||||
6. https://adventofcode.com/2024/auth/logout
|
||||
7. Advent of Code Supporter
|
||||
https://adventofcode.com/2024/support
|
||||
8. https://adventofcode.com/2024
|
||||
9. https://adventofcode.com/2024
|
||||
10. https://adventofcode.com/2024/support
|
||||
11. https://adventofcode.com/2024/sponsors
|
||||
12. https://adventofcode.com/2024/leaderboard
|
||||
13. https://adventofcode.com/2024/stats
|
||||
14. https://adventofcode.com/2024/sponsors
|
||||
15. https://adventofcode.com/2024/sponsors/redirect?url=https%3A%2F%2Fwww%2Eboot%2Edev%3Fpromo%3DADVENTOFCODE
|
||||
16. https://adventofcode.com/2019/day/10
|
||||
17. https://adventofcode.com/2024/day/4/input
|
||||
20. https://bsky.app/intent/compose?text=%22Ceres+Search%22+%2D+Day+4+%2D+Advent+of+Code+2024+%23AdventOfCode+https%3A%2F%2Fadventofcode%2Ecom%2F2024%2Fday%2F4
|
||||
21. https://twitter.com/intent/tweet?text=%22Ceres+Search%22+%2D+Day+4+%2D+Advent+of+Code+2024&url=https%3A%2F%2Fadventofcode%2Ecom%2F2024%2Fday%2F4&related=ericwastl&hashtags=AdventOfCode
|
||||
22. javascript:void(0);
|
10
2024/day04/testinput
Normal file
10
2024/day04/testinput
Normal file
@ -0,0 +1,10 @@
|
||||
MMMSXXMASM
|
||||
MSAMXMSMSA
|
||||
AMXSXMAAMM
|
||||
MSAMASMSMX
|
||||
XMASAMXAMM
|
||||
XXAMMXXAMA
|
||||
SMSMSASXSS
|
||||
SAXAMASAAA
|
||||
MAMMMXMMMM
|
||||
MXMXAXMASX
|
@ -26,24 +26,29 @@ func (c *Coordinate) MoveNE() {
|
||||
c.X++
|
||||
c.Y--
|
||||
}
|
||||
|
||||
func (c *Coordinate) MoveSE() {
|
||||
c.X++
|
||||
c.Y++
|
||||
}
|
||||
|
||||
func (c *Coordinate) MoveSW() {
|
||||
c.X--
|
||||
c.Y++
|
||||
}
|
||||
|
||||
func (c *Coordinate) MoveNW() {
|
||||
c.X--
|
||||
c.Y--
|
||||
}
|
||||
|
||||
func (c Coordinate) Add(o Coordinate) Coordinate {
|
||||
return Coordinate{
|
||||
X: c.X + o.X,
|
||||
Y: c.Y + o.Y,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Coordinate) Mul(by int) Coordinate {
|
||||
return Coordinate{
|
||||
X: c.X * by,
|
||||
@ -54,36 +59,46 @@ func (c Coordinate) Mul(by int) Coordinate {
|
||||
func (c Coordinate) North() Coordinate {
|
||||
return Coordinate{X: c.X, Y: c.Y - 1}
|
||||
}
|
||||
|
||||
func (c Coordinate) East() Coordinate {
|
||||
return Coordinate{X: c.X + 1, Y: c.Y}
|
||||
}
|
||||
|
||||
func (c Coordinate) South() Coordinate {
|
||||
return Coordinate{X: c.X, Y: c.Y + 1}
|
||||
}
|
||||
|
||||
func (c Coordinate) West() Coordinate {
|
||||
return Coordinate{X: c.X - 1, Y: c.Y}
|
||||
}
|
||||
|
||||
func (c *Coordinate) NW() Coordinate {
|
||||
return Coordinate{X: c.X - 1, Y: c.Y - 1}
|
||||
}
|
||||
|
||||
func (c *Coordinate) NE() Coordinate {
|
||||
return Coordinate{X: c.X + 1, Y: c.Y - 1}
|
||||
}
|
||||
|
||||
func (c *Coordinate) SW() Coordinate {
|
||||
return Coordinate{X: c.X - 1, Y: c.Y + 1}
|
||||
}
|
||||
|
||||
func (c *Coordinate) SE() Coordinate {
|
||||
return Coordinate{X: c.X + 1, Y: c.Y + 1}
|
||||
}
|
||||
|
||||
func (c *Coordinate) GetOrthNeighbors() []Coordinate {
|
||||
return []Coordinate{c.North(), c.East(), c.South(), c.West()}
|
||||
}
|
||||
|
||||
func (c *Coordinate) GetAllNeighbors() []Coordinate {
|
||||
return []Coordinate{
|
||||
c.North(), c.NE(),
|
||||
c.East(), c.SE(),
|
||||
c.South(), c.SW(),
|
||||
c.West(), c.NW()}
|
||||
c.West(), c.NW(),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Coordinate) GetNorthCoord() *Coordinate {
|
||||
@ -92,18 +107,21 @@ func (c *Coordinate) GetNorthCoord() *Coordinate {
|
||||
Y: c.Y - 1,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Coordinate) GetEastCoord() *Coordinate {
|
||||
return &Coordinate{
|
||||
X: c.X + 1,
|
||||
Y: c.Y,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Coordinate) GetSouthCoord() *Coordinate {
|
||||
return &Coordinate{
|
||||
X: c.X,
|
||||
Y: c.Y + 1,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Coordinate) GetWestCoord() *Coordinate {
|
||||
return &Coordinate{
|
||||
X: c.X - 1,
|
||||
@ -143,6 +161,7 @@ func (c Coordinate) Distance(t Coordinate) int {
|
||||
func (c Coordinate) Equals(c2 Coordinate) bool {
|
||||
return c.X == c2.X && c.Y == c2.Y
|
||||
}
|
||||
|
||||
func (c Coordinate) Adjacent(c2 Coordinate) bool {
|
||||
return c2.Equals(c.North()) ||
|
||||
c2.Equals(c.NE()) ||
|
||||
@ -163,6 +182,7 @@ func GetHighestY(list ...Coordinate) int {
|
||||
}
|
||||
return top
|
||||
}
|
||||
|
||||
func GetLowestY(list ...Coordinate) int {
|
||||
bot := math.MaxInt
|
||||
for i := range list {
|
||||
@ -172,6 +192,7 @@ func GetLowestY(list ...Coordinate) int {
|
||||
}
|
||||
return bot
|
||||
}
|
||||
|
||||
func GetLowestX(list ...Coordinate) int {
|
||||
bot := math.MaxInt
|
||||
for i := range list {
|
||||
@ -181,6 +202,7 @@ func GetLowestX(list ...Coordinate) int {
|
||||
}
|
||||
return bot
|
||||
}
|
||||
|
||||
func GetHighestX(list ...Coordinate) int {
|
||||
top := math.MinInt
|
||||
for i := range list {
|
||||
|
@ -49,9 +49,11 @@ func StringSliceToCoordByteMap(input []string) CoordByteMap {
|
||||
func (m *CoordByteMap) RowCount() int {
|
||||
return m.BRY - m.TLY
|
||||
}
|
||||
|
||||
func (m *CoordByteMap) ColCount() int {
|
||||
return m.BRX - m.TLX
|
||||
}
|
||||
|
||||
func (m *CoordByteMap) GetRow(y int) []byte {
|
||||
if m.Repeats {
|
||||
y = (y + m.BRY) % m.BRY
|
||||
@ -62,6 +64,7 @@ func (m *CoordByteMap) GetRow(y int) []byte {
|
||||
}
|
||||
return resp
|
||||
}
|
||||
|
||||
func (m *CoordByteMap) GetCol(x int) []byte {
|
||||
if m.Repeats {
|
||||
x = (x + m.BRX) % m.BRX
|
||||
@ -72,12 +75,14 @@ func (m *CoordByteMap) GetCol(x int) []byte {
|
||||
}
|
||||
return resp
|
||||
}
|
||||
|
||||
func (m *CoordByteMap) AddRow(row []byte) {
|
||||
y := m.BRY + 1
|
||||
for x := 0; x < len(row); x++ {
|
||||
m.Put(Coordinate{X: x + m.TLX, Y: y}, row[x])
|
||||
}
|
||||
}
|
||||
|
||||
func (m *CoordByteMap) AddCol(col []byte) {
|
||||
x := m.BRX + 1
|
||||
for y := 0; y < len(col); y++ {
|
||||
@ -142,9 +147,11 @@ func (m *CoordByteMap) Delete(pos Coordinate) {
|
||||
func (m *CoordByteMap) Height() int {
|
||||
return m.BRY - m.TLY
|
||||
}
|
||||
|
||||
func (m *CoordByteMap) Width() int {
|
||||
return m.BRX - m.TLX
|
||||
}
|
||||
|
||||
func (m *CoordByteMap) ReplaceAll(o, n byte) {
|
||||
for y := m.TLY; y <= m.BRY; y++ {
|
||||
for x := m.TLX; x <= m.BRX; x++ {
|
||||
@ -238,7 +245,7 @@ func (m *CoordByteMap) FindFirst(b byte) (Coordinate, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Coordinate{}, errors.New("Not Found")
|
||||
return Coordinate{}, errors.New("not found")
|
||||
}
|
||||
|
||||
// FindLast searches right to left, bottom to top for the last
|
||||
@ -355,18 +362,21 @@ func (m *CoordByteMap) GrowNorth(size int, val byte) {
|
||||
m.Put(Coordinate{X: x, Y: tlY}, val)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *CoordByteMap) GrowEast(size int, val byte) {
|
||||
brX := m.BRX + 1
|
||||
for y := m.TLY; y <= m.BRY; y++ {
|
||||
m.Put(Coordinate{X: brX, Y: y}, val)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *CoordByteMap) GrowSouth(size int, val byte) {
|
||||
tlY := m.BRY + 1
|
||||
for x := m.TLX; x <= m.BRX; x++ {
|
||||
m.Put(Coordinate{X: x, Y: tlY}, val)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *CoordByteMap) GrowWest(size int, val byte) {
|
||||
brX := m.TLX - 1
|
||||
for y := m.TLY; y <= m.BRY; y++ {
|
||||
@ -396,6 +406,7 @@ func (m CoordByteMap) Map(l func(c Coordinate, in byte) byte) CoordByteMap {
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
||||
func (m CoordByteMap) RowAsString(y int) string {
|
||||
var res string
|
||||
for x := m.TLX; x <= m.BRX; x++ {
|
||||
@ -403,6 +414,7 @@ func (m CoordByteMap) RowAsString(y int) string {
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func (m CoordByteMap) ColAsString(x int) string {
|
||||
var res string
|
||||
for y := m.TLY; y <= m.BRY; y++ {
|
||||
@ -470,6 +482,7 @@ func (m *Coord3dByteMap) Get(pos Coordinate3d) byte {
|
||||
}
|
||||
return m.Field[pos]
|
||||
}
|
||||
|
||||
func (m *Coord3dByteMap) Opt(pos Coordinate3d, def byte) byte {
|
||||
if v, ok := m.Field[pos]; ok {
|
||||
return v
|
||||
|
Loading…
Reference in New Issue
Block a user