state

package
v0.0.0-...-8d6cbe8 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSeed

func GetSeed() (rv int64)

Types

type Game

type Game struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(data string) *Game

func (*Game) DeletePlayer

func (g *Game) DeletePlayer(name string) bool

func (*Game) GetHash

func (g *Game) GetHash() hash.Hash

func (*Game) HasPlayer

func (g *Game) HasPlayer(name string) bool

func (*Game) History

func (g *Game) History() []string

func (*Game) Leaders

func (g *Game) Leaders() []LeaderInfo

func (*Game) ListStocks

func (g *Game) ListStocks() []Stock

func (*Game) News

func (g *Game) News() []string

func (*Game) Player

func (g *Game) Player(name string) *PlayerInfo

type GameState

type GameState struct {
	Stock    [stockTypes]Stock
	Player   map[string]*Player
	News     []string
	History  []string
	Key      []byte
	Previous time.Time
}

func (*GameState) Leaders

func (g *GameState) Leaders() []LeaderInfo

type LeaderInfo

type LeaderInfo struct {
	Name  string
	Worth uint64
}

type LeaderSort

type LeaderSort []LeaderInfo

func (LeaderSort) Len

func (l LeaderSort) Len() int

func (LeaderSort) Less

func (l LeaderSort) Less(i, j int) bool

func (LeaderSort) Swap

func (l LeaderSort) Swap(i, j int)

type Player

type Player struct {
	Cash     uint64
	Shares   [stockTypes]uint64
	Password []byte
}

type PlayerInfo

type PlayerInfo struct {
	Cash   uint64
	Shares [stockTypes]uint64
	// contains filtered or unexported fields
}

func (*PlayerInfo) Buy

func (p *PlayerInfo) Buy(stock string, lots uint64) error

func (*PlayerInfo) CheckPassword

func (p *PlayerInfo) CheckPassword(pw []byte) bool

func (*PlayerInfo) Sell

func (p *PlayerInfo) Sell(stock string, lots uint64) error

func (*PlayerInfo) SetPassword

func (p *PlayerInfo) SetPassword(pw []byte)

type Stock

type Stock struct {
	Name  string
	Value uint64
}

Jump to

Keyboard shortcuts

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