Day 12. part 1.

This commit is contained in:
Borna Rajković 2024-12-12 09:16:52 +01:00
parent e0f1c3d9bc
commit 12b29f445e
6 changed files with 274 additions and 0 deletions

View File

@ -36,3 +36,6 @@ var Day10Data string
//go:embed day_11/data.txt //go:embed day_11/data.txt
var Day11Data string var Day11Data string
//go:embed day_12/data.txt
var Day12Data string

140
day_12/data.txt Normal file
View File

@ -0,0 +1,140 @@
KKKKKKKKKKKEEEEEEEEEEWWWWWWWWWWWWUWWUUHSSSHNNNNPVVVVVVVVCRRCCCCCCCYYCSSSSSSSSSSHKHIIIIUDDUUWIIIIIIIIIIIIYUEEDDDYYYYYYYYYYYYYYYYYYYYIIIIIIIJJ
KKKKKKKKKKKEEEEEEEEEHHHWWWWWWWWWWUUUUUHHHHHHHPPPPPVCVCCVCCCCCCCCCCYCCSSSSSSSSSSHHHHIIIUDDUUUIIIIIIIIIIYYYUEEEEEYYWYYYWWWYYYYYYBBBBBIIIIIIJJJ
KKKKKKKKXXKEEEZZZZZZZHHWWWWZZZWCCUUUUUHHHHHHHPPPPPVCCCCCCCCCCCCCCCCCCSSSSSSSHHHHHHHIUUUUUUUIIIIIIIIIIIYYYUEEEEEYYWWWWWWWWWWYYYBBBBBBBBJJJJJJ
KKKKKKKKKKKEEEEZZZZZZZZZZZZZZZWCCCHUUUHHHHHHHPPPPPPCCCQQCCCCCCCCCCCCCSSSSSSHHHHHHHXUUUUUUUUIJIIIIIIIIIIYOEEEEEEEWWWWWWWWWWWYYYYBBBBBBBLJJJJJ
KKKKKKKKKKKKEEEZZZZZZZZZZZZZDZDCCCHHUHHHHHHHPPPPPPPQQQQCCCCCCCCCCCCCCSSSSSHHHHHHHHHHUUUUUUIIIIIIIIIIIIYYOEEEEEEEWWWWWWWWWWWWWYYBBBBBBBBBJJJJ
KKKKKKKKKKKKEZZZZZZZZZZDZZZDDDDDCCHHHHHHHHHPPPPPPPQQQQQQQCCCCCCCCCCCCSSSSSHHHHHHHHHHUUUUUUUIIIIIIIIIIIYY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CJJJGJJJHHHHHZGGGGGGGGGGGGGHHHHHHHHHHHHHMMMMMJJMJMMMMMMMMYYTTYTTXXFNNNFFFFFFCFUUUUUUOOOOODDDRRRRRRGGGGGGGGJJJJJJJJRRRRRRRRRRRR
OOOOOOGCCCCJJJJJJJJJJJHHHHHGGGGGGGGGGGGGGGHHHHHHHHHHHHMMMGMMMMMMMMMMMMMTTTTTTTXXFNNFFCFFFHHFFUUUUUOOOOODDRRRRRRRRGGGVVJJJJJJJJJJJJJRRRRRRRRR
OOOOOOGCCJJJJJJJJJJJJJJHHJHGGGGGGGGGGGGGGGHHHHHHHHHHHHMMMMMMMMMMMMMMMMMTTTTTTTXXFNNFFCFFHHHBFUUUUUOOOOOODRRRRRARGGVVVYJJJJJJJJJFJJRRRRRRRRRR

10
day_12/example_data.txt Normal file
View File

@ -0,0 +1,10 @@
RRRRIICCFF
RRRRIICCCF
VVRRRCCFFF
VVRCCCJFFF
VVVVCJJCFE
VVIVCCJJEE
VVIIICJJEE
MIIIIIJJEE
MIIISIJEEE
MMMISSJEEE

