Versions in this module Expand all Collapse all v0 v0.1.1 Aug 4, 2018 v0.1.0 Aug 4, 2018 Changes in this version + var Stages = []Stage + type ApiServer struct + Consumer EventConsumer + func (a *ApiServer) PublishState(state State) + func (a *ApiServer) WsHandler(w http.ResponseWriter, r *http.Request) + type CardModification struct + CardID int + TimeLeft time.Duration + type CardOperation string + const CardOperationAdd + const CardOperationModify + const CardOperationRevoke + type CardType string + const CardTypeRed + const CardTypeYellow + type Config struct + Game ConfigGame + Publish ConfigPublish + func DefaultConfig() (c Config) + func LoadConfig(fileName string) (config Config, err error) + type ConfigGame struct + Normal ConfigSpecial + Overtime ConfigSpecial + YellowCardDuration time.Duration + type ConfigPublish struct + Address string + type ConfigSpecial struct + BreakAfter time.Duration + HalfDuration time.Duration + HalfTimeDuration time.Duration + TimeoutDuration time.Duration + Timeouts int + type Engine struct + MatchTimeStart time.Time + StageTimes map[Stage]time.Duration + State *State + StateHistory []State + func NewEngine(config ConfigGame) (e Engine) + func (e *Engine) Process(event Event) (*EventCommand, error) + func (e *Engine) ResetGame() + func (e *Engine) Tick(delta time.Duration) + func (e *Engine) UndoLastAction() + type Event struct + Card *EventCard + Command *EventCommand + Modify *EventModifyValue + Stage *EventStage + Trigger *EventTrigger + func (e Event) String() string + type EventCard struct + ForTeam Team + Modification CardModification + Operation CardOperation + Type CardType + type EventCommand struct + ForTeam *Team + Type RefCommand + func (c EventCommand) String() string + type EventConsumer interface + OnNewEvent func(event Event) + type EventModifyCardTime struct + CardID int + Duration string + type EventModifyValue struct + ForTeam Team + Goalie *int + Goals *int + OnPositiveHalf *bool + RedCards *int + TeamName *string + TimeoutTimeLeft *string + TimeoutsLeft *int + YellowCardTime *EventModifyCardTime + YellowCards *int + func (m EventModifyValue) String() string + type EventStage struct + StageOperation StageOperation + type EventTrigger struct + Type TriggerType + type GameController struct + ApiServer ApiServer + Config Config + Engine Engine + Publisher Publisher + func NewGameController() (r *GameController) + func (r *GameController) OnNewEvent(event Event) + func (r *GameController) Run() (err error) + type GameState string + const GameStateBallPlacement + const GameStateHalted + const GameStatePreKickoff + const GameStatePrePenalty + const GameStateRunning + const GameStateStopped + const GameStateTimeout + type Publisher struct + func NewPublisher(address string) (publisher Publisher, err error) + func (p *Publisher) Publish(state *State, command *EventCommand) + type RefCommand string + const CommandBallPlacement + const CommandDirect + const CommandForceStart + const CommandGoal + const CommandHalt + const CommandIndirect + const CommandKickoff + const CommandNormalStart + const CommandPenalty + const CommandStop + const CommandTimeout + type Stage string + const StageFirstHalf + const StageHalfTime + const StageOvertimeBreak + const StageOvertimeFirstHalf + const StageOvertimeFirstHalfPre + const StageOvertimeHalfTime + const StageOvertimeSecondHalf + const StageOvertimeSecondHalfPre + const StagePostGame + const StagePreGame + const StageSecondHalf + const StageSecondHalfPre + const StageShootout + const StageShootoutBreak + func (s Stage) IsPreStage() bool + func (s Stage) Next() Stage + func (s Stage) Previous() Stage + type StageOperation string + const StageNext + const StagePrevious + type State struct + GameState GameState + GameStateFor *Team + MatchDuration time.Duration + Stage Stage + StageTimeElapsed time.Duration + StageTimeLeft time.Duration + TeamState map[Team]*TeamInfo + func NewState() (s *State) + func (s State) String() string + type Team string + const TeamBlue + const TeamYellow + func (t Team) Opposite() Team + func (t Team) Unknown() bool + type TeamInfo struct + Goalie int + Goals int + Name string + OnPositiveHalf bool + RedCards int + TimeoutTimeLeft time.Duration + TimeoutsLeft int + YellowCardTimes []time.Duration + YellowCards int + func (t TeamInfo) String() string + type TriggerType string + const TriggerResetMatch + const TriggerSwitchColor + const TriggerSwitchSides + const TriggerUndo