Implement standard debuggers.

These debug actions are added to all players by default.
This commit is contained in:
2023-04-15 19:16:08 -07:00
parent 22c4718faf
commit 74fac625f2
6 changed files with 241 additions and 14 deletions

View File

@ -5,8 +5,6 @@ import (
"fmt"
"git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
"github.com/kr/pretty"
)
func main() {
@ -46,7 +44,7 @@ func main() {
Name: cardsim.MsgStr("Stats"),
Intro: cardsim.MsgStr("Hi! These are the smoke test stats."),
},
ruledumper{},
cardsim.RuleDumper[*SmokeTestCollection]{},
}
p.Prompt = prompt{}
p.DebugLevel = 5
@ -73,13 +71,3 @@ func (prompt) Info(p *cardsim.Player[*SmokeTestCollection]) ([]cardsim.Message,
cardsim.Msgf("The current Number is %d. It tastes like %s.", p.Stats.Number.Value, p.Stats.Flavor.Value),
}, nil
}
type ruledumper struct{}
func (ruledumper) Title(p *player) cardsim.Message {
return cardsim.MsgStr("Rule Dumper")
}
func (ruledumper) Info(p *player) ([]cardsim.Message, error) {
return []cardsim.Message{cardsim.Msgf("%# v", pretty.Formatter(p.Rules))}, nil
}