Part 1 and first pass at Part 2

This commit is contained in:
2021-12-15 20:20:15 +00:00
parent 6b21ea4aff
commit b0e761fb7a
7 changed files with 407 additions and 0 deletions

25
fifteen/main.go Normal file
View File

@@ -0,0 +1,25 @@
package fifteen
import "fmt"
type Fifteen struct {
path path
}
func Init(filepath string) *Fifteen {
fifteen := &Fifteen{
path: path{},
}
fifteen.path.load(filepath)
return fifteen
}
func (d *Fifteen) Answer() string {
return fmt.Sprintf("The total risk of the least risky path is %d", d.path.totalRisk())
}
func (d *Fifteen) FollowUp() string {
scaled := d.path.scale(5, 5)
return fmt.Sprintf("The total risk of the least risky path is %d", scaled.totalRisk())
}