game

package
v0.0.0-...-7f16e2a Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PlayerType_name = map[int32]string{
		0: "PLAYER_TYPE_UNSPECIFIED",
		1: "CLIENT",
		2: "ROBOT_TSUMOGIRI",
		3: "ROBOT_EFFECTIVE",
	}
	PlayerType_value = map[string]int32{
		"PLAYER_TYPE_UNSPECIFIED": 0,
		"CLIENT":                  1,
		"ROBOT_TSUMOGIRI":         2,
		"ROBOT_EFFECTIVE":         3,
	}
)

Enum value maps for PlayerType.

View Source
var File_private_game_game_service_proto protoreflect.FileDescriptor

Functions

func RegisterGameServiceServer

func RegisterGameServiceServer(s *grpc.Server, srv GameServiceServer)

Types

type CreateRequest

type CreateRequest struct {

	// Types that are assignable to OneofRules:
	//
	//	*CreateRequest_Rules
	//	*CreateRequest_RuleId
	OneofRules isCreateRequest_OneofRules `protobuf_oneof:"oneof_rules"`
	Timeouts   *rules.Timeouts            `protobuf:"bytes,3,opt,name=timeouts,proto3" json:"timeouts,omitempty"`
	// Should provide at least one Client player
	// Provide players in order, correspondig their EAST1 starting positions
	Players []*Player `protobuf:"bytes,4,rep,name=players,proto3" json:"players,omitempty"`
	// For debugging purposes and robots.
	// If provided - game will end after one round.
	// The conditions could be predefined.
	// If wall defined - will replace the wall with given values.
	// The number of tiles in wall could be reduced to at least 5 tiles.
	// Still all tiles should remain unique.
	// The exact number of tiles for indicators is 5.
	// The exact number of tiles for rinshan is 4.
	SingleRound *log.RoundInfo `protobuf:"bytes,5,opt,name=single_round,json=singleRound,proto3" json:"single_round,omitempty"`
	// Redefine random seed for predictable game
	Seed *wrappers.Int64Value `protobuf:"bytes,6,opt,name=seed,proto3" json:"seed,omitempty"`
	// Just output the result, with no actual game created (validation)
	DryRun bool `protobuf:"varint,7,opt,name=dry_run,json=dryRun,proto3" json:"dry_run,omitempty"`
	// contains filtered or unexported fields
}

The method of creating games is a subject to change.

func (*CreateRequest) Descriptor deprecated

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetDryRun

func (x *CreateRequest) GetDryRun() bool

func (*CreateRequest) GetOneofRules

func (m *CreateRequest) GetOneofRules() isCreateRequest_OneofRules

func (*CreateRequest) GetPlayers

func (x *CreateRequest) GetPlayers() []*Player

func (*CreateRequest) GetRuleId

func (x *CreateRequest) GetRuleId() string

func (*CreateRequest) GetRules

func (x *CreateRequest) GetRules() *rules.Ruleset

func (*CreateRequest) GetSeed

func (x *CreateRequest) GetSeed() *wrappers.Int64Value

func (*CreateRequest) GetSingleRound

func (x *CreateRequest) GetSingleRound() *log.RoundInfo

func (*CreateRequest) GetTimeouts

func (x *CreateRequest) GetTimeouts() *rules.Timeouts

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

func (x *CreateRequest) ProtoReflect() protoreflect.Message

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type CreateRequest_RuleId

type CreateRequest_RuleId struct {
	RuleId string `protobuf:"bytes,2,opt,name=rule_id,json=ruleId,proto3,oneof"`
}

type CreateRequest_Rules

type CreateRequest_Rules struct {
	Rules *rules.Ruleset `protobuf:"bytes,1,opt,name=rules,proto3,oneof"`
}

type CreateResponse

type CreateResponse struct {

	// ID of created game. Later used to get log ID.
	// Could be any string, generated by server. Client should not rely on id format.
	GameId string         `protobuf:"bytes,1,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"`
	Rules  *rules.Ruleset `protobuf:"bytes,2,opt,name=rules,proto3" json:"rules,omitempty"`
	// Client players will be given tokens to join the game
	Players []*Player `protobuf:"bytes,3,rep,name=players,proto3" json:"players,omitempty"`
	// Please play the game in a given time
	Ttl *duration.Duration `protobuf:"bytes,4,opt,name=ttl,proto3" json:"ttl,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateResponse) Descriptor deprecated

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

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetGameId

func (x *CreateResponse) GetGameId() string

func (*CreateResponse) GetPlayers

func (x *CreateResponse) GetPlayers() []*Player

func (*CreateResponse) GetRules

func (x *CreateResponse) GetRules() *rules.Ruleset

func (*CreateResponse) GetTtl

func (x *CreateResponse) GetTtl() *duration.Duration

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

func (x *CreateResponse) ProtoReflect() protoreflect.Message

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

type GameServiceClient

type GameServiceClient interface {
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
}

GameServiceClient is the client API for GameService service.

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

type GameServiceServer

type GameServiceServer interface {
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
}

GameServiceServer is the server API for GameService service.

type Player

type Player struct {

	// Name displayed
	Caption string `protobuf:"bytes,1,opt,name=caption,proto3" json:"caption,omitempty"`
	// Should not fill in request. Will be filled in reply
	// Could be any string, generated by server. Client should not rely on id format.
	Token      string     `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	PlayerType PlayerType `` /* 129-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Player) Descriptor deprecated

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

Deprecated: Use Player.ProtoReflect.Descriptor instead.

func (*Player) GetCaption

func (x *Player) GetCaption() string

func (*Player) GetPlayerType

func (x *Player) GetPlayerType() PlayerType

func (*Player) GetToken

func (x *Player) GetToken() string

func (*Player) ProtoMessage

func (*Player) ProtoMessage()

func (*Player) ProtoReflect

func (x *Player) ProtoReflect() protoreflect.Message

func (*Player) Reset

func (x *Player) Reset()

func (*Player) String

func (x *Player) String() string

type PlayerType

type PlayerType int32
const (
	PlayerType_PLAYER_TYPE_UNSPECIFIED PlayerType = 0
	// Expects that player will connect with Play method
	PlayerType_CLIENT PlayerType = 1
	// Predefined robots
	// Drops taken tiles
	PlayerType_ROBOT_TSUMOGIRI PlayerType = 2
	// Robot will try to play according to uke-ire
	PlayerType_ROBOT_EFFECTIVE PlayerType = 3
)

func (PlayerType) Descriptor

func (PlayerType) Descriptor() protoreflect.EnumDescriptor

func (PlayerType) Enum

func (x PlayerType) Enum() *PlayerType

func (PlayerType) EnumDescriptor deprecated

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

Deprecated: Use PlayerType.Descriptor instead.

func (PlayerType) Number

func (x PlayerType) Number() protoreflect.EnumNumber

func (PlayerType) String

func (x PlayerType) String() string

func (PlayerType) Type

type UnimplementedGameServiceServer

type UnimplementedGameServiceServer struct {
}

UnimplementedGameServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedGameServiceServer) Create

Jump to

Keyboard shortcuts

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