diff --git a/20/main.go b/20/main.go index 183f83a..e30ebab 100644 --- a/20/main.go +++ b/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()) }