rps

package
Version: v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: BSD-3-Clause Imports: 9 Imported by: 9

Documentation

Overview

Package rps defines interfaces for playing the game Rock-Paper-Scissors. It is an example of a simple Vanadium service.

http://en.wikipedia.org/wiki/Rock-paper-scissors

There are three different roles in the game:

1. Judge: A judge enforces the rules of the game and decides who the winner is. At the end of the game, the judge reports the final score to all the score keepers.

2. Player: A player can ask a judge to start a new game, it can challenge another player, and it can play a game.

3. ScoreKeeper: A score keeper receives the final score for a game after it ended.

Index

Constants

View Source
const Classic = GameTypeTag(0) // Rock-Paper-Scissors
View Source
const Draw = WinnerTag(0)
View Source
const LizardSpock = GameTypeTag(1) // Rock-Paper-Scissors-Lizard-Spock
View Source
const Player1 = WinnerTag(1)
View Source
const Player2 = WinnerTag(2)

Variables

View Source
var JudgeDesc rpc.InterfaceDesc = descJudge

JudgeDesc describes the Judge interface.

View Source
var PlayerDesc rpc.InterfaceDesc = descPlayer

PlayerDesc describes the Player interface.

View Source
var RockPaperScissorsDesc rpc.InterfaceDesc = descRockPaperScissors

RockPaperScissorsDesc describes the RockPaperScissors interface.

View Source
var ScoreKeeperDesc rpc.InterfaceDesc = descScoreKeeper

ScoreKeeperDesc describes the ScoreKeeper interface.

Functions

func VDLReadJudgeAction

func VDLReadJudgeAction(dec vdl.Decoder, x *JudgeAction) error

func VDLReadPlayerAction

func VDLReadPlayerAction(dec vdl.Decoder, x *PlayerAction) error

Types

type GameId

type GameId struct {
	Id string
}

A GameId is used to uniquely identify a game within one Judge.

func (GameId) VDLIsZero

func (x GameId) VDLIsZero() bool

func (*GameId) VDLRead

func (x *GameId) VDLRead(dec vdl.Decoder) error

func (GameId) VDLReflect

func (GameId) VDLReflect(struct {
	Name string `vdl:"v.io/x/ref/examples/rps.GameId"`
})

func (GameId) VDLWrite

func (x GameId) VDLWrite(enc vdl.Encoder) error

type GameOptions

type GameOptions struct {
	NumRounds int32       // The number of rounds that a player must win to win the game.
	GameType  GameTypeTag // The type of game to play: Classic or LizardSpock.
}

GameOptions specifies the parameters of a game.

func (GameOptions) VDLIsZero

func (x GameOptions) VDLIsZero() bool

func (*GameOptions) VDLRead

func (x *GameOptions) VDLRead(dec vdl.Decoder) error

func (GameOptions) VDLReflect

func (GameOptions) VDLReflect(struct {
	Name string `vdl:"v.io/x/ref/examples/rps.GameOptions"`
})

func (GameOptions) VDLWrite

func (x GameOptions) VDLWrite(enc vdl.Encoder) error

type GameTypeTag

type GameTypeTag byte

func (GameTypeTag) VDLIsZero

func (x GameTypeTag) VDLIsZero() bool

func (*GameTypeTag) VDLRead

func (x *GameTypeTag) VDLRead(dec vdl.Decoder) error

func (GameTypeTag) VDLReflect

func (GameTypeTag) VDLReflect(struct {
	Name string `vdl:"v.io/x/ref/examples/rps.GameTypeTag"`
})

func (GameTypeTag) VDLWrite

func (x GameTypeTag) VDLWrite(enc vdl.Encoder) error

type JudgeAction

type JudgeAction interface {
	// Index returns the field index.
	Index() int
	// Interface returns the field value as an interface.
	Interface() interface{}
	// Name returns the field name.
	Name() string
	// VDLReflect describes the JudgeAction union type.
	VDLReflect(vdlJudgeActionReflect)
	VDLIsZero() bool
	VDLWrite(vdl.Encoder) error
}

JudgeAction represents any single field of the JudgeAction union type.

type JudgeActionMoveOptions

type JudgeActionMoveOptions struct{ Value []string } // A list of allowed moves that the player must choose from.

JudgeActionMoveOptions represents field MoveOptions of the JudgeAction union type.

func (JudgeActionMoveOptions) Index

func (x JudgeActionMoveOptions) Index() int

