add 2024/day4
This commit is contained in:
parent
a7c0239f66
commit
d67d377bd4
2 changed files with 340 additions and 0 deletions
140
2024/04/input
Normal file
140
2024/04/input
Normal file
|
@ -0,0 +1,140 @@
|
|||
SAMXXSXXSXSAMXMMSMMMMSAMXSXMMMAMXXMSSMSMMMMMXSAXMAMMSSMXMXMAXSXSASMSSMXMMSAMXMMXMMSSSMMMSAMXXSASMSAMXMSXXAMAMXMMXMSAMXSMSMSXSMAMXMASXMXAMSMM
|
||||
MAMMXSMMMAASMMMASAAAAXAMASXMASMMSSMAMAASAASXMMMMSAMXAAAAMMMSAXXMASXAAASAAXMXASMXSAXMASAAMMSXMXAMASXXAMXXMMSAMXXXAMXXMXXAXAAAXSMXMAMMAMSAMAAX
|
||||
SAMXAXAAMAMMSXMASXMMMXAMASASASAAAAMMSSMSMMXAXAAAMASMSSMMXAAXMSAMXMMSMMAMMXAMXXAAMMXSAMMMMAMASMSMAMXMSSMAMAAAXXMSMSAXXAMXMMMSMAXSSMMSAMMASXSM
|
||||
SSSMXMXSXAMXAXMXXMMAMSMMXSAMASMMSSMXAAXSXMSMMMMSSMMAAXMAMMSMMXMASMAXAAMSSXMSMSMMMXXMAMSXMASMMAAMAMMAAAXMMSSMMAAAXMMSMXMASXAMMMMMAAMSASMXMAXA
|
||||
SAMXMSMMXMSMMMMSMMMAMAXSMSXSXSXAXXXMSSMMAXAAAMAAAAMSMMMSAXAAXMMAAMXSAMXAXAAXAASXXMMSSMAMSAMAMSMSXSAMSMMMAAAAAXMAXMAMXAXXMMMMSXXSSMMMXMAMSASM
|
||||
MSMAAAAMXMAXXAAAASXSSMMMAMAMXXMSMMMMXMASMSSSMSSSSMMMXMAXMSSSMMMASXMMMMMMSMMMSMSMMSAAAMMXMSSMXAMXAAXXAMSMSXMMMMXSXMASXSMSMXSAMXXMXASMSASXMASM
|
||||
SXSMSMSAXXAMXMSSSMAAXMAMAMAMSXMASAASMSMMXAXMAXAMXXMASMAXXAXXAAMSMMMAAAXXMAMAAA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||||
SMSMSSMXMASASMSMMXXMASMMXXAXXSSMSASMSSMSSMSSXMASMMXAMAMMMMAMMMSSXMXMSSXMXMASMMXSXXMMXMASXSXAXAMMXMAXMASXXAXXSSSMXXMASAMXMSMMMAXXMASMSAMXASMS
|
200
2024/04/main.go
Normal file
200
2024/04/main.go
Normal file
|
@ -0,0 +1,200 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"aoc/helper"
|
||||
)
|
||||
|
||||
func main() {
|
||||
grid := helper.ReadLinesToStringSlices()
|
||||
|
||||
// part 1
|
||||
count := 0
|
||||
for y := range grid {
|
||||
for x := range grid[0] {
|
||||
if grid[y][x] == 'X' {
|
||||
count += findXMAS(grid, x, y)
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Printf("XMAS count: %d\n", count)
|
||||
|
||||
// part 2
|
||||
count = 0
|
||||
for y := 1; y < len(grid)-1; y++ { // skip first & last row
|
||||
for x := 1; x < len(grid[0])-1; x++ { // skip first & last column
|
||||
if grid[y][x] == 'A' {
|
||||
count += findCrossMAS(grid, x, y)
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Printf("X-MAS count: %d\n", count)
|
||||
}
|
||||
|
||||
func findXMAS(grid []string, startX int, startY int) (count int) {
|
||||
minX, minY := 0, 0 // upper and left border is 0
|
||||
maxY := len(grid) - 1 // lower border is len-1 (index start = 0)
|
||||
maxX := len(grid[0]) - 1 // right border is len-1 (index start = 0)
|
||||
|
||||
XMAS := "XMAS"
|
||||
|
||||
// horizontal right
|
||||
if startX+3 <= maxX { // check for enough space (pos + 3 = 4 characters for "XMAS")
|
||||
found := true
|
||||
for i := range 4 {
|
||||
// check if gridposition at "i" has character for position "i"
|
||||
// i=0 -> XMAS[0] -> "X"
|
||||
// ..
|
||||
// i=3 -> XMAS[3] -> "S"
|
||||
if grid[startY][startX+i] != XMAS[i] {
|
||||
found = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
// horizontal left
|
||||
if startX-3 >= minX {
|
||||
found := true
|
||||
for i := range 4 {
|
||||
if grid[startY][startX-i] != XMAS[i] {
|
||||
found = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
// vertikal down
|
||||
if startY+3 <= maxY {
|
||||
found := true
|
||||
for i := range 4 {
|
||||
if grid[startY+i][startX] != XMAS[i] {
|
||||
found = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
// vertikal up
|
||||
if startY-3 >= minY {
|
||||
found := true
|
||||
for i := range 4 {
|
||||
if grid[startY-i][startX] != XMAS[i] {
|
||||
found = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
// diagonal down right
|
||||
if startY+3 <= maxY && startX+3 <= maxX {
|
||||
found := true
|
||||
for i := range 4 {
|
||||
if grid[startY+i][startX+i] != XMAS[i] {
|
||||
found = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
// diagonal down left
|
||||
if startY+3 <= maxY && startX-3 >= minX {
|
||||
found := true
|
||||
for i := range 4 {
|
||||
if grid[startY+i][startX-i] != XMAS[i] {
|
||||
found = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
// diagonal up right
|
||||
if startY-3 >= minY && startX+3 <= maxX {
|
||||
found := true
|
||||
for i := range 4 {
|
||||
if grid[startY-i][startX+i] != XMAS[i] {
|
||||
found = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
// diagonal up left
|
||||
if startY-3 >= minY && startX-3 >= minX {
|
||||
found := true
|
||||
for i := range 4 {
|
||||
if grid[startY-i][startX-i] != XMAS[i] {
|
||||
found = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
func findCrossMAS(grid []string, startX int, startY int) (count int) {
|
||||
|
||||
// M.S
|
||||
// .A.
|
||||
// M.S
|
||||
found := grid[startY-1][startX-1] == 'M' && grid[startY-1][startX+1] == 'S' &&
|
||||
grid[startY+1][startX-1] == 'M' && grid[startY+1][startX+1] == 'S'
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
|
||||
// M.M
|
||||
// .A.
|
||||
// S.S
|
||||
found = grid[startY-1][startX-1] == 'M' && grid[startY-1][startX+1] == 'M' &&
|
||||
grid[startY+1][startX-1] == 'S' && grid[startY+1][startX+1] == 'S'
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
|
||||
// S.M
|
||||
// .A.
|
||||
// S.M
|
||||
found = grid[startY-1][startX-1] == 'S' && grid[startY-1][startX+1] == 'M' &&
|
||||
grid[startY+1][startX-1] == 'S' && grid[startY+1][startX+1] == 'M'
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
|
||||
// S.S
|
||||
// .A.
|
||||
// M.M
|
||||
found = grid[startY-1][startX-1] == 'S' && grid[startY-1][startX+1] == 'S' &&
|
||||
grid[startY+1][startX-1] == 'M' && grid[startY+1][startX+1] == 'M'
|
||||
if found {
|
||||
count++
|
||||
}
|
||||
|
||||
return count
|
||||
}
|
Loading…
Reference in a new issue