2019 Day 24 Complete
This commit is contained in:
39
2019/day24/main.go
Normal file
39
2019/day24/main.go
Normal file
@@ -0,0 +1,39 @@
|
||||
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())
|
||||
}
|
||||
Reference in New Issue
Block a user