feat: add day 4 2024
This commit is contained in:
parent
c077b91c41
commit
77a0669f45
10
aoc2024/day04/example.txt
Normal file
10
aoc2024/day04/example.txt
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
MMMSXXMASM
|
||||||
|
MSAMXMSMSA
|
||||||
|
AMXSXMAAMM
|
||||||
|
MSAMASMSMX
|
||||||
|
XMASAMXAMM
|
||||||
|
XXAMMXXAMA
|
||||||
|
SMSMSASXSS
|
||||||
|
SAXAMASAAA
|
||||||
|
MAMMMXMMMM
|
||||||
|
MXMXAXMASX
|
140
aoc2024/day04/input.txt
Normal file
140
aoc2024/day04/input.txt
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
XMXXMSSSMSXSXMMXSAMMXXSXMASMSSXXMAMXAMXSXMXSMAMMASXXASMMXMASXMSSXMMMXMXSXXSXMXXSAMXSXSXSAMXMSAMXMAXXXMXMAMSASXMSSXMSXSXXMAXXSSSMXMXMXMMAASXM
|
||||||
|
MSSMMAAXAMMSAAAXXAMSXMAMXMSMAMMXSAXMXMASAMASMAMMASXMAMAXXXMASAAAXMSMSMAMAMMAMAMMMMXMASMMXMXAMASXMAMMMMASMMSMMMMASAAXAAMMMMSMXAAMSAMSASMMMMAX
|
||||||
|
AAAXMMXMSMASXMMSMXMMASMAAMXMASAMMAXSAMASAMASXXSMASASMSMMMMASMMMMMMAAXMXSAMSAMASMASAMAMASMMMMSAMXMAXAASASAAXAAXMASMMMSMXAAXAAMSMMMAXMAXMAASMM
|
||||||
|
SSMMXSAAXMMSAXMAXAAXAMXXMSSSMSMAMAMXAMXXXMXSXMMMMSAMXAXXAMXAXXMAXMASMXASAXXMSAXXASAMAXAMXXAXMXXMSASXMMASMMSSMSMMSASAMXSSSSMSAAAXMMMMXMMSXSXA
|
||||||
|
XAAAAMMSMSXXMXAASXSMSMSMXXMAMXMASXSSMMXMAMAMMMAAMMAMMMXSSMSAMXSMSASMXXMSXMAAMAMMMSXMAMMSXSASASAMXASXAMAXMAAAAXXMSXMXMX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MASXAXAMXAAMXSMMAASMMMSAXSSMMSSMMMSXMAXAMMAAAMASMMXASMAMMMMS
|
||||||
|
SSSMSSMSMMSASMXAXXSAXXSMSMSMSASMSMSMMMMXMAXXXSASXSMXMAMMMMSSXMMMSXMMMAMASMSXSASAXASMSSXMMSXMAMASMMSAAXMSMAAAAMAMXMMAMAMAMSMMASXXAXSAMMSSMXAX
|
||||||
|
XAAXAAMAAMMMMXMXSAMXSXMAAAAMMMSAXASAMXXMXXAMXSXMAXAAMAMAAXAMMSAAXXMXSAMXSAAAMXSAMXSAAAAXXMAMASAMMASMMMAMMSMMSSSMSASXMSSXMXXMAMMSSMMXXAXAAMMX
|
||||||
|
MSMMSSMMMSAAAAXMAXMAMMMSMMMSAAMMMAMAXXSMSMSMAMASXMSXSASMSMMSASMSMSAASMMMMMMSMXSASXMMMSXMASAMAMMMMAXASXXSAAAAAAMASAAXAXAAMXSMSSMAMAXMASMMMSSS
|
||||||
|
AAXAAAAXXSMMSSSXAMSAMXAAAAXSASAMMAMSAMXAAAAMASAMAAXMAXSAAASMMSAXAMMXMAMSAMXAXMSAMMAAAAXAXSXMMSXXMASAMMAMXSSMMSMAMSMAMMSMMSAMXAMASMMASXAAAAAA
|
||||||
|
SSSSSSMMXMAMMMXMAMSMMMSSSMXXMMMXSXSMSXMAMSMSXMXSMMMXMASXXSMSMMMMXMAMXAXSXMSAMXMXMSSMSXMSAMXASMXMAMAMXMMMMMAMXXMXXAXXXAXSXXXMSAMAXXASMSSMMMSM
|
163
aoc2024/day04/main.go
Normal file
163
aoc2024/day04/main.go
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
_ "embed"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
aoc "go.sour.is/advent-of-code"
|
||||||
|
)
|
||||||
|
|
||||||
|
// var log = aoc.Log
|
||||||
|
|
||||||
|
func main() { aoc.MustResult(aoc.Runner(run)) }
|
||||||
|
|
||||||
|
type result struct {
|
||||||
|
valuePT1 int
|
||||||
|
valuePT2 int
|
||||||
|
}
|
||||||
|
|
||||||
|
type record struct {
|
||||||
|
p aoc.Point[int]
|
||||||
|
d [2]int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r result) String() string { return fmt.Sprintf("%#v", r) }
|
||||||
|
|
||||||
|
func run(scan *bufio.Scanner) (*result, error) {
|
||||||
|
|
||||||
|
m := make([][]rune, 0, 1000)
|
||||||
|
var records []record
|
||||||
|
var records2 []record
|
||||||
|
|
||||||
|
for scan.Scan() {
|
||||||
|
txt := scan.Text()
|
||||||
|
m = append(m, []rune(txt))
|
||||||
|
}
|
||||||
|
|
||||||
|
for x, row := range m {
|
||||||
|
for y, c := range row {
|
||||||
|
if c == 'X' {
|
||||||
|
rs := search1(record{
|
||||||
|
p: aoc.Point[int]{x, y},
|
||||||
|
}, m)
|
||||||
|
records = append(records, rs...)
|
||||||
|
}
|
||||||
|
|
||||||
|
if c == 'A' {
|
||||||
|
rs := search2(record{
|
||||||
|
p: aoc.Point[int]{x, y},
|
||||||
|
}, m)
|
||||||
|
if len(rs) == 2 {
|
||||||
|
records2 = append(records2, rs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, r := range records2 {
|
||||||
|
fmt.Println(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return &result{len(records), len(records2)/2}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func search1(r record, m [][]rune) []record {
|
||||||
|
var ds = [][2]int{
|
||||||
|
{1, 0}, // up
|
||||||
|
{0, 1}, // right
|
||||||
|
{-1, 0}, // down
|
||||||
|
{0, -1}, // left
|
||||||
|
{1, 1}, // up-right
|
||||||
|
{1, -1}, // up-left
|
||||||
|
{-1, 1}, // down-right
|
||||||
|
{-1, -1}, // down-left
|
||||||
|
}
|
||||||
|
|
||||||
|
var records []record
|
||||||
|
|
||||||
|
for _, d := range ds {
|
||||||
|
p := r.p
|
||||||
|
if !check1(m, p, d) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
records = append(records, record{
|
||||||
|
p: p,
|
||||||
|
d: d,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return records
|
||||||
|
}
|
||||||
|
|
||||||
|
func check1(m [][]rune, p aoc.Point[int], d [2]int) bool {
|
||||||
|
for _, r := range []rune{'M', 'A', 'S'} {
|
||||||
|
p[0] += d[0]
|
||||||
|
p[1] += d[1]
|
||||||
|
if p[0] < 0 || p[0] >= len(m) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if p[1] < 0 || p[1] >= len(m[0]) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if m[p[0]][p[1]] != r {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func search2(r record, m [][]rune) []record {
|
||||||
|
var ds = [][2]int{
|
||||||
|
{1, 1}, // up-right
|
||||||
|
{1, -1}, // up-left
|
||||||
|
{-1, 1}, // down-right
|
||||||
|
{-1, -1}, // down-left
|
||||||
|
}
|
||||||
|
var records []record
|
||||||
|
|
||||||
|
for _, d := range ds {
|
||||||
|
p := r.p
|
||||||
|
if !check2(m, p, d) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
records = append(records, record{
|
||||||
|
p: p,
|
||||||
|
d: d,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return records
|
||||||
|
}
|
||||||
|
|
||||||
|
func check2(m [][]rune, p aoc.Point[int], d [2]int) bool {
|
||||||
|
p0 := p[0] - d[0]
|
||||||
|
p1 := p[1] - d[1]
|
||||||
|
if p0 < 0 || p0 >= len(m) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if p1 < 0 || p1 >= len(m[0]) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if m[p0][p1] != 'M' {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
p0 = p[0] + d[0]
|
||||||
|
p1 = p[1] + d[1]
|
||||||
|
if p0 < 0 || p0 >= len(m) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if p1 < 0 || p1 >= len(m[0]) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if m[p0][p1] != 'S' {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
41
aoc2024/day04/main_test.go
Normal file
41
aoc2024/day04/main_test.go
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
_ "embed"
|
||||||
|
|
||||||
|
"github.com/matryer/is"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed example.txt
|
||||||
|
var example []byte
|
||||||
|
|
||||||
|
//go:embed input.txt
|
||||||
|
var input []byte
|
||||||
|
|
||||||
|
func TestExample(t *testing.T) {
|
||||||
|
is := is.New(t)
|
||||||
|
scan := bufio.NewScanner(bytes.NewReader(example))
|
||||||
|
|
||||||
|
result, err := run(scan)
|
||||||
|
is.NoErr(err)
|
||||||
|
|
||||||
|
t.Log(result)
|
||||||
|
is.Equal(result.valuePT1, 18)
|
||||||
|
is.Equal(result.valuePT2, 9)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSolution(t *testing.T) {
|
||||||
|
is := is.New(t)
|
||||||
|
scan := bufio.NewScanner(bytes.NewReader(input))
|
||||||
|
|
||||||
|
result, err := run(scan)
|
||||||
|
is.NoErr(err)
|
||||||
|
|
||||||
|
t.Log(result)
|
||||||
|
is.Equal(result.valuePT1, 2536)
|
||||||
|
is.Equal(result.valuePT2, 1875)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user