func (JudgeActionMoveOptions) Interface

func (x JudgeActionMoveOptions) Interface() interface{}

func (JudgeActionMoveOptions) Name

func (x JudgeActionMoveOptions) Name() string

func (JudgeActionMoveOptions) VDLIsZero

func (x JudgeActionMoveOptions) VDLIsZero() bool

func (JudgeActionMoveOptions) VDLReflect

func (x JudgeActionMoveOptions) VDLReflect(vdlJudgeActionReflect)

func (JudgeActionMoveOptions) VDLWrite

func (x JudgeActionMoveOptions) VDLWrite(enc vdl.Encoder) error

type JudgeActionOpponentName

type JudgeActionOpponentName struct{ Value string } // The name of the opponent.

JudgeActionOpponentName represents field OpponentName of the JudgeAction union type.

func (JudgeActionOpponentName) Index

func (x JudgeActionOpponentName) Index() int

func (JudgeActionOpponentName) Interface

func (x JudgeActionOpponentName) Interface() interface{}

func (JudgeActionOpponentName) Name

func (JudgeActionOpponentName) VDLIsZero

func (x JudgeActionOpponentName) VDLIsZero() bool

func (JudgeActionOpponentName) VDLReflect

func (x JudgeActionOpponentName) VDLReflect(vdlJudgeActionReflect)

func (JudgeActionOpponentName) VDLWrite

func (x JudgeActionOpponentName) VDLWrite(enc vdl.Encoder) error

type JudgeActionPlayerNum

type JudgeActionPlayerNum struct{ Value int32 } // The player's number.

JudgeActionPlayerNum represents field PlayerNum of the JudgeAction union type.

func (JudgeActionPlayerNum) Index

func (x JudgeActionPlayerNum) Index() int

func (JudgeActionPlayerNum) Interface

func (x JudgeActionPlayerNum) Interface() interface{}

func (JudgeActionPlayerNum) Name

func (x JudgeActionPlayerNum) Name() string

func (JudgeActionPlayerNum) VDLIsZero

func (x JudgeActionPlayerNum) VDLIsZero() bool

func (JudgeActionPlayerNum) VDLReflect

func (x JudgeActionPlayerNum) VDLReflect(vdlJudgeActionReflect)

func (JudgeActionPlayerNum) VDLWrite

func (x JudgeActionPlayerNum) VDLWrite(enc vdl.Encoder) error

type JudgeActionRoundResult

type JudgeActionRoundResult struct{ Value Round } // The result of the previous round.

JudgeActionRoundResult represents field RoundResult of the JudgeAction union type.

func (JudgeActionRoundResult) Index

func (x JudgeActionRoundResult) Index() int

func (JudgeActionRoundResult) Interface

func (x JudgeActionRoundResult) Interface() interface{}

func (JudgeActionRoundResult) Name

func (x JudgeActionRoundResult) Name() string

func (JudgeActionRoundResult) VDLIsZero

func (x JudgeActionRoundResult) VDLIsZero() bool

func (JudgeActionRoundResult) VDLReflect

func (x JudgeActionRoundResult) VDLReflect(vdlJudgeActionReflect)

func (JudgeActionRoundResult) VDLWrite

func (x JudgeActionRoundResult) VDLWrite(enc vdl.Encoder) error

type JudgeActionScore

type JudgeActionScore struct{ Value ScoreCard } // The result of the game.

JudgeActionScore represents field Score of the JudgeAction union type.

func (JudgeActionScore) Index

func (x JudgeActionScore) Index() int

func (JudgeActionScore) Interface

func (x JudgeActionScore) Interface() interface{}

func (JudgeActionScore) Name

func (x JudgeActionScore) Name() string

func (JudgeActionScore) VDLIsZero

func (x JudgeActionScore) VDLIsZero() bool

func (JudgeActionScore) VDLReflect

func (x JudgeActionScore) VDLReflect(vdlJudgeActionReflect)

func (JudgeActionScore) VDLWrite

func (x JudgeActionScore) VDLWrite(enc vdl.Encoder) error

type JudgeClientMethods

type JudgeClientMethods interface {
	// CreateGame creates a new game with the given game options and returns a game
	// identifier that can be used by the players to join the game.
	CreateGame(_ *context.T, Opts GameOptions, _ ...rpc.CallOpt) (GameId, error)
	// Play lets a player join an existing game and play.
	Play(_ *context.T, Id GameId, _ ...rpc.CallOpt) (JudgePlayClientCall, error)
}

