Day 7 solution

This commit is contained in:
2021-12-07 16:04:40 +00:00
parent 84a1d25dbe
commit f2e471f2a4
7 changed files with 148 additions and 1 deletions

26
seven/main.go Normal file
View File

@@ -0,0 +1,26 @@
package seven
import "fmt"
type Seven struct {
crabs crabs
}
func Init(filepath string) *Seven {
seven := &Seven{
crabs: crabs{},
}
seven.crabs.load(filepath)
return seven
}
func (d *Seven) Answer() string {
fuelUsed := d.crabs.align(false)
return fmt.Sprintf("Used %d fuel to align", fuelUsed)
}
func (d *Seven) FollowUp() string {
fuelUsed := d.crabs.align(true)
return fmt.Sprintf("Used %d fuel to align", fuelUsed)
}