v.io: v.io/x/ref/examples/rps Index | Files | Directories

package rps

import "v.io/x/ref/examples/rps"

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. nolint:golint

Index

Package Files

rps.vdl.go

Constants

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

Variables

var JudgeDesc rpc.InterfaceDesc = descJudge

JudgeDesc describes the Judge interface.

var PlayerDesc rpc.InterfaceDesc = descPlayer

PlayerDesc describes the Player interface.

var RockPaperScissorsDesc rpc.InterfaceDesc = descRockPaperScissors

RockPaperScissorsDesc describes the RockPaperScissors interface.

var ScoreKeeperDesc rpc.InterfaceDesc = descScoreKeeper

ScoreKeeperDesc describes the ScoreKeeper interface.

func VDLReadJudgeAction Uses

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

func VDLReadPlayerAction Uses

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

type GameId Uses

type GameId struct {
    Id string
}

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

func (GameId) VDLIsZero Uses

func (x GameId) VDLIsZero() bool

func (*GameId) VDLRead Uses

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

func (GameId) VDLReflect Uses

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

func (GameId) VDLWrite Uses

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

type GameOptions Uses

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 Uses

func (x GameOptions) VDLIsZero() bool

func (*GameOptions) VDLRead Uses

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

func (GameOptions) VDLReflect Uses

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

func (GameOptions) VDLWrite Uses

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

type GameTypeTag Uses

type GameTypeTag byte

func (GameTypeTag) VDLIsZero Uses

func (x GameTypeTag) VDLIsZero() bool

func (*GameTypeTag) VDLRead Uses

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

func (GameTypeTag) VDLReflect Uses

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

func (GameTypeTag) VDLWrite Uses

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

type JudgeAction Uses

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 Uses

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 Uses

func (x JudgeActionMoveOptions) Index() int

func (JudgeActionMoveOptions) Interface Uses

func (x JudgeActionMoveOptions) Interface() interface{}

func (JudgeActionMoveOptions) Name Uses

func (x JudgeActionMoveOptions) Name() string

func (JudgeActionMoveOptions) VDLIsZero Uses

func (x JudgeActionMoveOptions) VDLIsZero() bool

func (JudgeActionMoveOptions) VDLReflect Uses

func (x JudgeActionMoveOptions) VDLReflect(vdlJudgeActionReflect)

func (JudgeActionMoveOptions) VDLWrite Uses

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

type JudgeActionOpponentName Uses

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

JudgeActionOpponentName represents field OpponentName of the JudgeAction union type.

func (JudgeActionOpponentName) Index Uses

func (x JudgeActionOpponentName) Index() int

func (JudgeActionOpponentName) Interface Uses

func (x JudgeActionOpponentName) Interface() interface{}

func (JudgeActionOpponentName) Name Uses

func (x JudgeActionOpponentName) Name() string

func (JudgeActionOpponentName) VDLIsZero Uses

func (x JudgeActionOpponentName) VDLIsZero() bool

func (JudgeActionOpponentName) VDLReflect Uses

func (x JudgeActionOpponentName) VDLReflect(vdlJudgeActionReflect)

func (JudgeActionOpponentName) VDLWrite Uses

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

type JudgeActionPlayerNum Uses

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

JudgeActionPlayerNum represents field PlayerNum of the JudgeAction union type.

func (JudgeActionPlayerNum) Index Uses

func (x JudgeActionPlayerNum) Index() int

func (JudgeActionPlayerNum) Interface Uses

func (x JudgeActionPlayerNum) Interface() interface{}

func (JudgeActionPlayerNum) Name Uses

func (x JudgeActionPlayerNum) Name() string

func (JudgeActionPlayerNum) VDLIsZero Uses

func (x JudgeActionPlayerNum) VDLIsZero() bool

func (JudgeActionPlayerNum) VDLReflect Uses

func (x JudgeActionPlayerNum) VDLReflect(vdlJudgeActionReflect)

func (JudgeActionPlayerNum) VDLWrite Uses

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

type JudgeActionRoundResult Uses

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

JudgeActionRoundResult represents field RoundResult of the JudgeAction union type.

func (JudgeActionRoundResult) Index Uses

func (x JudgeActionRoundResult) Index() int

func (JudgeActionRoundResult) Interface Uses

func (x JudgeActionRoundResult) Interface() interface{}

func (JudgeActionRoundResult) Name Uses

func (x JudgeActionRoundResult) Name() string

func (JudgeActionRoundResult) VDLIsZero Uses

func (x JudgeActionRoundResult) VDLIsZero() bool

func (JudgeActionRoundResult) VDLReflect Uses

func (x JudgeActionRoundResult) VDLReflect(vdlJudgeActionReflect)

func (JudgeActionRoundResult) VDLWrite Uses

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

type JudgeActionScore Uses

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

JudgeActionScore represents field Score of the JudgeAction union type.

func (JudgeActionScore) Index Uses

func (x JudgeActionScore) Index() int

func (JudgeActionScore) Interface Uses

func (x JudgeActionScore) Interface() interface{}

func (JudgeActionScore) Name Uses

func (x JudgeActionScore) Name() string

func (JudgeActionScore) VDLIsZero Uses

func (x JudgeActionScore) VDLIsZero() bool

func (JudgeActionScore) VDLReflect Uses

func (x JudgeActionScore) VDLReflect(vdlJudgeActionReflect)

