proto

package
Version: v2.0.0-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package proto is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var CommandResponse_StatusCode_name = map[int32]string{
	0:  "SUCCESS",
	1:  "INVALID_VALUE",
	2:  "DEADLINE_EXCEEDED",
	99: "OTHER",
}
View Source
var CommandResponse_StatusCode_value = map[string]int32{
	"SUCCESS":           0,
	"INVALID_VALUE":     1,
	"DEADLINE_EXCEEDED": 2,
	"OTHER":             99,
}
View Source
var GameSnapshot_Phase_name = map[int32]string{
	0:  "WAITING",
	1:  "GET_READY",
	2:  "LISTENING",
	3:  "PLAYING",
	99: "OVER",
}
View Source
var GameSnapshot_Phase_value = map[string]int32{
	"WAITING":   0,
	"GET_READY": 1,
	"LISTENING": 2,
	"PLAYING":   3,
	"OVER":      99,
}
View Source
var OrderResponse_StatusCode_name = map[int32]string{
	0:  "SUCCESS",
	1:  "UNKNOWN_PLAYER",
	2:  "NOT_LISTENING",
	3:  "WRONG_TURN",
	99: "OTHER",
}
View Source
var OrderResponse_StatusCode_value = map[string]int32{
	"SUCCESS":        0,
	"UNKNOWN_PLAYER": 1,
	"NOT_LISTENING":  2,
	"WRONG_TURN":     3,
	"OTHER":          99,
}
View Source
var Team_Side_name = map[int32]string{
	0: "HOME",
	1: "AWAY",
}
View Source
var Team_Side_value = map[string]int32{
	"HOME": 0,
	"AWAY": 1,
}

Functions

func RegisterGameServer

func RegisterGameServer(s *grpc.Server, srv GameServer)

func RegisterRemoteServer

func RegisterRemoteServer(s *grpc.Server, srv RemoteServer)

Types

type Ball

type Ball struct {
	// Current position
	Position *Point `protobuf:"bytes,1,opt,name=Position,proto3" json:"Position,omitempty"`
	// Current velocity. It will be the exactly same velocity as the ball holder when a player is holding it.
	Velocity *Velocity `protobuf:"bytes,2,opt,name=velocity,proto3" json:"velocity,omitempty"`
	// Player that is currently holding the ball. Null if the ball is not holden.
	Holder               *Player  `protobuf:"bytes,3,opt,name=holder,proto3" json:"holder,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Stores all ball attributes

func (*Ball) Descriptor

func (*Ball) Descriptor() ([]byte, []int)

func (*Ball) GetHolder

func (m *Ball) GetHolder() *Player

func (*Ball) GetPosition

func (m *Ball) GetPosition() *Point

func (*Ball) GetVelocity

func (m *Ball) GetVelocity() *Velocity

func (*Ball) ProtoMessage

func (*Ball) ProtoMessage()

func (*Ball) Reset

func (m *Ball) Reset()

func (*Ball) String

func (m *Ball) String() string

func (*Ball) XXX_DiscardUnknown

func (m *Ball) XXX_DiscardUnknown()

func (*Ball) XXX_Marshal

func (m *Ball) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Ball) XXX_Merge

func (m *Ball) XXX_Merge(src proto.Message)

func (*Ball) XXX_Size

func (m *Ball) XXX_Size() int

func (*Ball) XXX_Unmarshal

func (m *Ball) XXX_Unmarshal(b []byte) error

type BallProperties

type BallProperties struct {
	Position             *Point    `protobuf:"bytes,1,opt,name=Position,proto3" json:"Position,omitempty"`
	Velocity             *Velocity `protobuf:"bytes,2,opt,name=velocity,proto3" json:"velocity,omitempty"`
	Holder               *Player   `protobuf:"bytes,3,opt,name=holder,proto3" json:"holder,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*BallProperties) Descriptor

func (*BallProperties) Descriptor() ([]byte, []int)

func (*BallProperties) GetHolder

func (m *BallProperties) GetHolder() *Player

func (*BallProperties) GetPosition

func (m *BallProperties) GetPosition() *Point

func (*BallProperties) GetVelocity

func (m *BallProperties) GetVelocity() *Velocity

func (*BallProperties) ProtoMessage

func (*BallProperties) ProtoMessage()

func (*BallProperties) Reset

func (m *BallProperties) Reset()

func (*BallProperties) String

func (m *BallProperties) String() string

func (*BallProperties) XXX_DiscardUnknown

func (m *BallProperties) XXX_DiscardUnknown()

func (*BallProperties) XXX_Marshal

func (m *BallProperties) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BallProperties) XXX_Merge

func (m *BallProperties) XXX_Merge(src proto.Message)

func (*BallProperties) XXX_Size

func (m *BallProperties) XXX_Size() int

func (*BallProperties) XXX_Unmarshal

func (m *BallProperties) XXX_Unmarshal(b []byte) error

type Catch

type Catch struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Order to try to catch the ball. The player can only catch the ball when the player is touching the ball. Only one catching order can be executed in a turn. So, if more than one player try to catch the ball in the same turn, the first processed catch order will succeed, and the next ones will fail.

func (*Catch) Descriptor

func (*Catch) Descriptor() ([]byte, []int)

func (*Catch) ProtoMessage

func (*Catch) ProtoMessage()

func (*Catch) Reset

func (m *Catch) Reset()

func (*Catch) String

func (m *Catch) String() string

func (*Catch) XXX_DiscardUnknown

func (m *Catch) XXX_DiscardUnknown()

func (*Catch) XXX_Marshal

func (m *Catch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Catch) XXX_Merge

func (m *Catch) XXX_Merge(src proto.Message)

func (*Catch) XXX_Size

func (m *Catch) XXX_Size() int

func (*Catch) XXX_Unmarshal

func (m *Catch) XXX_Unmarshal(b []byte) error

type CommandResponse

