package tome_lib import "fmt" type CmdType string const ( ActCmd = "a" StateCmd = "s" DebugCmd = "d" InvalidCmd = "e" ) type Command struct { PlayerID int `json:"player_id"` Type CmdType `json:"type"` Cmd string `json:"cmd"` } func (c *Command) String() string { return fmt.Sprintf("%v %v %v", c.PlayerID, c.Type, c.Cmd) } type CommandResult struct { PlayerID int `json:"player_id"` ResultType CmdType `json:"result_type"` StateResult *GameView `json:"state_result,omitempty"` ActionResult *Deck `json:"action_result,omitempty"` DebugResult *interface{} `json:"debug_result,omitempty"` } func (c *CommandResult) String() string { return fmt.Sprintf("%v %v\nState Result: %v\nAction Result: %v\nDebug: %v\n", c.PlayerID, c.ResultType, c.StateResult, c.ActionResult, c.DebugResult) }