func (JudgeActionScore) VDLWrite Uses

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

type JudgeClientMethods Uses

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 Uses

type JudgeClientStub interface {
    JudgeClientMethods
}

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

func JudgeClient Uses

func JudgeClient(name string) JudgeClientStub

JudgeClient returns a client stub for Judge.

type JudgePlayClientCall Uses

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 Uses

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 Uses

type JudgePlayServerCall interface {
    rpc.ServerCall
    JudgePlayServerStream
}

JudgePlayServerCall represents the context passed to Judge.Play.

type JudgePlayServerCallStub Uses

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 Uses

func (s *JudgePlayServerCallStub) Init(call rpc.StreamServerCall)

Init initializes JudgePlayServerCallStub from rpc.StreamServerCall.

func (*JudgePlayServerCallStub) RecvStream Uses

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 Uses

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

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

type JudgePlayServerStream Uses

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 Uses

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 Uses

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

JudgeServerStub adds universal methods to JudgeServerStubMethods.

func JudgeServer Uses

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 Uses

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 Uses

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 Uses

func (x PlayResult) VDLIsZero() bool

func (*PlayResult) VDLRead Uses

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

func (PlayResult) VDLReflect Uses

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

func (PlayResult) VDLWrite Uses

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

type PlayerAction Uses

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 Uses

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 Uses

func (x PlayerActionMove) Index() int

func (PlayerActionMove) Interface Uses

func (x PlayerActionMove) Interface() interface{}

func (PlayerActionMove) Name Uses

func (x PlayerActionMove) Name() string

func (PlayerActionMove) VDLIsZero Uses

func (x PlayerActionMove) VDLIsZero() bool

func (PlayerActionMove) VDLReflect Uses

func (x PlayerActionMove) VDLReflect(vdlPlayerActionReflect)

func (PlayerActionMove) VDLWrite Uses

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

type PlayerActionQuit Uses

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 Uses

func (x PlayerActionQuit) Index() int

func (PlayerActionQuit) Interface Uses

func (x PlayerActionQuit) Interface() interface{}

func (PlayerActionQuit) Name Uses

func (x PlayerActionQuit) Name() string

func (PlayerActionQuit) VDLIsZero Uses

func (x PlayerActionQuit) VDLIsZero() bool

func (PlayerActionQuit) VDLReflect Uses

func (x PlayerActionQuit) VDLReflect(vdlPlayerActionReflect)

func (PlayerActionQuit) VDLWrite Uses

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

type PlayerClientMethods Uses

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 Uses

type PlayerClientStub interface {
    PlayerClientMethods
}

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

func PlayerClient Uses

func PlayerClient(name string) PlayerClientStub

PlayerClient returns a client stub for Player.

type PlayerServerMethods Uses

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 Uses

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

PlayerServerStub adds universal methods to PlayerServerStubMethods.

func PlayerServer Uses

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 Uses

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 Uses

type PlayersMoves [2]string

func (PlayersMoves) VDLIsZero Uses

func (x PlayersMoves) VDLIsZero() bool

func (*PlayersMoves) VDLRead Uses

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

func (PlayersMoves) VDLReflect Uses

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

func (PlayersMoves) VDLWrite Uses

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

type RockPaperScissorsClientMethods Uses

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 Uses

type RockPaperScissorsClientStub interface {
    RockPaperScissorsClientMethods
}

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

func RockPaperScissorsClient Uses

func RockPaperScissorsClient(name string) RockPaperScissorsClientStub

RockPaperScissorsClient returns a client stub for RockPaperScissors.

type RockPaperScissorsServerMethods Uses

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 Uses

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

RockPaperScissorsServerStub adds universal methods to RockPaperScissorsServerStubMethods.

func RockPaperScissorsServer Uses

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 Uses

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 Uses

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 Uses

func (x Round) VDLIsZero() bool

func (*Round) VDLRead Uses

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

func (Round) VDLReflect Uses

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

func (Round) VDLWrite Uses

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

type ScoreCard Uses

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 Uses

func (x ScoreCard) VDLIsZero() bool

func (*ScoreCard) VDLRead Uses

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

func (ScoreCard) VDLReflect Uses

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

func (ScoreCard) VDLWrite Uses

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

type ScoreKeeperClientMethods Uses

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 Uses

type ScoreKeeperClientStub interface {
    ScoreKeeperClientMethods
}

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

func ScoreKeeperClient Uses

func ScoreKeeperClient(name string) ScoreKeeperClientStub

ScoreKeeperClient returns a client stub for ScoreKeeper.

type ScoreKeeperServerMethods Uses

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 Uses

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

ScoreKeeperServerStub adds universal methods to ScoreKeeperServerStubMethods.

func ScoreKeeperServer Uses

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 Uses

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 Uses

type Unused struct {
}

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

func (Unused) VDLIsZero Uses

func (x Unused) VDLIsZero() bool

func (*Unused) VDLRead Uses

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

func (Unused) VDLReflect Uses

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

func (Unused) VDLWrite Uses

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

type WinnerTag Uses

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 Uses

func (x WinnerTag) VDLIsZero() bool

func (*WinnerTag) VDLRead Uses

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

func (WinnerTag) VDLReflect Uses

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

func (WinnerTag) VDLWrite Uses

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

Directories

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

Package rps imports 9 packages (graph) and is imported by 12 packages. Updated 2020-10-24. Refresh now. Tools for package owners.