type CommandResponse struct {
	Code                 CommandResponse_StatusCode `protobuf:"varint,1,opt,name=code,proto3,enum=proto.CommandResponse_StatusCode" json:"code,omitempty"`
	GameSnapshot         *GameSnapshot              `protobuf:"bytes,2,opt,name=game_snapshot,json=gameSnapshot,proto3" json:"game_snapshot,omitempty"`
	Details              string                     `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                   `json:"-"`
	XXX_unrecognized     []byte                     `json:"-"`
	XXX_sizecache        int32                      `json:"-"`
}

func (*CommandResponse) Descriptor

func (*CommandResponse) Descriptor() ([]byte, []int)

func (*CommandResponse) GetCode

func (*CommandResponse) GetDetails

func (m *CommandResponse) GetDetails() string

func (*CommandResponse) GetGameSnapshot

func (m *CommandResponse) GetGameSnapshot() *GameSnapshot

func (*CommandResponse) ProtoMessage

func (*CommandResponse) ProtoMessage()

func (*CommandResponse) Reset

func (m *CommandResponse) Reset()

func (*CommandResponse) String

func (m *CommandResponse) String() string

func (*CommandResponse) XXX_DiscardUnknown

func (m *CommandResponse) XXX_DiscardUnknown()

func (*CommandResponse) XXX_Marshal

func (m *CommandResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CommandResponse) XXX_Merge

func (m *CommandResponse) XXX_Merge(src proto.Message)

func (*CommandResponse) XXX_Size

func (m *CommandResponse) XXX_Size() int

func (*CommandResponse) XXX_Unmarshal

func (m *CommandResponse) XXX_Unmarshal(b []byte) error

type CommandResponse_StatusCode

type CommandResponse_StatusCode int32
const (
	CommandResponse_SUCCESS           CommandResponse_StatusCode = 0
	CommandResponse_INVALID_VALUE     CommandResponse_StatusCode = 1
	CommandResponse_DEADLINE_EXCEEDED CommandResponse_StatusCode = 2
	CommandResponse_OTHER             CommandResponse_StatusCode = 99
)

func (CommandResponse_StatusCode) EnumDescriptor

func (CommandResponse_StatusCode) EnumDescriptor() ([]byte, []int)

func (CommandResponse_StatusCode) String

type GameClient

type GameClient interface {
	// JoinATeam allows the player to listen the server during the match.
	JoinATeam(ctx context.Context, in *JoinRequest, opts ...grpc.CallOption) (Game_JoinATeamClient, error)
	// SendOrders allows the player to send others to the server when the game is on listening state.
	SendOrders(ctx context.Context, in *OrderSet, opts ...grpc.CallOption) (*OrderResponse, error)
}

GameClient is the client API for Game service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewGameClient

func NewGameClient(cc *grpc.ClientConn) GameClient

type GameProperties

type GameProperties struct {
	Turn                 uint32   `protobuf:"varint,1,opt,name=turn,proto3" json:"turn,omitempty"`
	HomeScore            uint32   `protobuf:"varint,2,opt,name=home_score,json=homeScore,proto3" json:"home_score,omitempty"`
	AwayScore            uint32   `protobuf:"varint,3,opt,name=away_score,json=awayScore,proto3" json:"away_score,omitempty"`
	FrameInterval        int64    `protobuf:"varint,4,opt,name=frame_interval,json=frameInterval,proto3" json:"frame_interval,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GameProperties) Descriptor

func (*GameProperties) Descriptor() ([]byte, []int)

func (*GameProperties) GetAwayScore

func (m *GameProperties) GetAwayScore() uint32

func (*GameProperties) GetFrameInterval

func (m *GameProperties) GetFrameInterval() int64

func (*GameProperties) GetHomeScore

func (m *GameProperties) GetHomeScore() uint32

func (*GameProperties) GetTurn

func (m *GameProperties) GetTurn() uint32

func (*GameProperties) ProtoMessage

func (*GameProperties) ProtoMessage()

func (*GameProperties) Reset

func (m *GameProperties) Reset()

func (*GameProperties) String

func (m *GameProperties) String() string

func (*GameProperties) XXX_DiscardUnknown

func (m *GameProperties) XXX_DiscardUnknown()

func (*GameProperties) XXX_Marshal

func (m *GameProperties) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GameProperties) XXX_Merge

func (m *GameProperties) XXX_Merge(src proto.Message)

func (*GameProperties) XXX_Size

func (m *GameProperties) XXX_Size() int

func (*GameProperties) XXX_Unmarshal

func (m *GameProperties) XXX_Unmarshal(b []byte) error

type GameServer

type GameServer interface {
	// JoinATeam allows the player to listen the server during the match.
	JoinATeam(*JoinRequest, Game_JoinATeamServer) error
	// SendOrders allows the player to send others to the server when the game is on listening state.
	SendOrders(context.Context, *OrderSet) (*OrderResponse, error)
}

GameServer is the server API for Game service.

type GameSnapshot