92
day_12/solution.go Normal file
View File

@ -0,0 +1,92 @@
package day_12
import "strings"
const Empty = '.'
type Map [][]rune
type Point struct {
x, y int
}
type Visited map[Point]bool
func (m Map) InMap(x, y int) bool {
return x >= 0 && x < len(m[0]) && y >= 0 && y < len(m)
}
func (m Map) At(x, y int) rune {
if m.InMap(x, y) {
return m[y][x]
}
return Empty
}
// task:https://adventofcode.com/2024/day/12
func SolveBasic(input string) int {
farmMap := loadMap(input)
visited := Visited{}
sum := 0
for y, row := range farmMap {
for x, value := range row {
p := Point{x, y}
field := Visited{}
if _, present := visited[p]; !present {
visit(farmMap, field, x, y, value)
area := len(field)
parameter := 0
for point := range field {
// mark as visited to not visit it more than once
visited[point] = true
if _, present := field[Point{point.x - 1, point.y}]; !present {
parameter++
}
if _, present := field[Point{point.x + 1, point.y}]; !present {
parameter++
}
if _, present := field[Point{point.x, point.y - 1}]; !present {
parameter++
}
if _, present := field[Point{point.x, point.y + 1}]; !present {
parameter++
}
}
sum += area * parameter
}
}
}
return sum
}
func visit(farmMap Map, field Visited, x int, y int, value rune) {
if _, visited := field[Point{x, y}]; visited {
return
}
if farmMap.At(x, y) == value {
field[Point{x, y}] = true
visit(farmMap, field, x-1, y, value)
visit(farmMap, field, x+1, y, value)
visit(farmMap, field, x, y-1, value)
visit(farmMap, field, x, y+1, value)
}
}
// task:https://adventofcode.com/2024/day/12#part2
func SolveComplex(input string) int {
return 0
}
func loadMap(input string) Map {
input = strings.ReplaceAll(input, "\r", "")
topographicMap := Map{}
for _, line := range strings.Split(input, "\n") {
topographicMap = append(topographicMap, []rune(line))
}
return topographicMap
}

24
day_12/solution_test.go Normal file
View File

@ -0,0 +1,24 @@
package day_12_test
import (
"advent_of_code_2024/day_12"
_ "embed"
"testing"
)
//go:embed example_data.txt
var ExampleData string
func TestBasicSolutionExample(t *testing.T) {
result := day_12.SolveBasic(ExampleData)
if result != 1930 {
t.Fatalf("Expected 1930 received %d", result)
}
}
func TestComplexSolutionExample(t *testing.T) {
result := day_12.SolveComplex(ExampleData)
if result != 2858 {
t.Fatalf("Expected 2858 received %d", result)
}
}

View File

@ -12,6 +12,7 @@ import (
"advent_of_code_2024/day_09" "advent_of_code_2024/day_09"
"advent_of_code_2024/day_10" "advent_of_code_2024/day_10"
"advent_of_code_2024/day_11" "advent_of_code_2024/day_11"
"advent_of_code_2024/day_12"
_ "embed" _ "embed"
"fmt" "fmt"
"os" "os"
@ -65,6 +66,10 @@ func main() {
fmt.Printf("Day 11. Basic: %d\n", day_11.SolveBasic(Day11Data)) // fmt.Printf("Day 11. Basic: %d\n", day_11.SolveBasic(Day11Data)) //
case "11-complex": case "11-complex":
fmt.Printf("Day 11. Complex: %d\n", day_11.SolveComplex(Day11Data)) // fmt.Printf("Day 11. Complex: %d\n", day_11.SolveComplex(Day11Data)) //
case "12-basic":
fmt.Printf("Day 12. Basic: %d\n", day_12.SolveBasic(Day12Data)) //
case "12-complex":
fmt.Printf("Day 12. Complex: %d\n", day_12.SolveComplex(Day12Data)) //
} }
} }