JudgeClientMethods is the client interface containing Judge methods.

type JudgeClientStub

type JudgeClientStub interface {
	JudgeClientMethods
}

JudgeClientStub embeds JudgeClientMethods and is a placeholder for additional management operations.

func JudgeClient

func JudgeClient(name string) JudgeClientStub

JudgeClient returns a client stub for Judge.

type JudgePlayClientCall

type JudgePlayClientCall interface {
	JudgePlayClientStream
	// Finish performs the equivalent of SendStream().Close, then blocks until
	// the server is done, and returns the positional return values for the call.
	//
	// Finish returns immediately if the call has been canceled; depending on the
	// timing the output could either be an error signaling cancelation, or the
	// valid positional return values from the server.
	//
	// Calling Finish is mandatory for releasing stream resources, unless the call
	// has been canceled or any of the other methods return an error.  Finish should
	// be called at most once.
	Finish() (PlayResult, error)
}

JudgePlayClientCall represents the call returned from Judge.Play.

type JudgePlayClientStream

type JudgePlayClientStream interface {
	// RecvStream returns the receiver side of the Judge.Play client stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() JudgeAction
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
	// SendStream returns the send side of the Judge.Play client stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors
		// encountered while sending, or if Send is called after Close or
		// the stream has been canceled.  Blocks if there is no buffer
		// space; will unblock when buffer space is available or after
		// the stream has been canceled.
		Send(item PlayerAction) error
		// Close indicates to the server that no more items will be sent;
		// server Recv calls will receive io.EOF after all sent items.
		// This is an optional call - e.g. a client might call Close if it
		// needs to continue receiving items from the server after it's
		// done sending.  Returns errors encountered while closing, or if
		// Close is called after the stream has been canceled.  Like Send,
		// blocks if there is no buffer space available.
		Close() error
	}
}

JudgePlayClientStream is the client stream for Judge.Play.

type JudgePlayServerCall

type JudgePlayServerCall interface {
	rpc.ServerCall
	JudgePlayServerStream
}

JudgePlayServerCall represents the context passed to Judge.Play.

type JudgePlayServerCallStub

type JudgePlayServerCallStub struct {
	rpc.StreamServerCall
	// contains filtered or unexported fields
}

JudgePlayServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements JudgePlayServerCall.

func (*JudgePlayServerCallStub) Init

Init initializes JudgePlayServerCallStub from rpc.StreamServerCall.

func (*JudgePlayServerCallStub) RecvStream

func (s *JudgePlayServerCallStub) RecvStream() interface {
	Advance() bool
	Value() PlayerAction
	Err() error
}

RecvStream returns the receiver side of the Judge.Play server stream.

func (*JudgePlayServerCallStub) SendStream

func (s *JudgePlayServerCallStub) SendStream() interface {
	Send(item JudgeAction) error
}

SendStream returns the send side of the Judge.Play server stream.

type JudgePlayServerStream

type JudgePlayServerStream interface {
	// RecvStream returns the receiver side of the Judge.Play server stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() PlayerAction
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
	// SendStream returns the send side of the Judge.Play server stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors encountered
		// while sending.  Blocks if there is no buffer space; will unblock when
		// buffer space is available.
		Send(item JudgeAction) error
	}
}

JudgePlayServerStream is the server stream for Judge.Play.

type JudgeServerMethods

type JudgeServerMethods interface {
	// CreateGame creates a new game with the given game options and returns a game
	// identifier that can be used by the players to join the game.
	CreateGame(_ *context.T, _ rpc.ServerCall, Opts GameOptions) (GameId, error)
	// Play lets a player join an existing game and play.
	Play(_ *context.T, _ JudgePlayServerCall, Id GameId) (PlayResult, error)
}

JudgeServerMethods is the interface a server writer implements for Judge.

type JudgeServerStub

type JudgeServerStub interface {
	JudgeServerStubMethods
	// DescribeInterfaces the Judge interfaces.
	Describe__() []rpc.InterfaceDesc
}

JudgeServerStub adds universal methods to JudgeServerStubMethods.

func JudgeServer

func JudgeServer(impl JudgeServerMethods) JudgeServerStub

JudgeServer returns a server stub for Judge. It converts an implementation of JudgeServerMethods into an object that may be used by rpc.Server.

type JudgeServerStubMethods

