Day 6 solution

This commit is contained in:
2021-12-06 14:08:30 +00:00
parent 4f1fddf0eb
commit 84a1d25dbe
7 changed files with 150 additions and 0 deletions

26
six/main.go Normal file
View File

@@ -0,0 +1,26 @@
package six
import "fmt"
type Six struct {
lanternfish lanternfish
}
func Init(filepath string) *Six {
six := &Six{
lanternfish: lanternfish{},
}
six.lanternfish.load(filepath)
return six
}
func (d *Six) Answer() string {
d.lanternfish.simulate(80)
return fmt.Sprintf("After 80 days there are %d fish", d.lanternfish.population)
}
func (d *Six) FollowUp() string {
d.lanternfish.simulate(176)
return fmt.Sprintf("After 256 days there are %d fish", d.lanternfish.population)
}