types

package
v0.0.0-...-73fa0b7 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Choice

type Choice byte
const (
	Undefined Choice = iota
	Rock
	Paper
	Scissors
	Lizard
	Spock
)

func IntToChoice

func IntToChoice(i int) Choice

func IntToChoiceErr

func IntToChoiceErr(i int) (Choice, error)

func (Choice) Int

func (r Choice) Int() int

func (Choice) MarshalJSON

func (r Choice) MarshalJSON() ([]byte, error)

func (Choice) String

func (r Choice) String() string

func (*Choice) UnmarshalJSON

func (r *Choice) UnmarshalJSON(data []byte) error

type GameID

type GameID uint64

func GameIDFromString

func GameIDFromString(s string) (GameID, error)

func (GameID) MarshalJSON

func (r GameID) MarshalJSON() ([]byte, error)

func (GameID) String

func (r GameID) String() string

func (*GameID) UnmarshalJSON

func (r *GameID) UnmarshalJSON(data []byte) error

type Message

type Message struct {
	LeftPlayerName    string `json:"left_player_name"`
	RightPlayerName   string `json:"right_player_name"`
	LeftPlayerChoice  Choice `json:"left_player_choice"`
	RightPlayerChoice Choice `json:"right_player_choice"`
	Result            Result `json:"result"`
}

type Result

type Result byte
const (
	Win Result = iota
	Lose
	Tie

	Unknown Result = 0xff
)

func IntToResult

func IntToResult(i int) Result

func IntToResultErr

func IntToResultErr(i int) (Result, error)

func (Result) Int

func (r Result) Int() int

func (Result) MarshalJSON

func (r Result) MarshalJSON() ([]byte, error)

func (Result) String

func (r Result) String() string

func (Result) Swap

func (r Result) Swap() Result

func (*Result) UnmarshalJSON

func (r *Result) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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