type JudgeServerStubMethods interface {
	// CreateGame creates a new game with the given game options and returns a game
	// identifier that can be used by the players to join the game.
	CreateGame(_ *context.T, _ rpc.ServerCall, Opts GameOptions) (GameId, error)
	// Play lets a player join an existing game and play.
	Play(_ *context.T, _ *JudgePlayServerCallStub, Id GameId) (PlayResult, error)
}

JudgeServerStubMethods is the server interface containing Judge methods, as expected by rpc.Server. The only difference between this interface and JudgeServerMethods is the streaming methods.

type PlayResult

type PlayResult struct {
	YouWon bool // True if the player receiving the result won the game.
}

PlayResult is the value returned by the Play method. It indicates the outcome of the game.

func (PlayResult) VDLIsZero

func (x PlayResult) VDLIsZero() bool

func (*PlayResult) VDLRead

func (x *PlayResult) VDLRead(dec vdl.Decoder) error

func (PlayResult) VDLReflect

func (PlayResult) VDLReflect(struct {
	Name string `vdl:"v.io/x/ref/examples/rps.PlayResult"`
})

func (PlayResult) VDLWrite

func (x PlayResult) VDLWrite(enc vdl.Encoder) error

type PlayerAction

type PlayerAction interface {
	// Index returns the field index.
	Index() int
	// Interface returns the field value as an interface.
	Interface() interface{}
	// Name returns the field name.
	Name() string
	// VDLReflect describes the PlayerAction union type.
	VDLReflect(vdlPlayerActionReflect)
	VDLIsZero() bool
	VDLWrite(vdl.Encoder) error
}

PlayerAction represents any single field of the PlayerAction union type.

type PlayerActionMove

type PlayerActionMove struct{ Value string } // The move that the player wants to make.

PlayerActionMove represents field Move of the PlayerAction union type.

func (PlayerActionMove) Index

func (x PlayerActionMove) Index() int

func (PlayerActionMove) Interface

func (x PlayerActionMove) Interface() interface{}

func (PlayerActionMove) Name

func (x PlayerActionMove) Name() string

func (PlayerActionMove) VDLIsZero

func (x PlayerActionMove) VDLIsZero() bool

func (PlayerActionMove) VDLReflect

func (x PlayerActionMove) VDLReflect(vdlPlayerActionReflect)

func (PlayerActionMove) VDLWrite

func (x PlayerActionMove) VDLWrite(enc vdl.Encoder) error

type PlayerActionQuit

type PlayerActionQuit struct{ Value Unused } // Indicates that the player is quitting the game.

PlayerActionQuit represents field Quit of the PlayerAction union type.

func (PlayerActionQuit) Index

func (x PlayerActionQuit) Index() int

func (PlayerActionQuit) Interface

func (x PlayerActionQuit) Interface() interface{}

func (PlayerActionQuit) Name

func (x PlayerActionQuit) Name() string

func (PlayerActionQuit) VDLIsZero

func (x PlayerActionQuit) VDLIsZero() bool

func (PlayerActionQuit) VDLReflect

func (x PlayerActionQuit) VDLReflect(vdlPlayerActionReflect)

func (PlayerActionQuit) VDLWrite

func (x PlayerActionQuit) VDLWrite(enc vdl.Encoder) error

type PlayerClientMethods

type PlayerClientMethods interface {
	// Challenge is used by other players to challenge this player to a game. If
	// the challenge is accepted, the method returns nil.
	Challenge(_ *context.T, Address string, Id GameId, Opts GameOptions, _ ...rpc.CallOpt) error
}

PlayerClientMethods is the client interface containing Player methods.

Player can receive challenges from other players.

type PlayerClientStub

type PlayerClientStub interface {
	PlayerClientMethods
}

PlayerClientStub embeds PlayerClientMethods and is a placeholder for additional management operations.

func PlayerClient

func PlayerClient(name string) PlayerClientStub

PlayerClient returns a client stub for Player.

type PlayerServerMethods

type PlayerServerMethods interface {
	// Challenge is used by other players to challenge this player to a game. If
	// the challenge is accepted, the method returns nil.
	Challenge(_ *context.T, _ rpc.ServerCall, Address string, Id GameId, Opts GameOptions) error
}

PlayerServerMethods is the interface a server writer implements for Player.

Player can receive challenges from other players.

type PlayerServerStub

type PlayerServerStub interface {
	PlayerServerStubMethods
	// DescribeInterfaces the Player interfaces.
	Describe__() []rpc.InterfaceDesc
}

