// Binary smoketest runs a very simple cardsim thing. package main import ( "fmt" "git.chromaticdragon.app/kistaro/CardSimEngine/cardsim" ) func main() { p := cardsim.InitPlayer( &SmokeTestCollection{ Number: cardsim.Stored[int]{ Name: "Number", Value: 0, }, Total: cardsim.Stored[int64]{ Name: "Total", Value: 0, }, Turns: cardsim.Invisible[int]{ Name: "Turns", Value: 0, }, Flavor: cardsim.Stored[string]{ Name: "Flavor", Value: "Lemon", }, Things: 5, MoreThings: 9, FloatyThings: 123.456, Label: "whee", }, ) p.Name = "Dave" p.HandLimit = 3 p.ActionsPerTurn = 2 installRules(p.Rules) initDeck(p.Deck) installPermanentActions(&p.PermanentActions) installDebugActions(&p.DebugActions) p.InfoPanels = []cardsim.InfoPanel[*SmokeTestCollection]{ &cardsim.BasicStatsPanel[*SmokeTestCollection]{ Name: cardsim.MsgStr("Stats"), Intro: cardsim.MsgStr("Hi! These are the smoke test stats."), }, cardsim.RuleDumper[*SmokeTestCollection]{}, } p.Prompt = prompt{} p.DebugLevel = 5 err := cardsim.RunSimpleTerminalUI(p) if err != nil { fmt.Println("Terminated with error:") fmt.Println(err) } else { fmt.Println("Terminated without error.") } } type prompt struct{} func (prompt) Title(p *cardsim.Player[*SmokeTestCollection]) cardsim.Message { return cardsim.MsgStr("Smoke Test") } func (prompt) Info(p *cardsim.Player[*SmokeTestCollection]) ([]cardsim.Message, error) { 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), cardsim.Msgf("The current Number is %d. It tastes like %s.", p.Stats.Number.Value, p.Stats.Flavor.Value), }, nil }