Day 8 solution
This commit is contained in:
26
eight/main.go
Normal file
26
eight/main.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package eight
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Eight struct {
|
||||
display display
|
||||
}
|
||||
|
||||
func Init(filepath string) *Eight {
|
||||
eight := &Eight{
|
||||
display: display{},
|
||||
}
|
||||
|
||||
eight.display.load(filepath)
|
||||
return eight
|
||||
}
|
||||
|
||||
func (d *Eight) Answer() string {
|
||||
count := d.display.uniqueOuputs()
|
||||
return fmt.Sprintf("There were %d instances of digits 1, 4, 7, or 8", count)
|
||||
}
|
||||
|
||||
func (d *Eight) FollowUp() string {
|
||||
outputSum := d.display.outputSum()
|
||||
return fmt.Sprintf("The sum of the decoded output values was %d", outputSum)
|
||||
}
|
Reference in New Issue
Block a user