First round of substantial bug fixes
This commit is contained in:
parent
0f21020647
commit
9796c2e970
@ -8,13 +8,14 @@ import (
|
||||
)
|
||||
|
||||
func RunSimpleTerminalUI[C StatsCollection](p *Player[C]) error {
|
||||
for {
|
||||
|
||||
err := p.StartNextTurn()
|
||||
if p.DebugLevel < 1 && IsSeriousError(err) {
|
||||
return err
|
||||
}
|
||||
p.ReportError(err)
|
||||
|
||||
for {
|
||||
for p.CanAct() {
|
||||
isCard, cardIdx, choiceIdx, err := pickNextAction(p)
|
||||
p.ReportError(err)
|
||||
|
6
go.mod
6
go.mod
@ -1,3 +1,9 @@
|
||||
module cardSimEngine
|
||||
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.9.0 // indirect
|
||||
)
|
||||
|
8
go.sum
Normal file
8
go.sum
Normal file
@ -0,0 +1,8 @@
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
@ -4,6 +4,8 @@ package main
|
||||
import (
|
||||
"cardSimEngine/cardsim"
|
||||
"fmt"
|
||||
|
||||
"github.com/kr/pretty"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -38,6 +40,7 @@ func main() {
|
||||
Name: cardsim.MsgStr("Stats"),
|
||||
Intro: cardsim.MsgStr("Hi! These are the smoke test stats."),
|
||||
},
|
||||
ruledumper{},
|
||||
}
|
||||
p.Prompt = prompt{}
|
||||
p.DebugLevel = 5
|
||||
@ -58,5 +61,18 @@ func (prompt) Title(p *cardsim.Player[*SmokeTestCollection]) cardsim.Message {
|
||||
}
|
||||
|
||||
func (prompt) Info(p *cardsim.Player[*SmokeTestCollection]) ([]cardsim.Message, error) {
|
||||
return []cardsim.Message{cardsim.MsgStr("Here, have some stuff.")}, nil
|
||||
return []cardsim.Message{
|
||||
cardsim.MsgStr("Here, have some stuff."),
|
||||
cardsim.Msgf("It's turn %d according to the player and turn %d according to me.", p.TurnNumber, p.Stats.Turns.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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user