models

package
v0.0.0-...-c4db5c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const EnergyLoss = 0.96
View Source
const GlobalDumping = 0.98

Variables

View Source
var PlayersArgentina = []string{"Crespo", "Messi", "Ricardo", "Carrizo", "Labruna", "Batistuta", "Ubaldo", "Kempes", "Passarella", "Maradona"}
View Source
var PlayersBrazil = []string{"Gérson", "Tostão", "Zico", "Rivaldo", "Jairzinho", "Ronaldo", "Carlos Alberto", "Didi", "Garrincha", "Pelé"}

Functions

func GetBallInputChannel

func GetBallInputChannel() <-chan *Ball

func GetBallOutputChannel

func GetBallOutputChannel() chan<- *Ball

func GetPlayerName

func GetPlayerName(team Team) string

Types

type Ball

type Ball struct {
	X           float64   `json:"x"`
	Y           float64   `json:"y"`
	Vx          float64   `json:"v_x"`
	Vy          float64   `json:"v_y"`
	Z           float64   `json:"z"`
	Vz          float64   `json:"vz"`
	LastPlayer  string    `json:"last_player"`
	LastTeam    int       `json:"last_team"`
	LastUpdated time.Time `json:"last_updated"`
	HolderID    string    `json:"holder_id"`
	HolderTeam  Team      `json:"holder_team"`
	LastKick    time.Time `json:"last_kick"`
}

func (*Ball) ApplyKinematics

func (b *Ball) ApplyKinematics()

func (*Ball) GetDisplayStatus

func (b *Ball) GetDisplayStatus() *DisplayStatus

func (*Ball) GetSurfaceVelocity

func (b *Ball) GetSurfaceVelocity() float64

type DisplayStatus

type DisplayStatus struct {
	ItemID      string            `json:"item_id"`
	ItemLabel   string            `json:"item_label"`
	ItemType    DisplayStatusType `json:"item_type"`
	TeamID      Team              `json:"team_id"`
	X           float64           `json:"x"`
	Y           float64           `json:"y"`
	Z           float64           `json:"z"`
	LastUpdated time.Time         `json:"last_updated"`
}

type DisplayStatusProvider

type DisplayStatusProvider interface {
	GetDisplayStatus() *DisplayStatus
}

type DisplayStatusType

type DisplayStatusType string
const (
	TypeBall   DisplayStatusType = "ball"
	TypePlayer DisplayStatusType = "player"
)

type GameField

type GameField struct {
	Items syncmap.Map
	// contains filtered or unexported fields
}

func NewGameField

func NewGameField() *GameField

func (*GameField) MarshalJSON

func (gf *GameField) MarshalJSON() ([]byte, error)

func (*GameField) Update

func (gf *GameField) Update(item *DisplayStatus)

type Player

type Player struct {
	X      float64
	Y      float64
	TeamID Team
	ID     string
	Name   string

	MaxVelocity float64
	LastKick    time.Time
	// contains filtered or unexported fields
}

func (*Player) Activate

func (p *Player) Activate(displayChannel chan<- *DisplayStatus, wg *sync.WaitGroup)

func (*Player) GetDisplayStatus

func (p *Player) GetDisplayStatus() *DisplayStatus

type Team

type Team string
const (
	Brazil    Team = "brazil"
	Argentina Team = "argentina"
	Both      Team = "both"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL