day 20 part 2
This commit is contained in:
parent
e13255ab2f
commit
7c8ee5edcd
33
20/main.go
33
20/main.go
@ -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())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user