day 20 part 2

This commit is contained in:
David 2021-12-23 17:44:25 -07:00
parent e13255ab2f
commit 7c8ee5edcd
1 changed files with 24 additions and 9 deletions

View File

@ -144,22 +144,37 @@ func partOne() {
y++
}
img.Print()
fmt.Println(img.CountBrightPixels())
fmt.Println("")
for i := 0; i < 2; i++ {
img = Enhance(img, enhancementString)
img.Print()
fmt.Println(img.CountBrightPixels())
fmt.Println("")
}
fmt.Println(img.CountBrightPixels())
}
func partTwo() {
scanner := makeScanner(false)
for scanner.Scan() {
// line := scanner.Text()
scanner.Scan()
enhancementString := scanner.Text()
scanner.Scan() // eat empty line
img := &image{
background: '.',
grid: map[coord]rune{},
topleft: coord{0, 0},
}
y := 0
for scanner.Scan() {
line := scanner.Text()
img.size = len(line)
for x, c := range line {
img.grid[coord{x, y}] = c
}
y++
}
for i := 0; i < 50; i++ {
img = Enhance(img, enhancementString)
}
fmt.Println(img.CountBrightPixels())
}