state

package
v0.0.0-...-e7b0e40 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSeed

func GetSeed() (rv int64)

func KMAC128

func KMAC128(separator string, key, data []byte, outBits int) []byte

Types

type Game

type Game struct {
	// contains filtered or unexported fields
}

func Create

func Create(data string) *Game

func Open

func Open(data string) *Game

func (*Game) Close

func (g *Game) Close()

func (*Game) DeletePlayer

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

func (*Game) HasPlayer

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

func (*Game) Hash

func (g *Game) Hash(thing, name string) []byte

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) NewPlayer

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

func (*Game) News

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

func (*Game) Player

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

func (*Game) PlayerByCookie

func (g *Game) PlayerByCookie(cookie []byte) (string, *PlayerInfo)

func (*Game) Run

func (g *Game) Run()

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 PlayerHoldings

type PlayerHoldings struct {
	Cash   uint64
	Shares [stockTypes]uint64
}

type PlayerInfo

type PlayerInfo struct {
	// 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 string) bool

func (*PlayerInfo) ClearCookie

func (p *PlayerInfo) ClearCookie()

func (*PlayerInfo) Holdings

func (p *PlayerInfo) Holdings() PlayerHoldings

func (*PlayerInfo) IsAdmin

func (p *PlayerInfo) IsAdmin() bool

func (*PlayerInfo) NewCookie

func (p *PlayerInfo) NewCookie() []byte

func (*PlayerInfo) Sell

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

func (*PlayerInfo) SetAdmin

func (p *PlayerInfo) SetAdmin(is bool)

func (*PlayerInfo) SetPassword

func (p *PlayerInfo) SetPassword(pw string)

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