PlayerServerStub adds universal methods to PlayerServerStubMethods.

func PlayerServer

func PlayerServer(impl PlayerServerMethods) PlayerServerStub

PlayerServer returns a server stub for Player. It converts an implementation of PlayerServerMethods into an object that may be used by rpc.Server.

type PlayerServerStubMethods

type PlayerServerStubMethods PlayerServerMethods

PlayerServerStubMethods is the server interface containing Player methods, as expected by rpc.Server. There is no difference between this interface and PlayerServerMethods since there are no streaming methods.

type PlayersMoves

type PlayersMoves [2]string

func (PlayersMoves) VDLIsZero

func (x PlayersMoves) VDLIsZero() bool

func (*PlayersMoves) VDLRead

func (x *PlayersMoves) VDLRead(dec vdl.Decoder) error

func (PlayersMoves) VDLReflect

func (PlayersMoves) VDLReflect(struct {
	Name string `vdl:"v.io/x/ref/examples/rps.PlayersMoves"`
})

func (PlayersMoves) VDLWrite

func (x PlayersMoves) VDLWrite(enc vdl.Encoder) error

type RockPaperScissorsClientMethods

type RockPaperScissorsClientMethods interface {
	JudgeClientMethods
	// Player can receive challenges from other players.
	PlayerClientMethods
	// ScoreKeeper receives the outcome of games from Judges.
	ScoreKeeperClientMethods
}

RockPaperScissorsClientMethods is the client interface containing RockPaperScissors methods.

type RockPaperScissorsClientStub

type RockPaperScissorsClientStub interface {
	RockPaperScissorsClientMethods
}

RockPaperScissorsClientStub embeds RockPaperScissorsClientMethods and is a placeholder for additional management operations.

func RockPaperScissorsClient

func RockPaperScissorsClient(name string) RockPaperScissorsClientStub

RockPaperScissorsClient returns a client stub for RockPaperScissors.

type RockPaperScissorsServerMethods

type RockPaperScissorsServerMethods interface {
	JudgeServerMethods
	// Player can receive challenges from other players.
	PlayerServerMethods
	// ScoreKeeper receives the outcome of games from Judges.
	ScoreKeeperServerMethods
}

RockPaperScissorsServerMethods is the interface a server writer implements for RockPaperScissors.

type RockPaperScissorsServerStub

type RockPaperScissorsServerStub interface {
	RockPaperScissorsServerStubMethods
	// DescribeInterfaces the RockPaperScissors interfaces.
	Describe__() []rpc.InterfaceDesc
}

RockPaperScissorsServerStub adds universal methods to RockPaperScissorsServerStubMethods.

func RockPaperScissorsServer

func RockPaperScissorsServer(impl RockPaperScissorsServerMethods) RockPaperScissorsServerStub

RockPaperScissorsServer returns a server stub for RockPaperScissors. It converts an implementation of RockPaperScissorsServerMethods into an object that may be used by rpc.Server.

type RockPaperScissorsServerStubMethods

type RockPaperScissorsServerStubMethods interface {
	JudgeServerStubMethods
	// Player can receive challenges from other players.
	PlayerServerStubMethods
	// ScoreKeeper receives the outcome of games from Judges.
	ScoreKeeperServerStubMethods
}

RockPaperScissorsServerStubMethods is the server interface containing RockPaperScissors methods, as expected by rpc.Server. The only difference between this interface and RockPaperScissorsServerMethods is the streaming methods.

type Round

type Round struct {
	Moves     PlayersMoves // Each player's move.
	Comment   string       // A text comment from judge about the round.
	Winner    WinnerTag    // Who won the round.
	StartTime time.Time    // The time at which the round started.
	EndTime   time.Time    // The time at which the round ended.
}

Round represents the state of a round.

func (Round) VDLIsZero

func (x Round) VDLIsZero() bool

func (*Round) VDLRead

func (x *Round) VDLRead(dec vdl.Decoder) error

func (Round) VDLReflect

func (Round) VDLReflect(struct {
	Name string `vdl:"v.io/x/ref/examples/rps.Round"`
})

func (Round) VDLWrite

func (x Round) VDLWrite(enc vdl.Encoder) error

type ScoreCard

type ScoreCard struct {
	Opts      GameOptions // The game options.
	Judge     string      // The name of the judge.
	Players   []string    // The name of the players.
	Rounds    []Round     // The outcome of each round.
	StartTime time.Time   // The time at which the game started.
	EndTime   time.Time   // The time at which the game ended.
	Winner    WinnerTag   // Who won the game.
}