type GameSnapshot struct {
	// The game state defines which phase the game is. The phase determine what the server is doing, are going to do, or
	// what it is waiting for.
	State GameSnapshot_Phase `protobuf:"varint,1,opt,name=state,proto3,enum=proto.GameSnapshot_Phase" json:"state,omitempty"`
	// Turns counter. It starts from 1, but before the match starts, it may be zero.
	Turn uint32 `protobuf:"varint,2,opt,name=turn,proto3" json:"turn,omitempty"`
	// Store the home team elements.
	HomeTeam *Team `protobuf:"bytes,3,opt,name=home_team,json=homeTeam,proto3" json:"home_team,omitempty"`
	// Store the away team elements.
	AwayTeam *Team `protobuf:"bytes,4,opt,name=away_team,json=awayTeam,proto3" json:"away_team,omitempty"`
	// Store the ball element.
	Ball                 *Ball    `protobuf:"bytes,5,opt,name=ball,proto3" json:"ball,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

GameSnapshot stores all game elements data.

func (*GameSnapshot) Descriptor

func (*GameSnapshot) Descriptor() ([]byte, []int)

func (*GameSnapshot) GetAwayTeam

func (m *GameSnapshot) GetAwayTeam() *Team

func (*GameSnapshot) GetBall

func (m *GameSnapshot) GetBall() *Ball

func (*GameSnapshot) GetHomeTeam

func (m *GameSnapshot) GetHomeTeam() *Team

func (*GameSnapshot) GetState

func (m *GameSnapshot) GetState() GameSnapshot_Phase

func (*GameSnapshot) GetTurn

func (m *GameSnapshot) GetTurn() uint32

func (*GameSnapshot) ProtoMessage

func (*GameSnapshot) ProtoMessage()

func (*GameSnapshot) Reset

func (m *GameSnapshot) Reset()

func (*GameSnapshot) String

func (m *GameSnapshot) String() string

func (*GameSnapshot) XXX_DiscardUnknown

func (m *GameSnapshot) XXX_DiscardUnknown()

func (*GameSnapshot) XXX_Marshal

func (m *GameSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GameSnapshot) XXX_Merge

func (m *GameSnapshot) XXX_Merge(src proto.Message)

func (*GameSnapshot) XXX_Size

func (m *GameSnapshot) XXX_Size() int

func (*GameSnapshot) XXX_Unmarshal

func (m *GameSnapshot) XXX_Unmarshal(b []byte) error

type GameSnapshot_Phase

type GameSnapshot_Phase int32
const (
	// The game is waiting for all players be connected. There is a configurable time limit to wait for players. After
	// this limit expires, the match is considered over.
	GameSnapshot_WAITING GameSnapshot_Phase = 0
	// The game resets the players position to start the match or to restart the match after a goal.
	GameSnapshot_GET_READY GameSnapshot_Phase = 1
	// The game is waiting for players orders. There is a configurable time window for this phase. After the time
	// limit expires, the server will ignore the missing orders and process the ones it got.
	// (when running on dev mode, the server may allow different behaviours)
	GameSnapshot_LISTENING GameSnapshot_Phase = 2
	// The game is executing the players' orders in the same sequence they were gotten.
	// If the ball is NOT been holden, its velocity will be processed first. Otherwise, it position will be updated
	// when the ball holder movement be processed.
	// If there is no movement orders from a player, but it has speed greater than 0, it will be processed after
	// all its orders are processed.
	// Each player orders will be processed in the same sequence they were included in the message (e.g. first move,
	// than kick)
	// The ball kick is processed immediately after the order (the ball position is updated as its new velocity
	// after the kick)
	GameSnapshot_PLAYING GameSnapshot_Phase = 3
	// The game may be over after any phase.
	// It can be over after Waiting if there is no players connected after the time limit for connections
	// It can be over after GetReady or Listening if there is no enough players (e.g. connection lost)
	// And it also can be over after Playing state if that was the last turn of the match.
	GameSnapshot_OVER GameSnapshot_Phase = 99
)

func (GameSnapshot_Phase) EnumDescriptor

func (GameSnapshot_Phase) EnumDescriptor() ([]byte, []int)

func (GameSnapshot_Phase) String

func (x GameSnapshot_Phase) String() string

type Game_JoinATeamClient

type Game_JoinATeamClient interface {
	Recv() (*GameSnapshot, error)
	grpc.ClientStream
}

type Game_JoinATeamServer

type Game_JoinATeamServer interface {
	Send(*GameSnapshot) error
	grpc.ServerStream
}

type JoinRequest

type JoinRequest struct {
	// Only used in official matches to guarantee that only one process will assume that player position (team and number).
	// The bot process will receive this token as an argument, and must send it to the server in this message.
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	// Identifies the protocol version of the bot.
	ProtocolVersion string `protobuf:"bytes,2,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"`
	// Identify the bot's team side (Team_Home or Team_Away)
	TeamSide Team_Side `protobuf:"varint,3,opt,name=team_side,json=teamSide,proto3,enum=proto.Team_Side" json:"team_side,omitempty"`
	// Player's number 1-11
	Number uint32 `protobuf:"varint,4,opt,name=number,proto3" json:"number,omitempty"`
	// Position where the player must be set at "GetReady" state (at beginning of the match or after a goal)
	InitPosition         *Point   `protobuf:"bytes,5,opt,name=init_position,json=initPosition,proto3" json:"init_position,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

JoinRequest define the player configuration to the game.

func (*JoinRequest) Descriptor

func (*JoinRequest) Descriptor() ([]byte, []int)

func (*JoinRequest) GetInitPosition

func (m *JoinRequest) GetInitPosition() *Point

func (*JoinRequest) GetNumber

func (m *JoinRequest) GetNumber() uint32

func (*JoinRequest) GetProtocolVersion

func (m *JoinRequest) GetProtocolVersion() string

func (*JoinRequest) GetTeamSide

func (m *JoinRequest) GetTeamSide() Team_Side

func (*JoinRequest) GetToken

func (m *JoinRequest) GetToken() string

func (*JoinRequest) ProtoMessage

func (*JoinRequest) ProtoMessage()

func (*JoinRequest) Reset

func (m *JoinRequest) Reset()

func (*JoinRequest) String

func (m *JoinRequest) String() string

func (*JoinRequest) XXX_DiscardUnknown

func (m *JoinRequest) XXX_DiscardUnknown()

func (*JoinRequest) XXX_Marshal

func (m *JoinRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*JoinRequest) XXX_Merge

func (m *JoinRequest) XXX_Merge(src proto.Message)

func (*JoinRequest) XXX_Size

func (m *JoinRequest) XXX_Size() int

func (*JoinRequest) XXX_Unmarshal

func (m *JoinRequest) XXX_Unmarshal(b []byte) error

type Jump

type Jump struct {
	// Goalkeeper's velocity during the jump.
	Velocity             *Velocity `protobuf:"bytes,1,opt,name=velocity,proto3" json:"velocity,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

Changes the goalkeepers velocity in a higher speed. The goalkeepers may move kicker than other players when they jump, however the jump movement cannot be interrupted after triggered. (read specs to find out the number of turns the jump lasts)

func (*Jump) Descriptor

func (*Jump) Descriptor() ([]byte, []int)

func (*Jump) GetVelocity

func (m *Jump) GetVelocity() *Velocity

func (*Jump) ProtoMessage

func (*Jump) ProtoMessage()

func (*Jump) Reset

func (m *Jump) Reset()

func (*Jump) String

func (m *Jump) String() string

func (*Jump) XXX_DiscardUnknown

func (m *Jump) XXX_DiscardUnknown()

func (*Jump) XXX_Marshal

func (m *Jump) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Jump) XXX_Merge

func (m *Jump) XXX_Merge(src proto.Message)

func (*Jump) XXX_Size

func (m *Jump) XXX_Size() int

func (*Jump) XXX_Unmarshal

func (m *Jump) XXX_Unmarshal(b []byte) error

type Kick

type Kick struct {
	// Kick velocity (it won't be necessarily the final ball velocity)
	Velocity             *Velocity `protobuf:"bytes,1,opt,name=velocity,proto3" json:"velocity,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

The kick order is only executed by the ball holder, and it is processed immediately. Important: The kick velocity is summed to the current ball velocity. The kick speed will suffer a power reduction proportionally to the player direction when the kick is not in the same direction of the player direction. The reduction is calculated based on the angle with the player direction using the formula `SpeedReducerFactor = 0.5 + (0.5 * ((180 - ang) / 180))` In summary, the speed will by reduced proportionally to the angle from 100% at 0 degrees until the limit of 50% at 180 degrees.

func (*Kick) Descriptor

func (*Kick) Descriptor() ([]byte, []int)

func (*Kick) GetVelocity

func (m *Kick) GetVelocity() *Velocity

func (*Kick) ProtoMessage

func (*Kick) ProtoMessage()

func (*Kick) Reset

func (m *Kick) Reset()

func (*Kick) String

func (m *Kick) String() string

func (*Kick) XXX_DiscardUnknown

func (m *Kick) XXX_DiscardUnknown()

func (*Kick) XXX_Marshal

func (m *Kick) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Kick) XXX_Merge

func (m *Kick) XXX_Merge(src proto.Message)

func (*Kick) XXX_Size

func (m *Kick) XXX_Size() int

func (*Kick) XXX_Unmarshal

func (m *Kick) XXX_Unmarshal(b []byte) error

type MockGameClient

type MockGameClient struct {
	// contains filtered or unexported fields
}

MockGameClient is a mock of GameClient interface

func NewMockGameClient

func NewMockGameClient(ctrl *gomock.Controller) *MockGameClient

NewMockGameClient creates a new mock instance

func (*MockGameClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockGameClient) JoinATeam

func (m *MockGameClient) JoinATeam(arg0 context.Context, arg1 *JoinRequest, arg2 ...grpc.CallOption) (Game_JoinATeamClient, error)

JoinATeam mocks base method

func (*MockGameClient) SendOrders

func (m *MockGameClient) SendOrders(arg0 context.Context, arg1 *OrderSet, arg2 ...grpc.CallOption) (*OrderResponse, error)

SendOrders mocks base method

type MockGameClientMockRecorder

type MockGameClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockGameClientMockRecorder is the mock recorder for MockGameClient

func (*MockGameClientMockRecorder) JoinATeam

func (mr *MockGameClientMockRecorder) JoinATeam(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call

JoinATeam indicates an expected call of JoinATeam

func (*MockGameClientMockRecorder) SendOrders

func (mr *MockGameClientMockRecorder) SendOrders(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call

SendOrders indicates an expected call of SendOrders

type MockGameServer

type MockGameServer struct {
	// contains filtered or unexported fields
}

MockGameServer is a mock of GameServer interface

func NewMockGameServer

func NewMockGameServer(ctrl *gomock.Controller) *MockGameServer

NewMockGameServer creates a new mock instance

func NewMockServer

func NewMockServer(ctx context.Context, ctr *gomock.Controller, port int16) (*MockGameServer, error)

func (*MockGameServer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockGameServer) JoinATeam

func (m *MockGameServer) JoinATeam(arg0 *JoinRequest, arg1 Game_JoinATeamServer) error

JoinATeam mocks base method

func (*MockGameServer) SendOrders

func (m *MockGameServer) SendOrders(arg0 context.Context, arg1 *OrderSet) (*OrderResponse, error)

SendOrders mocks base method

type MockGameServerMockRecorder

type MockGameServerMockRecorder struct {
	// contains filtered or unexported fields
}

MockGameServerMockRecorder is the mock recorder for MockGameServer

func (*MockGameServerMockRecorder) JoinATeam

func (mr *MockGameServerMockRecorder) JoinATeam(arg0, arg1 interface{}) *gomock.Call

JoinATeam indicates an expected call of JoinATeam

func (*MockGameServerMockRecorder) SendOrders

func (mr *MockGameServerMockRecorder) SendOrders(arg0, arg1 interface{}) *gomock.Call

SendOrders indicates an expected call of SendOrders

type MockGame_JoinATeamClient

type MockGame_JoinATeamClient struct {
	// contains filtered or unexported fields
}

MockGame_JoinATeamClient is a mock of Game_JoinATeamClient interface

func NewMockGame_JoinATeamClient

func NewMockGame_JoinATeamClient(ctrl *gomock.Controller) *MockGame_JoinATeamClient

NewMockGame_JoinATeamClient creates a new mock instance

func (*MockGame_JoinATeamClient) CloseSend

func (m *MockGame_JoinATeamClient) CloseSend() error

CloseSend mocks base method

func (*MockGame_JoinATeamClient) Context

Context mocks base method

func (*MockGame_JoinATeamClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockGame_JoinATeamClient) Header

func (m *MockGame_JoinATeamClient) Header() (metadata.MD, error)

Header mocks base method

func (*MockGame_JoinATeamClient) Recv

Recv mocks base method

func (*MockGame_JoinATeamClient) RecvMsg

func (m *MockGame_JoinATeamClient) RecvMsg(arg0 interface{}) error

RecvMsg mocks base method

func (*MockGame_JoinATeamClient) SendMsg

func (m *MockGame_JoinATeamClient) SendMsg(arg0 interface{}) error

SendMsg mocks base method

func (*MockGame_JoinATeamClient) Trailer

func (m *MockGame_JoinATeamClient) Trailer() metadata.MD

Trailer mocks base method

type MockGame_JoinATeamClientMockRecorder

type MockGame_JoinATeamClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockGame_JoinATeamClientMockRecorder is the mock recorder for MockGame_JoinATeamClient

func (*MockGame_JoinATeamClientMockRecorder) CloseSend

CloseSend indicates an expected call of CloseSend

func (*MockGame_JoinATeamClientMockRecorder) Context

Context indicates an expected call of Context

func (*MockGame_JoinATeamClientMockRecorder) Header

Header indicates an expected call of Header

func (*MockGame_JoinATeamClientMockRecorder) Recv

Recv indicates an expected call of Recv

func (*MockGame_JoinATeamClientMockRecorder) RecvMsg

func (mr *MockGame_JoinATeamClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call

RecvMsg indicates an expected call of RecvMsg

func (*MockGame_JoinATeamClientMockRecorder) SendMsg

func (mr *MockGame_JoinATeamClientMockRecorder) SendMsg(arg0 interface{}) *gomock.Call

SendMsg indicates an expected call of SendMsg

func (*MockGame_JoinATeamClientMockRecorder) Trailer

Trailer indicates an expected call of Trailer

type MockGame_JoinATeamServer

type MockGame_JoinATeamServer struct {
	// contains filtered or unexported fields
}

MockGame_JoinATeamServer is a mock of Game_JoinATeamServer interface

func NewMockGame_JoinATeamServer

func NewMockGame_JoinATeamServer(ctrl *gomock.Controller) *MockGame_JoinATeamServer

NewMockGame_JoinATeamServer creates a new mock instance

func (*MockGame_JoinATeamServer) Context

Context mocks base method

func (*MockGame_JoinATeamServer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockGame_JoinATeamServer) RecvMsg

func (m *MockGame_JoinATeamServer) RecvMsg(arg0 interface{}) error

RecvMsg mocks base method

func (*MockGame_JoinATeamServer) Send

Send mocks base method

func (*MockGame_JoinATeamServer) SendHeader

func (m *MockGame_JoinATeamServer) SendHeader(arg0 metadata.MD) error

SendHeader mocks base method

func (*MockGame_JoinATeamServer) SendMsg

func (m *MockGame_JoinATeamServer) SendMsg(arg0 interface{}) error

SendMsg mocks base method

func (*MockGame_JoinATeamServer) SetHeader

func (m *MockGame_JoinATeamServer) SetHeader(arg0 metadata.MD) error

SetHeader mocks base method

func (*MockGame_JoinATeamServer) SetTrailer

func (m *MockGame_JoinATeamServer) SetTrailer(arg0 metadata.MD)

SetTrailer mocks base method

type MockGame_JoinATeamServerMockRecorder

type MockGame_JoinATeamServerMockRecorder struct {
	// contains filtered or unexported fields
}

MockGame_JoinATeamServerMockRecorder is the mock recorder for MockGame_JoinATeamServer

func (*MockGame_JoinATeamServerMockRecorder) Context

Context indicates an expected call of Context

func (*MockGame_JoinATeamServerMockRecorder) RecvMsg

func (mr *MockGame_JoinATeamServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call

RecvMsg indicates an expected call of RecvMsg

func (*MockGame_JoinATeamServerMockRecorder) Send

func (mr *MockGame_JoinATeamServerMockRecorder) Send(arg0 interface{}) *gomock.Call

Send indicates an expected call of Send

func (*MockGame_JoinATeamServerMockRecorder) SendHeader

func (mr *MockGame_JoinATeamServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call

SendHeader indicates an expected call of SendHeader

func (*MockGame_JoinATeamServerMockRecorder) SendMsg

func (mr *MockGame_JoinATeamServerMockRecorder) SendMsg(arg0 interface{}) *gomock.Call

SendMsg indicates an expected call of SendMsg

func (*MockGame_JoinATeamServerMockRecorder) SetHeader

func (mr *MockGame_JoinATeamServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call

SetHeader indicates an expected call of SetHeader

func (*MockGame_JoinATeamServerMockRecorder) SetTrailer

func (mr *MockGame_JoinATeamServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call

SetTrailer indicates an expected call of SetTrailer

type MockPlayerOrder

type MockPlayerOrder struct {
	// contains filtered or unexported fields
}

MockPlayerOrder is a mock of PlayerOrder interface

func NewMockPlayerOrder

func NewMockPlayerOrder(ctrl *gomock.Controller) *MockPlayerOrder

NewMockPlayerOrder creates a new mock instance

func (*MockPlayerOrder) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockPlayerOrder) LugoOrdersUnifier

func (m *MockPlayerOrder) LugoOrdersUnifier()

LugoOrdersUnifier mocks base method

type MockPlayerOrderMockRecorder

type MockPlayerOrderMockRecorder struct {
	// contains filtered or unexported fields
}

MockPlayerOrderMockRecorder is the mock recorder for MockPlayerOrder

func (*MockPlayerOrderMockRecorder) LugoOrdersUnifier

func (mr *MockPlayerOrderMockRecorder) LugoOrdersUnifier() *gomock.Call

LugoOrdersUnifier indicates an expected call of LugoOrdersUnifier

type Move

type Move struct {
	// The nex Velocity
	Velocity             *Velocity `protobuf:"bytes,1,opt,name=velocity,proto3" json:"velocity,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

Order to ask the server to change the player velocity (direction and speed). This order replaces the current player velocity, and the new velocity attribute will be immediately processed in that turn. There is a limit speed to the player. The server will cap the velocity if the request is higher than the limit.

func (*Move) Descriptor

func (*Move) Descriptor() ([]byte, []int)

func (*Move) GetVelocity

func (m *Move) GetVelocity() *Velocity

func (*Move) ProtoMessage

func (*Move) ProtoMessage()

func (*Move) Reset

func (m *Move) Reset()

func (*Move) String

func (m *Move) String() string

func (*Move) XXX_DiscardUnknown

func (m *Move) XXX_DiscardUnknown()

func (*Move) XXX_Marshal

func (m *Move) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Move) XXX_Merge

func (m *Move) XXX_Merge(src proto.Message)

func (*Move) XXX_Size

func (m *Move) XXX_Size() int

func (*Move) XXX_Unmarshal

func (m *Move) XXX_Unmarshal(b []byte) error

type Order

type Order struct {
	// Types that are valid to be assigned to Action:
	//	*Order_Move
	//	*Order_Catch
	//	*Order_Kick
	//	*Order_Jump
	Action               isOrder_Action `protobuf_oneof:"action"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

Order to the game server. To be sent by players during the Listening phase.

func (*Order) Descriptor

func (*Order) Descriptor() ([]byte, []int)

func (*Order) GetAction

func (m *Order) GetAction() isOrder_Action

func (*Order) GetCatch

func (m *Order) GetCatch() *Catch

func (*Order) GetJump

func (m *Order) GetJump() *Jump

func (*Order) GetKick

func (m *Order) GetKick() *Kick

func (*Order) GetMove

func (m *Order) GetMove() *Move

func (*Order) ProtoMessage

func (*Order) ProtoMessage()

func (*Order) Reset

func (m *Order) Reset()

func (*Order) String

func (m *Order) String() string

func (*Order) XXX_DiscardUnknown

func (m *Order) XXX_DiscardUnknown()

func (*Order) XXX_Marshal

func (m *Order) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Order) XXX_Merge

func (m *Order) XXX_Merge(src proto.Message)

func (*Order) XXX_OneofWrappers

func (*Order) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*Order) XXX_Size

func (m *Order) XXX_Size() int

func (*Order) XXX_Unmarshal

func (m *Order) XXX_Unmarshal(b []byte) error

type OrderResponse

type OrderResponse struct {
	// Define if the order will be correctly processed.
	Code OrderResponse_StatusCode `protobuf:"varint,1,opt,name=code,proto3,enum=proto.OrderResponse_StatusCode" json:"code,omitempty"`
	// String message used for debugging proposes.
	Details              string   `protobuf:"bytes,2,opt,name=details,proto3" json:"details,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Message sent to the player as a response after sending a order set to the the server.

func (*OrderResponse) Descriptor

func (*OrderResponse) Descriptor() ([]byte, []int)

func (*OrderResponse) GetCode

func (*OrderResponse) GetDetails

func (m *OrderResponse) GetDetails() string

func (*OrderResponse) ProtoMessage

func (*OrderResponse) ProtoMessage()

func (*OrderResponse) Reset

func (m *OrderResponse) Reset()

func (*OrderResponse) String

func (m *OrderResponse) String() string

func (*OrderResponse) XXX_DiscardUnknown

func (m *OrderResponse) XXX_DiscardUnknown()

func (*OrderResponse) XXX_Marshal

func (m *OrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*OrderResponse) XXX_Merge

func (m *OrderResponse) XXX_Merge(src proto.Message)

func (*OrderResponse) XXX_Size

func (m *OrderResponse) XXX_Size() int

func (*OrderResponse) XXX_Unmarshal

func (m *OrderResponse) XXX_Unmarshal(b []byte) error

type OrderResponse_StatusCode

type OrderResponse_StatusCode int32
const (
	OrderResponse_SUCCESS        OrderResponse_StatusCode = 0
	OrderResponse_UNKNOWN_PLAYER OrderResponse_StatusCode = 1
	OrderResponse_NOT_LISTENING  OrderResponse_StatusCode = 2
	OrderResponse_WRONG_TURN     OrderResponse_StatusCode = 3
	OrderResponse_OTHER          OrderResponse_StatusCode = 99
)

func (OrderResponse_StatusCode) EnumDescriptor

func (OrderResponse_StatusCode) EnumDescriptor() ([]byte, []int)

func (OrderResponse_StatusCode) String

func (x OrderResponse_StatusCode) String() string

type OrderSet

type OrderSet struct {
	// Turn which this order set should be processed at.
	Turn uint32 `protobuf:"varint,1,opt,name=turn,proto3" json:"turn,omitempty"`
	// List of orders in the expected order of execution
	Orders []*Order `protobuf:"bytes,2,rep,name=orders,proto3" json:"orders,omitempty"`
	// String message used for debugging proposes.
	DebugMessage         string   `protobuf:"bytes,3,opt,name=debug_message,json=debugMessage,proto3" json:"debug_message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Message containing the orders the player want to send to the server in that turn.

func (*OrderSet) Descriptor

func (*OrderSet) Descriptor() ([]byte, []int)

func (*OrderSet) GetDebugMessage

func (m *OrderSet) GetDebugMessage() string

func (*OrderSet) GetOrders

func (m *OrderSet) GetOrders() []*Order

func (*OrderSet) GetTurn

func (m *OrderSet) GetTurn() uint32

func (*OrderSet) ProtoMessage

func (*OrderSet) ProtoMessage()

func (*OrderSet) Reset

func (m *OrderSet) Reset()

func (*OrderSet) String

func (m *OrderSet) String() string

func (*OrderSet) XXX_DiscardUnknown

func (m *OrderSet) XXX_DiscardUnknown()

func (*OrderSet) XXX_Marshal

func (m *OrderSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*OrderSet) XXX_Merge

func (m *OrderSet) XXX_Merge(src proto.Message)

func (*OrderSet) XXX_Size

func (m *OrderSet) XXX_Size() int

func (*OrderSet) XXX_Unmarshal

func (m *OrderSet) XXX_Unmarshal(b []byte) error

type Order_Catch

type Order_Catch struct {
	Catch *Catch `protobuf:"bytes,2,opt,name=catch,proto3,oneof"`
}

func (*Order_Catch) LugoOrdersUnifier

func (*Order_Catch) LugoOrdersUnifier()

type Order_Jump

type Order_Jump struct {
	Jump *Jump `protobuf:"bytes,4,opt,name=jump,proto3,oneof"`
}

func (*Order_Jump) LugoOrdersUnifier

func (*Order_Jump) LugoOrdersUnifier()

type Order_Kick

type Order_Kick struct {
	Kick *Kick `protobuf:"bytes,3,opt,name=kick,proto3,oneof"`
}

func (*Order_Kick) LugoOrdersUnifier

func (*Order_Kick) LugoOrdersUnifier()

type Order_Move

type Order_Move struct {
	Move *Move `protobuf:"bytes,1,opt,name=move,proto3,oneof"`
}

func (*Order_Move) LugoOrdersUnifier

func (*Order_Move) LugoOrdersUnifier()

type Player

type Player struct {
	// Number of this player in its team (1-11)
	Number uint32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
	// Current player position
	Position *Point `protobuf:"bytes,2,opt,name=Position,proto3" json:"Position,omitempty"`
	// Current player velocity
	Velocity *Velocity `protobuf:"bytes,3,opt,name=velocity,proto3" json:"velocity,omitempty"`
	// Team side which its playing in (it's used to speed up some readings since the player element will be in a list
	// of players of a team)
	TeamSide Team_Side `protobuf:"varint,4,opt,name=team_side,json=teamSide,proto3,enum=proto.Team_Side" json:"team_side,omitempty"`
	// Default position when it's position is reset
	InitPosition         *Point   `protobuf:"bytes,5,opt,name=init_position,json=initPosition,proto3" json:"init_position,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Stores all player attributes

func (*Player) Descriptor

func (*Player) Descriptor() ([]byte, []int)

func (*Player) GetInitPosition

func (m *Player) GetInitPosition() *Point

func (*Player) GetNumber

func (m *Player) GetNumber() uint32

func (*Player) GetPosition

func (m *Player) GetPosition() *Point

func (*Player) GetTeamSide

func (m *Player) GetTeamSide() Team_Side

func (*Player) GetVelocity

func (m *Player) GetVelocity() *Velocity

func (*Player) ProtoMessage

func (*Player) ProtoMessage()

func (*Player) Reset

func (m *Player) Reset()

func (*Player) String

func (m *Player) String() string

func (*Player) XXX_DiscardUnknown

func (m *Player) XXX_DiscardUnknown()

func (*Player) XXX_Marshal

func (m *Player) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Player) XXX_Merge

func (m *Player) XXX_Merge(src proto.Message)

func (*Player) XXX_Size

func (m *Player) XXX_Size() int

func (*Player) XXX_Unmarshal

func (m *Player) XXX_Unmarshal(b []byte) error

type PlayerOrder

type PlayerOrder interface {
	LugoOrdersUnifier()
	// contains filtered or unexported methods
}

PlayerOrder is a hack to create a single type that includes all orders structs. The structs and interfaces generated from the protobuf files does not creates a common type that allows us to set a type of argument. So this interface make it possible

type PlayerProperties

type PlayerProperties struct {
	Side                 Team_Side `protobuf:"varint,1,opt,name=side,proto3,enum=proto.Team_Side" json:"side,omitempty"`
	Number               uint32    `protobuf:"varint,2,opt,name=number,proto3" json:"number,omitempty"`
	Position             *Point    `protobuf:"bytes,3,opt,name=Position,proto3" json:"Position,omitempty"`
	Velocity             *Velocity `protobuf:"bytes,4,opt,name=velocity,proto3" json:"velocity,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*PlayerProperties) Descriptor

func (*PlayerProperties) Descriptor() ([]byte, []int)

func (*PlayerProperties) GetNumber

func (m *PlayerProperties) GetNumber() uint32

func (*PlayerProperties) GetPosition

func (m *PlayerProperties) GetPosition() *Point

func (*PlayerProperties) GetSide

func (m *PlayerProperties) GetSide() Team_Side

func (*PlayerProperties) GetVelocity

func (m *PlayerProperties) GetVelocity() *Velocity

func (*PlayerProperties) ProtoMessage

func (*PlayerProperties) ProtoMessage()

func (*PlayerProperties) Reset

func (m *PlayerProperties) Reset()

func (*PlayerProperties) String

func (m *PlayerProperties) String() string

func (*PlayerProperties) XXX_DiscardUnknown

func (m *PlayerProperties) XXX_DiscardUnknown()

func (*PlayerProperties) XXX_Marshal

func (m *PlayerProperties) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PlayerProperties) XXX_Merge

func (m *PlayerProperties) XXX_Merge(src proto.Message)

func (*PlayerProperties) XXX_Size

func (m *PlayerProperties) XXX_Size() int

func (*PlayerProperties) XXX_Unmarshal

func (m *PlayerProperties) XXX_Unmarshal(b []byte) error

type Point

type Point struct {
	// Distance from the Y axis to right.
	X int32 `protobuf:"varint,1,opt,name=X,proto3" json:"X,omitempty"`
	// Distance from the X axis to up.
	Y                    int32    `protobuf:"varint,2,opt,name=Y,proto3" json:"Y,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Point represents one position on the cartesian plan of the game field. The coordinates start at the left bottom corner from the top view .

func FindIntersection

func FindIntersection(a1, a2, b1, b2 Point) (Point, bool, error)

FindIntersection finds the point where two lines intersect each other. One line is define by the points a1 and a2, and the second line is defined by b1 and b2. If the lines do not touch each other (e.g. they are parallel) it returns an error, otherwise the point will be returned. If the intersection point is between {a1, a2} and {b1,b2}, then the the second returned value will be true.

https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line

func (Point) Copy

func (m Point) Copy() *Point

func (*Point) Descriptor

func (*Point) Descriptor() ([]byte, []int)

func (Point) DistanceTo

func (m Point) DistanceTo(target Point) (distance float64)

DistanceTo finds the distance of this point to a target point

func (*Point) GetX

func (m *Point) GetX() int32

func (*Point) GetY

func (m *Point) GetY() int32

func (Point) MiddlePointTo

func (m Point) MiddlePointTo(target Point) Point

MiddlePointTo finds a point between this point and a target point

func (*Point) ProtoMessage

func (*Point) ProtoMessage()

func (*Point) Reset

func (m *Point) Reset()

func (*Point) String

func (m *Point) String() string

func (*Point) XXX_DiscardUnknown

func (m *Point) XXX_DiscardUnknown()

func (*Point) XXX_Marshal

func (m *Point) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Point) XXX_Merge

func (m *Point) XXX_Merge(src proto.Message)

func (*Point) XXX_Size

func (m *Point) XXX_Size() int

func (*Point) XXX_Unmarshal

func (m *Point) XXX_Unmarshal(b []byte) error

type RemoteClient

type RemoteClient interface {
	PauseOrResume(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*CommandResponse, error)
	NextTurn(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*CommandResponse, error)
	NextOrder(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*CommandResponse, error)
	SetBallProperties(ctx context.Context, in *BallProperties, opts ...grpc.CallOption) (*CommandResponse, error)
	SetPlayerProperties(ctx context.Context, in *PlayerProperties, opts ...grpc.CallOption) (*CommandResponse, error)
	SetGameProperties(ctx context.Context, in *GameProperties, opts ...grpc.CallOption) (*CommandResponse, error)
}

RemoteClient is the client API for Remote service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewRemoteClient

func NewRemoteClient(cc *grpc.ClientConn) RemoteClient

type RemoteServer

type RemoteServer interface {
	PauseOrResume(context.Context, *empty.Empty) (*CommandResponse, error)
	NextTurn(context.Context, *empty.Empty) (*CommandResponse, error)
	NextOrder(context.Context, *empty.Empty) (*CommandResponse, error)
	SetBallProperties(context.Context, *BallProperties) (*CommandResponse, error)
	SetPlayerProperties(context.Context, *PlayerProperties) (*CommandResponse, error)
	SetGameProperties(context.Context, *GameProperties) (*CommandResponse, error)
}

RemoteServer is the server API for Remote service.

type Team

type Team struct {
	// List of player in the team
	Players []*Player `protobuf:"bytes,1,rep,name=players,proto3" json:"players,omitempty"`
	// Team name
	Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
	// Team score in the present turn
	Score uint32 `protobuf:"varint,3,opt,name=Score,proto3" json:"Score,omitempty"`
	// Side which the team is playing on.
	Side                 Team_Side `protobuf:"varint,4,opt,name=side,proto3,enum=proto.Team_Side" json:"side,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

Stores all team elements and data.

func (*Team) Descriptor

func (*Team) Descriptor() ([]byte, []int)

func (*Team) GetName

func (m *Team) GetName() string

func (*Team) GetPlayers

func (m *Team) GetPlayers() []*Player

func (*Team) GetScore

func (m *Team) GetScore() uint32

func (*Team) GetSide

func (m *Team) GetSide() Team_Side

func (*Team) ProtoMessage

func (*Team) ProtoMessage()

func (*Team) Reset

func (m *Team) Reset()

func (*Team) String

func (m *Team) String() string

func (*Team) XXX_DiscardUnknown

func (m *Team) XXX_DiscardUnknown()

func (*Team) XXX_Marshal

func (m *Team) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Team) XXX_Merge

func (m *Team) XXX_Merge(src proto.Message)

func (*Team) XXX_Size

func (m *Team) XXX_Size() int

func (*Team) XXX_Unmarshal

func (m *Team) XXX_Unmarshal(b []byte) error

type Team_Side

type Team_Side int32
const (
	// Team playing on the left side of field
	Team_HOME Team_Side = 0
	// Team playing on the right side of the field
	Team_AWAY Team_Side = 1
)

func (Team_Side) EnumDescriptor

func (Team_Side) EnumDescriptor() ([]byte, []int)

func (Team_Side) String

func (x Team_Side) String() string

type Vector

type Vector struct {
	// Coordinate X to define the vector direction.
	X float64 `protobuf:"fixed64,1,opt,name=X,proto3" json:"X,omitempty"`
	// Coordinate Y to define the vector direction.
	Y                    float64  `protobuf:"fixed64,2,opt,name=Y,proto3" json:"Y,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Vector represent one direction on a cartesian plan

func East

func East() Vector

func NewVector

func NewVector(from Point, to Point) (*Vector, error)

func North

func North() Vector

func NorthEast

func NorthEast() Vector

func NorthWest

func NorthWest() Vector

func South

func South() Vector

func SouthEast

func SouthEast() Vector

func SouthWest

func SouthWest() Vector

func West

func West() Vector

func (*Vector) Add

func (m *Vector) Add(vector *Vector) (*Vector, error)

func (*Vector) AddAngleDegree

func (m *Vector) AddAngleDegree(degree float64) *Vector

func (*Vector) Angle

func (m *Vector) Angle() float64

Angle returns the angle of the vector with the X axis

func (*Vector) AngleDegrees

func (m *Vector) AngleDegrees() float64

func (*Vector) AngleWith

func (m *Vector) AngleWith(b *Vector) float64

func (Vector) Copy

func (m Vector) Copy() *Vector

func (*Vector) Cos

func (m *Vector) Cos() float64

func (*Vector) Descriptor

func (*Vector) Descriptor() ([]byte, []int)

func (*Vector) GetX

func (m *Vector) GetX() float64

func (*Vector) GetY

func (m *Vector) GetY() float64

func (*Vector) Invert

func (m *Vector) Invert() *Vector

func (*Vector) IsEqualTo

func (m *Vector) IsEqualTo(b *Vector) bool

func (*Vector) IsObstacle

func (m *Vector) IsObstacle(from Point, obstacle Point) bool

func (*Vector) Length

func (m *Vector) Length() float64

func (*Vector) MarshalJSON

func (m *Vector) MarshalJSON() ([]byte, error)

func (*Vector) Normalize

func (m *Vector) Normalize() *Vector

Normalizes the vector on base 100 (not 1 as conventional) to reduce the loss.

func (*Vector) OppositeAngle

func (m *Vector) OppositeAngle() float64

func (Vector) Perpendicular

func (m Vector) Perpendicular() *Vector

func (*Vector) ProtoMessage

func (*Vector) ProtoMessage()

func (*Vector) Reset

func (m *Vector) Reset()

func (*Vector) Scale

func (m *Vector) Scale(t float64) (*Vector, error)

func (*Vector) SetLength

func (m *Vector) SetLength(length float64) (*Vector, error)

func (*Vector) SetX

func (m *Vector) SetX(x float64) (*Vector, error)

func (*Vector) SetY

func (m *Vector) SetY(y float64) (*Vector, error)

func (*Vector) Sin

func (m *Vector) Sin() float64

func (*Vector) String

func (m *Vector) String() string

func (*Vector) Sub

func (m *Vector) Sub(vector *Vector) (*Vector, error)

func (*Vector) TargetFrom

func (m *Vector) TargetFrom(point Point) Point

func (*Vector) UnmarshalJSON

func (m *Vector) UnmarshalJSON(b []byte) error

func (*Vector) XXX_DiscardUnknown

func (m *Vector) XXX_DiscardUnknown()

func (*Vector) XXX_Marshal

func (m *Vector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Vector) XXX_Merge

func (m *Vector) XXX_Merge(src proto.Message)

func (*Vector) XXX_Size

func (m *Vector) XXX_Size() int

func (*Vector) XXX_Unmarshal

func (m *Vector) XXX_Unmarshal(b []byte) error

type Velocity

type Velocity struct {
	// Direction is a normalised vector that indicates the element direction
	Direction *Vector `protobuf:"bytes,1,opt,name=direction,proto3" json:"direction,omitempty"`
	// Speed of the element.
	Speed                float64  `protobuf:"fixed64,2,opt,name=speed,proto3" json:"speed,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Velocity is a tuple with the direction (a vector) an a speed (float) values. It defines the velocity of an object.

func NewZeroedVelocity

func NewZeroedVelocity(direction Vector) Velocity

NewZeroedVelocity creates a velocity with speed zero

func (*Velocity) Add

func (m *Velocity) Add(velocity Velocity)

Add two velocities values. The direction will be a simple vector sum, so they will be affected by their magnitude.

func (Velocity) Copy

func (m Velocity) Copy() *Velocity

Copy copies the object

func (*Velocity) Descriptor

func (*Velocity) Descriptor() ([]byte, []int)

func (*Velocity) GetDirection

func (m *Velocity) GetDirection() *Vector

func (*Velocity) GetNextPoint

func (m *Velocity) GetNextPoint(from Point) Point

Return the next point the element will be considering the direction and speed.

func (*Velocity) GetSpeed

func (m *Velocity) GetSpeed() float64

func (*Velocity) ProtoMessage

func (*Velocity) ProtoMessage()

func (*Velocity) Reset

func (m *Velocity) Reset()

func (*Velocity) String

func (m *Velocity) String() string

func (*Velocity) XXX_DiscardUnknown

func (m *Velocity) XXX_DiscardUnknown()

func (*Velocity) XXX_Marshal

func (m *Velocity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Velocity) XXX_Merge

func (m *Velocity) XXX_Merge(src proto.Message)

func (*Velocity) XXX_Size

func (m *Velocity) XXX_Size() int

func (*Velocity) XXX_Unmarshal

func (m *Velocity) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL