Actual solution for day 16!

This commit is contained in:
2021-12-18 18:34:45 +00:00
parent 719c895220
commit 5c0b7a3b09
4 changed files with 231 additions and 22 deletions

View File

@@ -3,23 +3,22 @@ package sixteen
import "fmt"
type Sixteen struct {
bits packet
packet packet
}
func Init(filepath string) *Sixteen {
sixteen := &Sixteen{
bits: packet{},
packet: packet{},
}
sixteen.bits = load(filepath)
sixteen.packet = load(filepath)
return sixteen
}
func (d *Sixteen) Answer() string {
return fmt.Sprintf("The sum of the version numbers is %d", d.bits.versionSum())
return fmt.Sprintf("The sum of the version numbers is %d", d.packet.versionSum())
}
func (d *Sixteen) FollowUp() string {
return "sixteen part 2 answer for bits"
return fmt.Sprintf("The output of the encoded input is %d", d.packet.value())
}