Documentation ¶
Overview ¶
Package rummy is a generated protocol buffer package.
It is generated from these files:
game.proto service.proto
It has these top-level messages:
Meld PlayerState GameState GameEvent CreateGameRequest CreateGameResponse JoinGameRequest JoinGameResponse StartGameRequest StartGameResponse GetGameStateRequest GetHandCardsRequest GetHandCardsResponse SubscribeGameRequest PickUpStockRequest PickUpStockResponse PickUpDiscardRequest PickUpDiscardResponse PlayCardsRequest PlayCardsResponse DiscardCardRequest DiscardCardResponse CallRummyRequest CallRummyResponse
Package rummy is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterRummyServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterRummyServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterRummyServiceServer(s *grpc.Server, srv RummyServiceServer)
- type CallRummyRequest
- func (*CallRummyRequest) Descriptor() ([]byte, []int)
- func (m *CallRummyRequest) GetCards() []*deck.Card
- func (m *CallRummyRequest) GetGameName() string
- func (m *CallRummyRequest) GetPlayerId() int32
- func (m *CallRummyRequest) GetPlayerSecret() string
- func (*CallRummyRequest) ProtoMessage()
- func (m *CallRummyRequest) Reset()
- func (m *CallRummyRequest) String() string
- type CallRummyResponse
- type CreateGameRequest
- type CreateGameResponse
- type DiscardCardRequest
- func (*DiscardCardRequest) Descriptor() ([]byte, []int)
- func (m *DiscardCardRequest) GetCard() *deck.Card
- func (m *DiscardCardRequest) GetGameName() string
- func (m *DiscardCardRequest) GetPlayerId() int32
- func (m *DiscardCardRequest) GetPlayerSecret() string
- func (*DiscardCardRequest) ProtoMessage()
- func (m *DiscardCardRequest) Reset()
- func (m *DiscardCardRequest) String() string
- type DiscardCardResponse
- type Game
- func (g *Game) AddPlayer(name string) (int32, error)
- func (g *Game) CallRummy(playerId int32, cards []deck.Card) error
- func (g *Game) Deal() error
- func (g *Game) DiscardCard(playerId int32, card deck.Card) error
- func (g *Game) GameState() *GameState
- func (g *Game) PickUpDiscard(playerId int32, nCards int) ([]deck.Card, error)
- func (g *Game) PickUpStock(playerId int32) (deck.Card, error)
- func (g *Game) PlayCards(playerId int32, cards []deck.Card) (int, error)
- func (g *Game) PlayerHand(playerId int32) ([]deck.Card, error)
- func (g *Game) Subscribe(events chan *GameEvent)
- type GameEvent
- func (*GameEvent) Descriptor() ([]byte, []int)
- func (m *GameEvent) GetCards() []*deck.Card
- func (m *GameEvent) GetPlayerId() int32
- func (m *GameEvent) GetScore() int32
- func (m *GameEvent) GetType() GameEvent_Type
- func (*GameEvent) ProtoMessage()
- func (m *GameEvent) Reset()
- func (m *GameEvent) String() string
- type GameEvent_Type
- type GameState
- func (*GameState) Descriptor() ([]byte, []int)
- func (m *GameState) GetAggregatedMelds() []*Meld
- func (m *GameState) GetCurrentPlayerTurn() int32
- func (m *GameState) GetDiscardPile() []*deck.Card
- func (m *GameState) GetGameOver() bool
- func (m *GameState) GetNumCardsInStock() int32
- func (m *GameState) GetPlayers() []*PlayerState
- func (m *GameState) GetTurn() int32
- func (m *GameState) GetTurnState() GameState_TurnState
- func (*GameState) ProtoMessage()
- func (m *GameState) Reset()
- func (m *GameState) String() string
- type GameState_TurnState
- type GetGameStateRequest
- type GetHandCardsRequest
- func (*GetHandCardsRequest) Descriptor() ([]byte, []int)
- func (m *GetHandCardsRequest) GetGameName() string
- func (m *GetHandCardsRequest) GetPlayerId() int32
- func (m *GetHandCardsRequest) GetPlayerSecret() string
- func (*GetHandCardsRequest) ProtoMessage()
- func (m *GetHandCardsRequest) Reset()
- func (m *GetHandCardsRequest) String() string
- type GetHandCardsResponse
- type Hand
- type JoinGameRequest
- func (*JoinGameRequest) Descriptor() ([]byte, []int)
- func (m *JoinGameRequest) GetGameName() string
- func (m *JoinGameRequest) GetPlayerName() string
- func (m *JoinGameRequest) GetPlayerSecret() string
- func (m *JoinGameRequest) GetStrategy() string
- func (*JoinGameRequest) ProtoMessage()
- func (m *JoinGameRequest) Reset()
- func (m *JoinGameRequest) String() string
- type JoinGameResponse
- type Meld
- type PickUpDiscardRequest
- func (*PickUpDiscardRequest) Descriptor() ([]byte, []int)
- func (m *PickUpDiscardRequest) GetGameName() string
- func (m *PickUpDiscardRequest) GetNCards() int32
- func (m *PickUpDiscardRequest) GetPlayerId() int32
- func (m *PickUpDiscardRequest) GetPlayerSecret() string
- func (*PickUpDiscardRequest) ProtoMessage()
- func (m *PickUpDiscardRequest) Reset()
- func (m *PickUpDiscardRequest) String() string
- type PickUpDiscardResponse
- type PickUpStockRequest
- func (*PickUpStockRequest) Descriptor() ([]byte, []int)
- func (m *PickUpStockRequest) GetGameName() string
- func (m *PickUpStockRequest) GetPlayerId() int32
- func (m *PickUpStockRequest) GetPlayerSecret() string
- func (*PickUpStockRequest) ProtoMessage()
- func (m *PickUpStockRequest) Reset()
- func (m *PickUpStockRequest) String() string
- type PickUpStockResponse
- type PlayCardsRequest
- func (*PlayCardsRequest) Descriptor() ([]byte, []int)
- func (m *PlayCardsRequest) GetCards() []*deck.Card
- func (m *PlayCardsRequest) GetGameName() string
- func (m *PlayCardsRequest) GetPlayerId() int32
- func (m *PlayCardsRequest) GetPlayerSecret() string
- func (*PlayCardsRequest) ProtoMessage()
- func (m *PlayCardsRequest) Reset()
- func (m *PlayCardsRequest) String() string
- type PlayCardsResponse
- type PlayerState
- func (*PlayerState) Descriptor() ([]byte, []int)
- func (m *PlayerState) GetCurrentScore() int32
- func (m *PlayerState) GetId() int32
- func (m *PlayerState) GetMelds() []*Meld
- func (m *PlayerState) GetName() string
- func (m *PlayerState) GetNumCardsInHand() int32
- func (m *PlayerState) GetRummies() []*deck.Card
- func (*PlayerState) ProtoMessage()
- func (m *PlayerState) Reset()
- func (m *PlayerState) String() string
- type RummyServiceClient
- type RummyServiceServer
- type RummyService_SubscribeGameClient
- type RummyService_SubscribeGameServer
- type StartGameRequest
- type StartGameResponse
- type SubscribeGameRequest
Constants ¶
This section is empty.
Variables ¶
var GameEvent_Type_name = map[int32]string{
0: "UNKNOWN_TYPE",
1: "TURN_START",
2: "PICK_UP_STOCK",
3: "PICK_UP_DISCARD",
4: "PLAY_CARDS",
5: "DISCARD",
6: "GAME_OVER",
}
var GameEvent_Type_value = map[string]int32{
"UNKNOWN_TYPE": 0,
"TURN_START": 1,
"PICK_UP_STOCK": 2,
"PICK_UP_DISCARD": 3,
"PLAY_CARDS": 4,
"DISCARD": 5,
"GAME_OVER": 6,
}
var GameState_TurnState_name = map[int32]string{
0: "TURN_START",
1: "PICKED_UP_CARDS",
2: "PLAYED_CARDS",
}
var GameState_TurnState_value = map[string]int32{
"TURN_START": 0,
"PICKED_UP_CARDS": 1,
"PLAYED_CARDS": 2,
}
Functions ¶
func RegisterRummyServiceHandler ¶
func RegisterRummyServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterRummyServiceHandler registers the http handlers for service RummyService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterRummyServiceHandlerFromEndpoint ¶
func RegisterRummyServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterRummyServiceHandlerFromEndpoint is same as RegisterRummyServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterRummyServiceServer ¶
func RegisterRummyServiceServer(s *grpc.Server, srv RummyServiceServer)
Types ¶
type CallRummyRequest ¶
type CallRummyRequest struct { GameName string `protobuf:"bytes,1,opt,name=game_name,json=gameName" json:"game_name,omitempty"` PlayerId int32 `protobuf:"varint,2,opt,name=player_id,json=playerId" json:"player_id,omitempty"` PlayerSecret string `protobuf:"bytes,3,opt,name=player_secret,json=playerSecret" json:"player_secret,omitempty"` Cards []*deck.Card `protobuf:"bytes,4,rep,name=cards" json:"cards,omitempty"` }
Call a rummy observed in the discard pile. This request may be performed at any time when a player observes that a possible rummy has been created either as the result of a discard or newly played cards.
func (*CallRummyRequest) Descriptor ¶
func (*CallRummyRequest) Descriptor() ([]byte, []int)
func (*CallRummyRequest) GetCards ¶
func (m *CallRummyRequest) GetCards() []*deck.Card
func (*CallRummyRequest) GetGameName ¶
func (m *CallRummyRequest) GetGameName() string
func (*CallRummyRequest) GetPlayerId ¶
func (m *CallRummyRequest) GetPlayerId() int32
func (*CallRummyRequest) GetPlayerSecret ¶
func (m *CallRummyRequest) GetPlayerSecret() string
func (*CallRummyRequest) ProtoMessage ¶
func (*CallRummyRequest) ProtoMessage()
func (*CallRummyRequest) Reset ¶
func (m *CallRummyRequest) Reset()
func (*CallRummyRequest) String ¶
func (m *CallRummyRequest) String() string
type CallRummyResponse ¶
type CallRummyResponse struct { }
func (*CallRummyResponse) Descriptor ¶
func (*CallRummyResponse) Descriptor() ([]byte, []int)
func (*CallRummyResponse) ProtoMessage ¶
func (*CallRummyResponse) ProtoMessage()
func (*CallRummyResponse) Reset ¶
func (m *CallRummyResponse) Reset()
func (*CallRummyResponse) String ¶
func (m *CallRummyResponse) String() string
type CreateGameRequest ¶
type CreateGameRequest struct {
GameName string `protobuf:"bytes,1,opt,name=game_name,json=gameName" json:"game_name,omitempty"`
}
Create a new game with the given name. Each game must have a unique name; if the name has been used before, an error will be returned. Games must be created before they can be joined.
func (*CreateGameRequest) Descriptor ¶
func (*CreateGameRequest) Descriptor() ([]byte, []int)
func (*CreateGameRequest) GetGameName ¶
func (m *CreateGameRequest) GetGameName() string
func (*CreateGameRequest) ProtoMessage ¶
func (*CreateGameRequest) ProtoMessage()
func (*CreateGameRequest) Reset ¶
func (m *CreateGameRequest) Reset()
func (*CreateGameRequest) String ¶
func (m *CreateGameRequest) String() string
type CreateGameResponse ¶
type CreateGameResponse struct { }
func (*CreateGameResponse) Descriptor ¶
func (*CreateGameResponse) Descriptor() ([]byte, []int)
func (*CreateGameResponse) ProtoMessage ¶
func (*CreateGameResponse) ProtoMessage()
func (*CreateGameResponse) Reset ¶
func (m *CreateGameResponse) Reset()
func (*CreateGameResponse) String ¶
func (m *CreateGameResponse) String() string
type DiscardCardRequest ¶
type DiscardCardRequest struct { GameName string `protobuf:"bytes,1,opt,name=game_name,json=gameName" json:"game_name,omitempty"` PlayerId int32 `protobuf:"varint,2,opt,name=player_id,json=playerId" json:"player_id,omitempty"` PlayerSecret string `protobuf:"bytes,3,opt,name=player_secret,json=playerSecret" json:"player_secret,omitempty"` Card *deck.Card `protobuf:"bytes,4,opt,name=card" json:"card,omitempty"` }
Discard a card from hand into the discard pile. Players may play this card after picking up cards and (optionally) playing cards for points. Discarding a card ends the player's turn.
func (*DiscardCardRequest) Descriptor ¶
func (*DiscardCardRequest) Descriptor() ([]byte, []int)
func (*DiscardCardRequest) GetCard ¶
func (m *DiscardCardRequest) GetCard() *deck.Card
func (*DiscardCardRequest) GetGameName ¶
func (m *DiscardCardRequest) GetGameName() string
func (*DiscardCardRequest) GetPlayerId ¶
func (m *DiscardCardRequest) GetPlayerId() int32
func (*DiscardCardRequest) GetPlayerSecret ¶
func (m *DiscardCardRequest) GetPlayerSecret() string
func (*DiscardCardRequest) ProtoMessage ¶
func (*DiscardCardRequest) ProtoMessage()
func (*DiscardCardRequest) Reset ¶
func (m *DiscardCardRequest) Reset()
func (*DiscardCardRequest) String ¶
func (m *DiscardCardRequest) String() string
type DiscardCardResponse ¶
type DiscardCardResponse struct { }
func (*DiscardCardResponse) Descriptor ¶
func (*DiscardCardResponse) Descriptor() ([]byte, []int)
func (*DiscardCardResponse) ProtoMessage ¶
func (*DiscardCardResponse) ProtoMessage()
func (*DiscardCardResponse) Reset ¶
func (m *DiscardCardResponse) Reset()
func (*DiscardCardResponse) String ¶
func (m *DiscardCardResponse) String() string
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
Game manages the state machine for a single game of Rummy.
func NewGame ¶
func NewGame() *Game
NewGame initializes a new Game with a shuffled Deck of cards. There are initially no players. Players may join the game by calling AddPlayer, until the game is started by calling Deal.
func (*Game) AddPlayer ¶
AddPlayer adds a player with the given name to the game. AddPlayer can be called until Deal is called to add more players. Each player must have a unique name.
func (*Game) Deal ¶
Deal starts the game, deals a hand to each player, and randomly selects the player to go first.
func (*Game) PickUpDiscard ¶
type GameEvent ¶
type GameEvent struct { PlayerId int32 `protobuf:"varint,1,opt,name=player_id,json=playerId" json:"player_id,omitempty"` Type GameEvent_Type `protobuf:"varint,2,opt,name=type,enum=rummy.GameEvent_Type" json:"type,omitempty"` Cards []*deck.Card `protobuf:"bytes,3,rep,name=cards" json:"cards,omitempty"` Score int32 `protobuf:"varint,4,opt,name=score" json:"score,omitempty"` }
func (*GameEvent) Descriptor ¶
func (*GameEvent) GetPlayerId ¶
func (*GameEvent) GetType ¶
func (m *GameEvent) GetType() GameEvent_Type
func (*GameEvent) ProtoMessage ¶
func (*GameEvent) ProtoMessage()
type GameEvent_Type ¶
type GameEvent_Type int32
const ( GameEvent_UNKNOWN_TYPE GameEvent_Type = 0 GameEvent_TURN_START GameEvent_Type = 1 GameEvent_PICK_UP_STOCK GameEvent_Type = 2 GameEvent_PICK_UP_DISCARD GameEvent_Type = 3 GameEvent_PLAY_CARDS GameEvent_Type = 4 GameEvent_DISCARD GameEvent_Type = 5 GameEvent_GAME_OVER GameEvent_Type = 6 )
func (GameEvent_Type) EnumDescriptor ¶
func (GameEvent_Type) EnumDescriptor() ([]byte, []int)
func (GameEvent_Type) String ¶
func (x GameEvent_Type) String() string
type GameState ¶
type GameState struct { NumCardsInStock int32 `protobuf:"varint,1,opt,name=num_cards_in_stock,json=numCardsInStock" json:"num_cards_in_stock,omitempty"` DiscardPile []*deck.Card `protobuf:"bytes,2,rep,name=discard_pile,json=discardPile" json:"discard_pile,omitempty"` AggregatedMelds []*Meld `protobuf:"bytes,3,rep,name=aggregated_melds,json=aggregatedMelds" json:"aggregated_melds,omitempty"` Players []*PlayerState `protobuf:"bytes,4,rep,name=players" json:"players,omitempty"` Turn int32 `protobuf:"varint,6,opt,name=turn" json:"turn,omitempty"` CurrentPlayerTurn int32 `protobuf:"varint,7,opt,name=current_player_turn,json=currentPlayerTurn" json:"current_player_turn,omitempty"` TurnState GameState_TurnState `protobuf:"varint,8,opt,name=turn_state,json=turnState,enum=rummy.GameState_TurnState" json:"turn_state,omitempty"` GameOver bool `protobuf:"varint,9,opt,name=game_over,json=gameOver" json:"game_over,omitempty"` }
func (*GameState) Descriptor ¶
func (*GameState) GetAggregatedMelds ¶
func (*GameState) GetCurrentPlayerTurn ¶
func (*GameState) GetDiscardPile ¶
func (*GameState) GetGameOver ¶
func (*GameState) GetNumCardsInStock ¶
func (*GameState) GetPlayers ¶
func (m *GameState) GetPlayers() []*PlayerState
func (*GameState) GetTurnState ¶
func (m *GameState) GetTurnState() GameState_TurnState
func (*GameState) ProtoMessage ¶
func (*GameState) ProtoMessage()
type GameState_TurnState ¶
type GameState_TurnState int32
const ( GameState_TURN_START GameState_TurnState = 0 GameState_PICKED_UP_CARDS GameState_TurnState = 1 GameState_PLAYED_CARDS GameState_TurnState = 2 )
func (GameState_TurnState) EnumDescriptor ¶
func (GameState_TurnState) EnumDescriptor() ([]byte, []int)
func (GameState_TurnState) String ¶
func (x GameState_TurnState) String() string
type GetGameStateRequest ¶
type GetGameStateRequest struct {
GameName string `protobuf:"bytes,1,opt,name=game_name,json=gameName" json:"game_name,omitempty"`
}
Get the publicly-observable game state.
func (*GetGameStateRequest) Descriptor ¶
func (*GetGameStateRequest) Descriptor() ([]byte, []int)
func (*GetGameStateRequest) GetGameName ¶
func (m *GetGameStateRequest) GetGameName() string
func (*GetGameStateRequest) ProtoMessage ¶
func (*GetGameStateRequest) ProtoMessage()
func (*GetGameStateRequest) Reset ¶
func (m *GetGameStateRequest) Reset()
func (*GetGameStateRequest) String ¶
func (m *GetGameStateRequest) String() string
type GetHandCardsRequest ¶
type GetHandCardsRequest struct { GameName string `protobuf:"bytes,1,opt,name=game_name,json=gameName" json:"game_name,omitempty"` PlayerId int32 `protobuf:"varint,2,opt,name=player_id,json=playerId" json:"player_id,omitempty"` PlayerSecret string `protobuf:"bytes,3,opt,name=player_secret,json=playerSecret" json:"player_secret,omitempty"` }
Get the cards currently in a player's hand.
func (*GetHandCardsRequest) Descriptor ¶
func (*GetHandCardsRequest) Descriptor() ([]byte, []int)
func (*GetHandCardsRequest) GetGameName ¶
func (m *GetHandCardsRequest) GetGameName() string
func (*GetHandCardsRequest) GetPlayerId ¶
func (m *GetHandCardsRequest) GetPlayerId() int32
func (*GetHandCardsRequest) GetPlayerSecret ¶
func (m *GetHandCardsRequest) GetPlayerSecret() string
func (*GetHandCardsRequest) ProtoMessage ¶
func (*GetHandCardsRequest) ProtoMessage()
func (*GetHandCardsRequest) Reset ¶
func (m *GetHandCardsRequest) Reset()
func (*GetHandCardsRequest) String ¶
func (m *GetHandCardsRequest) String() string
type GetHandCardsResponse ¶
type GetHandCardsResponse struct {
Cards []*deck.Card `protobuf:"bytes,1,rep,name=cards" json:"cards,omitempty"`
}
func (*GetHandCardsResponse) Descriptor ¶
func (*GetHandCardsResponse) Descriptor() ([]byte, []int)
func (*GetHandCardsResponse) GetCards ¶
func (m *GetHandCardsResponse) GetCards() []*deck.Card
func (*GetHandCardsResponse) ProtoMessage ¶
func (*GetHandCardsResponse) ProtoMessage()
func (*GetHandCardsResponse) Reset ¶
func (m *GetHandCardsResponse) Reset()
func (*GetHandCardsResponse) String ¶
func (m *GetHandCardsResponse) String() string
type Hand ¶
func (Hand) Melds ¶
Melds returns all possible sets and runs in this Hand. The resulting melds may include overlapping sets of cards.
func (Hand) Runs ¶
Runs returns all possible runs in this Hand. The result may include overlapping sets of Cards if there is a run of > 3 cards.
type JoinGameRequest ¶
type JoinGameRequest struct { GameName string `protobuf:"bytes,1,opt,name=game_name,json=gameName" json:"game_name,omitempty"` // The name of the player. Must be unique within a game. PlayerName string `protobuf:"bytes,2,opt,name=player_name,json=playerName" json:"player_name,omitempty"` // An optional secret used to identify this player. // If provided, then all game play requests for this player // must include this secret. PlayerSecret string `protobuf:"bytes,3,opt,name=player_secret,json=playerSecret" json:"player_secret,omitempty"` // Optional, if provided then initialize a computer player // with this strategy. Strategy string `protobuf:"bytes,4,opt,name=strategy" json:"strategy,omitempty"` }
Join a game (that must already have been created) as the player with the given name. Only one player with each name is allowed in a game. If a player with this name has already joined the game, the previous player id will be returned. If a strategy is provided, then this is a computer player; otherwise it is a human player that must initiate gameplay actions when it is their turn.
func (*JoinGameRequest) Descriptor ¶
func (*JoinGameRequest) Descriptor() ([]byte, []int)
func (*JoinGameRequest) GetGameName ¶
func (m *JoinGameRequest) GetGameName() string
func (*JoinGameRequest) GetPlayerName ¶
func (m *JoinGameRequest) GetPlayerName() string
func (*JoinGameRequest) GetPlayerSecret ¶
func (m *JoinGameRequest) GetPlayerSecret() string
func (*JoinGameRequest) GetStrategy ¶
func (m *JoinGameRequest) GetStrategy() string
func (*JoinGameRequest) ProtoMessage ¶
func (*JoinGameRequest) ProtoMessage()
func (*JoinGameRequest) Reset ¶
func (m *JoinGameRequest) Reset()
func (*JoinGameRequest) String ¶
func (m *JoinGameRequest) String() string
type JoinGameResponse ¶
type JoinGameResponse struct { // The player id within this game. Must be included in all requests. PlayerId int32 `protobuf:"varint,1,opt,name=player_id,json=playerId" json:"player_id,omitempty"` }
func (*JoinGameResponse) Descriptor ¶
func (*JoinGameResponse) Descriptor() ([]byte, []int)
func (*JoinGameResponse) GetPlayerId ¶
func (m *JoinGameResponse) GetPlayerId() int32
func (*JoinGameResponse) ProtoMessage ¶
func (*JoinGameResponse) ProtoMessage()
func (*JoinGameResponse) Reset ¶
func (m *JoinGameResponse) Reset()
func (*JoinGameResponse) String ¶
func (m *JoinGameResponse) String() string
type PickUpDiscardRequest ¶
type PickUpDiscardRequest struct { GameName string `protobuf:"bytes,1,opt,name=game_name,json=gameName" json:"game_name,omitempty"` PlayerId int32 `protobuf:"varint,2,opt,name=player_id,json=playerId" json:"player_id,omitempty"` PlayerSecret string `protobuf:"bytes,3,opt,name=player_secret,json=playerSecret" json:"player_secret,omitempty"` NCards int32 `protobuf:"varint,4,opt,name=n_cards,json=nCards" json:"n_cards,omitempty"` }
Pick up N cards from the discard pile. A player may initiate this request when beginning their turn. Alternatively, a player may pick up a card from the stock. The N cards picked up are from the top of the discard stack. The bottom-most card must be played this turn.
func (*PickUpDiscardRequest) Descriptor ¶
func (*PickUpDiscardRequest) Descriptor() ([]byte, []int)
func (*PickUpDiscardRequest) GetGameName ¶
func (m *PickUpDiscardRequest) GetGameName() string
func (*PickUpDiscardRequest) GetNCards ¶
func (m *PickUpDiscardRequest) GetNCards() int32
func (*PickUpDiscardRequest) GetPlayerId ¶
func (m *PickUpDiscardRequest) GetPlayerId() int32
func (*PickUpDiscardRequest) GetPlayerSecret ¶
func (m *PickUpDiscardRequest) GetPlayerSecret() string
func (*PickUpDiscardRequest) ProtoMessage ¶
func (*PickUpDiscardRequest) ProtoMessage()
func (*PickUpDiscardRequest) Reset ¶
func (m *PickUpDiscardRequest) Reset()
func (*PickUpDiscardRequest) String ¶
func (m *PickUpDiscardRequest) String() string
type PickUpDiscardResponse ¶
type PickUpDiscardResponse struct {
Cards []*deck.Card `protobuf:"bytes,1,rep,name=cards" json:"cards,omitempty"`
}
Returns the cards picked up from the discard pile.
func (*PickUpDiscardResponse) Descriptor ¶
func (*PickUpDiscardResponse) Descriptor() ([]byte, []int)
func (*PickUpDiscardResponse) GetCards ¶
func (m *PickUpDiscardResponse) GetCards() []*deck.Card
func (*PickUpDiscardResponse) ProtoMessage ¶
func (*PickUpDiscardResponse) ProtoMessage()
func (*PickUpDiscardResponse) Reset ¶
func (m *PickUpDiscardResponse) Reset()
func (*PickUpDiscardResponse) String ¶
func (m *PickUpDiscardResponse) String() string
type PickUpStockRequest ¶
type PickUpStockRequest struct { GameName string `protobuf:"bytes,1,opt,name=game_name,json=gameName" json:"game_name,omitempty"` PlayerId int32 `protobuf:"varint,2,opt,name=player_id,json=playerId" json:"player_id,omitempty"` PlayerSecret string `protobuf:"bytes,3,opt,name=player_secret,json=playerSecret" json:"player_secret,omitempty"` }
Pick up a card from the stock. A player should initiate this request when beginning their turn. Alternatively, a player may issue a PickUpDiscardRequest.
func (*PickUpStockRequest) Descriptor ¶
func (*PickUpStockRequest) Descriptor() ([]byte, []int)
func (*PickUpStockRequest) GetGameName ¶
func (m *PickUpStockRequest) GetGameName() string
func (*PickUpStockRequest) GetPlayerId ¶
func (m *PickUpStockRequest) GetPlayerId() int32
func (*PickUpStockRequest) GetPlayerSecret ¶
func (m *PickUpStockRequest) GetPlayerSecret() string
func (*PickUpStockRequest) ProtoMessage ¶
func (*PickUpStockRequest) ProtoMessage()
func (*PickUpStockRequest) Reset ¶
func (m *PickUpStockRequest) Reset()
func (*PickUpStockRequest) String ¶
func (m *PickUpStockRequest) String() string
type PickUpStockResponse ¶
type PickUpStockResponse struct {
Card *deck.Card `protobuf:"bytes,1,opt,name=card" json:"card,omitempty"`
}
Returns the card that was picked up from the stock.
func (*PickUpStockResponse) Descriptor ¶
func (*PickUpStockResponse) Descriptor() ([]byte, []int)
func (*PickUpStockResponse) GetCard ¶
func (m *PickUpStockResponse) GetCard() *deck.Card
func (*PickUpStockResponse) ProtoMessage ¶
func (*PickUpStockResponse) ProtoMessage()
func (*PickUpStockResponse) Reset ¶
func (m *PickUpStockResponse) Reset()
func (*PickUpStockResponse) String ¶
func (m *PickUpStockResponse) String() string
type PlayCardsRequest ¶
type PlayCardsRequest struct { GameName string `protobuf:"bytes,1,opt,name=game_name,json=gameName" json:"game_name,omitempty"` PlayerId int32 `protobuf:"varint,2,opt,name=player_id,json=playerId" json:"player_id,omitempty"` PlayerSecret string `protobuf:"bytes,3,opt,name=player_secret,json=playerSecret" json:"player_secret,omitempty"` Cards []*deck.Card `protobuf:"bytes,4,rep,name=cards" json:"cards,omitempty"` }
Play cards for points. The cards must either form a new Meld, or rummy off of a meld that has previously been played (by any player). Players may issue this request only when it is their turn and they have picked up cards (either from the stock or the discard pile). This request may be issued multiple times in a single turn.
func (*PlayCardsRequest) Descriptor ¶
func (*PlayCardsRequest) Descriptor() ([]byte, []int)
func (*PlayCardsRequest) GetCards ¶
func (m *PlayCardsRequest) GetCards() []*deck.Card
func (*PlayCardsRequest) GetGameName ¶
func (m *PlayCardsRequest) GetGameName() string
func (*PlayCardsRequest) GetPlayerId ¶
func (m *PlayCardsRequest) GetPlayerId() int32
func (*PlayCardsRequest) GetPlayerSecret ¶
func (m *PlayCardsRequest) GetPlayerSecret() string
func (*PlayCardsRequest) ProtoMessage ¶
func (*PlayCardsRequest) ProtoMessage()
func (*PlayCardsRequest) Reset ¶
func (m *PlayCardsRequest) Reset()
func (*PlayCardsRequest) String ¶
func (m *PlayCardsRequest) String() string
type PlayCardsResponse ¶
type PlayCardsResponse struct {
Score int32 `protobuf:"varint,1,opt,name=score" json:"score,omitempty"`
}
func (*PlayCardsResponse) Descriptor ¶
func (*PlayCardsResponse) Descriptor() ([]byte, []int)
func (*PlayCardsResponse) GetScore ¶
func (m *PlayCardsResponse) GetScore() int32
func (*PlayCardsResponse) ProtoMessage ¶
func (*PlayCardsResponse) ProtoMessage()
func (*PlayCardsResponse) Reset ¶
func (m *PlayCardsResponse) Reset()
func (*PlayCardsResponse) String ¶
func (m *PlayCardsResponse) String() string
type PlayerState ¶
type PlayerState struct { Id int32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` Melds []*Meld `protobuf:"bytes,3,rep,name=melds" json:"melds,omitempty"` Rummies []*deck.Card `protobuf:"bytes,4,rep,name=rummies" json:"rummies,omitempty"` NumCardsInHand int32 `protobuf:"varint,5,opt,name=num_cards_in_hand,json=numCardsInHand" json:"num_cards_in_hand,omitempty"` CurrentScore int32 `protobuf:"varint,6,opt,name=current_score,json=currentScore" json:"current_score,omitempty"` }
func (*PlayerState) Descriptor ¶
func (*PlayerState) Descriptor() ([]byte, []int)
func (*PlayerState) GetCurrentScore ¶
func (m *PlayerState) GetCurrentScore() int32
func (*PlayerState) GetId ¶
func (m *PlayerState) GetId() int32
func (*PlayerState) GetMelds ¶
func (m *PlayerState) GetMelds() []*Meld
func (*PlayerState) GetName ¶
func (m *PlayerState) GetName() string
func (*PlayerState) GetNumCardsInHand ¶
func (m *PlayerState) GetNumCardsInHand() int32
func (*PlayerState) GetRummies ¶
func (m *PlayerState) GetRummies() []*deck.Card
func (*PlayerState) ProtoMessage ¶
func (*PlayerState) ProtoMessage()
func (*PlayerState) Reset ¶
func (m *PlayerState) Reset()
func (*PlayerState) String ¶
func (m *PlayerState) String() string
type RummyServiceClient ¶
type RummyServiceClient interface { CreateGame(ctx context.Context, in *CreateGameRequest, opts ...grpc.CallOption) (*CreateGameResponse, error) JoinGame(ctx context.Context, in *JoinGameRequest, opts ...grpc.CallOption) (*JoinGameResponse, error) StartGame(ctx context.Context, in *StartGameRequest, opts ...grpc.CallOption) (*StartGameResponse, error) SubscribeGame(ctx context.Context, in *SubscribeGameRequest, opts ...grpc.CallOption) (RummyService_SubscribeGameClient, error) GetGameState(ctx context.Context, in *GetGameStateRequest, opts ...grpc.CallOption) (*GameState, error) GetHandCards(ctx context.Context, in *GetHandCardsRequest, opts ...grpc.CallOption) (*GetHandCardsResponse, error) PickUpStock(ctx context.Context, in *PickUpStockRequest, opts ...grpc.CallOption) (*PickUpStockResponse, error) PickUpDiscard(ctx context.Context, in *PickUpDiscardRequest, opts ...grpc.CallOption) (*PickUpDiscardResponse, error) PlayCards(ctx context.Context, in *PlayCardsRequest, opts ...grpc.CallOption) (*PlayCardsResponse, error) DiscardCard(ctx context.Context, in *DiscardCardRequest, opts ...grpc.CallOption) (*DiscardCardResponse, error) CallRummy(ctx context.Context, in *CallRummyRequest, opts ...grpc.CallOption) (*CallRummyResponse, error) }
func NewRummyServiceClient ¶
func NewRummyServiceClient(cc *grpc.ClientConn) RummyServiceClient
type RummyServiceServer ¶
type RummyServiceServer interface { CreateGame(context.Context, *CreateGameRequest) (*CreateGameResponse, error) JoinGame(context.Context, *JoinGameRequest) (*JoinGameResponse, error) StartGame(context.Context, *StartGameRequest) (*StartGameResponse, error) SubscribeGame(*SubscribeGameRequest, RummyService_SubscribeGameServer) error GetGameState(context.Context, *GetGameStateRequest) (*GameState, error) GetHandCards(context.Context, *GetHandCardsRequest) (*GetHandCardsResponse, error) PickUpStock(context.Context, *PickUpStockRequest) (*PickUpStockResponse, error) PickUpDiscard(context.Context, *PickUpDiscardRequest) (*PickUpDiscardResponse, error) PlayCards(context.Context, *PlayCardsRequest) (*PlayCardsResponse, error) DiscardCard(context.Context, *DiscardCardRequest) (*DiscardCardResponse, error) CallRummy(context.Context, *CallRummyRequest) (*CallRummyResponse, error) }
type RummyService_SubscribeGameClient ¶
type RummyService_SubscribeGameClient interface { Recv() (*GameEvent, error) grpc.ClientStream }
type RummyService_SubscribeGameServer ¶
type RummyService_SubscribeGameServer interface { Send(*GameEvent) error grpc.ServerStream }
type StartGameRequest ¶
type StartGameRequest struct {
GameName string `protobuf:"bytes,1,opt,name=game_name,json=gameName" json:"game_name,omitempty"`
}
Start the given name, dealing cards to each of the joined players. Once a game has been started, no additional players may join. TODO(palpant): Only let game creator start the game.
func (*StartGameRequest) Descriptor ¶
func (*StartGameRequest) Descriptor() ([]byte, []int)
func (*StartGameRequest) GetGameName ¶
func (m *StartGameRequest) GetGameName() string
func (*StartGameRequest) ProtoMessage ¶
func (*StartGameRequest) ProtoMessage()
func (*StartGameRequest) Reset ¶
func (m *StartGameRequest) Reset()
func (*StartGameRequest) String ¶
func (m *StartGameRequest) String() string
type StartGameResponse ¶
type StartGameResponse struct { }
func (*StartGameResponse) Descriptor ¶
func (*StartGameResponse) Descriptor() ([]byte, []int)
func (*StartGameResponse) ProtoMessage ¶
func (*StartGameResponse) ProtoMessage()
func (*StartGameResponse) Reset ¶
func (m *StartGameResponse) Reset()
func (*StartGameResponse) String ¶
func (m *StartGameResponse) String() string
type SubscribeGameRequest ¶
type SubscribeGameRequest struct {
GameName string `protobuf:"bytes,1,opt,name=game_name,json=gameName" json:"game_name,omitempty"`
}
Subscribe to game events. This allows players to observe the gameplay of other players.
func (*SubscribeGameRequest) Descriptor ¶
func (*SubscribeGameRequest) Descriptor() ([]byte, []int)
func (*SubscribeGameRequest) GetGameName ¶
func (m *SubscribeGameRequest) GetGameName() string
func (*SubscribeGameRequest) ProtoMessage ¶
func (*SubscribeGameRequest) ProtoMessage()
func (*SubscribeGameRequest) Reset ¶
func (m *SubscribeGameRequest) Reset()
func (*SubscribeGameRequest) String ¶
func (m *SubscribeGameRequest) String() string