adventofcode/2019/day24/main.go

40 lines
643 B
Go

package main
import (
"fmt"
h "git.bullercodeworks.com/brian/adventofcode/helpers"
)
func main() {
filename := "input"
if h.GetArgNumber(1) != "" {
filename = h.GetArgNumber(1)
}
if h.GetArgNumber(2) != "2" {
part1(filename)
} else {
part2(filename)
}
}
func part1(filename string) {
l := NewLayout(filename)
for !l.Step() {
fmt.Println(h.CLEAR_SCREEN)
fmt.Println(l)
fmt.Println(int(l.Rating()))
}
fmt.Println(h.CLEAR_SCREEN)
fmt.Println(l)
fmt.Println(int(l.Rating()))
}
func part2(filename string) {
l := NewLayout3d(filename)
for i := 0; i < 200; i++ {
l.Step()
}
fmt.Println("Bugs:", l.CountBugs())
}