Add day four Bingo player

This commit is contained in:
2021-12-04 14:03:47 +00:00
parent 5fc7348bdf
commit f6862dc302
6 changed files with 937 additions and 0 deletions

27
four/main.go Normal file
View File

@@ -0,0 +1,27 @@
package four
import "fmt"
type Four struct {
bingo bingo
}
func Init(filepath string) *Four {
four := &Four{
bingo: bingo{},
}
four.bingo.read(filepath)
return four
}
func (d *Four) Answer() string {
score, call := d.bingo.play()
return fmt.Sprintf("The winning score is %d on call %d. Final score %d", score, call, score*call)
}
func (d *Four) FollowUp() string {
d.bingo.reset()
score, call := d.bingo.slowPlay()
return fmt.Sprintf("The last winning score is %d on call %d. Final score %d", score, call, score*call)
}