func (ScoreCard) VDLIsZero

func (x ScoreCard) VDLIsZero() bool

func (*ScoreCard) VDLRead

func (x *ScoreCard) VDLRead(dec vdl.Decoder) error

func (ScoreCard) VDLReflect

func (ScoreCard) VDLReflect(struct {
	Name string `vdl:"v.io/x/ref/examples/rps.ScoreCard"`
})

func (ScoreCard) VDLWrite

func (x ScoreCard) VDLWrite(enc vdl.Encoder) error

type ScoreKeeperClientMethods

type ScoreKeeperClientMethods interface {
	Record(_ *context.T, Score ScoreCard, _ ...rpc.CallOpt) error
}

ScoreKeeperClientMethods is the client interface containing ScoreKeeper methods.

ScoreKeeper receives the outcome of games from Judges.

type ScoreKeeperClientStub

type ScoreKeeperClientStub interface {
	ScoreKeeperClientMethods
}

ScoreKeeperClientStub embeds ScoreKeeperClientMethods and is a placeholder for additional management operations.

func ScoreKeeperClient

func ScoreKeeperClient(name string) ScoreKeeperClientStub

ScoreKeeperClient returns a client stub for ScoreKeeper.

type ScoreKeeperServerMethods

type ScoreKeeperServerMethods interface {
	Record(_ *context.T, _ rpc.ServerCall, Score ScoreCard) error
}

ScoreKeeperServerMethods is the interface a server writer implements for ScoreKeeper.

ScoreKeeper receives the outcome of games from Judges.

type ScoreKeeperServerStub

type ScoreKeeperServerStub interface {
	ScoreKeeperServerStubMethods
	// DescribeInterfaces the ScoreKeeper interfaces.
	Describe__() []rpc.InterfaceDesc
}

ScoreKeeperServerStub adds universal methods to ScoreKeeperServerStubMethods.

func ScoreKeeperServer

func ScoreKeeperServer(impl ScoreKeeperServerMethods) ScoreKeeperServerStub

ScoreKeeperServer returns a server stub for ScoreKeeper. It converts an implementation of ScoreKeeperServerMethods into an object that may be used by rpc.Server.

type ScoreKeeperServerStubMethods

type ScoreKeeperServerStubMethods ScoreKeeperServerMethods

ScoreKeeperServerStubMethods is the server interface containing ScoreKeeper methods, as expected by rpc.Server. There is no difference between this interface and ScoreKeeperServerMethods since there are no streaming methods.

type Unused

type Unused struct {
}

TODO(toddw): Replace Unused with the unnamed empty struct{}.

func (Unused) VDLIsZero

func (x Unused) VDLIsZero() bool

func (*Unused) VDLRead

func (x *Unused) VDLRead(dec vdl.Decoder) error

func (Unused) VDLReflect

func (Unused) VDLReflect(struct {
	Name string `vdl:"v.io/x/ref/examples/rps.Unused"`
})

func (Unused) VDLWrite

func (x Unused) VDLWrite(enc vdl.Encoder) error

type WinnerTag

type WinnerTag byte

WinnerTag is a type used to indicate whether a round or a game was a draw, was won by player 1 or was won by player 2.

func (WinnerTag) VDLIsZero

func (x WinnerTag) VDLIsZero() bool

func (*WinnerTag) VDLRead

func (x *WinnerTag) VDLRead(dec vdl.Decoder) error

func (WinnerTag) VDLReflect

func (WinnerTag) VDLReflect(struct {
	Name string `vdl:"v.io/x/ref/examples/rps.WinnerTag"`
})

func (WinnerTag) VDLWrite

func (x WinnerTag) VDLWrite(enc vdl.Encoder) error

Source Files

Directories

Path Synopsis
Command rpsbot repeatedly runs automated games, implementing all three roles.
Command rpsbot repeatedly runs automated games, implementing all three roles.
Command rpsplayer implements the Player interface, which enables a human to play the game.
Command rpsplayer implements the Player interface, which enables a human to play the game.
Command rpsscorekeeper implements the ScoreKeeper interface.
Command rpsscorekeeper implements the ScoreKeeper interface.
Package internal defines common functions used by both rock paper scissors clients and servers.
Package internal defines common functions used by both rock paper scissors clients and servers.

Jump to

Keyboard shortcuts

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