sim

package
v0.0.0-...-160e8be Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CobraCommand

func CobraCommand(rkcycmd *runner.RkcyCmd) *cobra.Command

Types

type Character

type Character struct {
	Inst *pb.Character
	Rel  *pb.CharacterRelated
}

type Command

type Command struct {
	Handler Handler
	Ratio   float64
}

type CommandId

type CommandId int
const (
	CmdCreateCharacter CommandId = iota
	CmdFund
	CmdTrade
	CmdReadPlayer
	CmdReadCharacter

	Cmd_COUNT
)

type Difference

type Difference struct {
	Message string
	Type    DifferenceType
	StateDb proto.Message
	Rkcy    proto.Message
}

type DifferenceType

type DifferenceType string
const (
	Error   DifferenceType = "Error"
	Process DifferenceType = "Process"
	Storage DifferenceType = "Storage"
)

type Player

type Player struct {
	Inst *pb.Player
	Rel  *pb.PlayerRelated
}

type RunnerArgs

type RunnerArgs struct {
	RunnerIdx          uint
	EdgeGrpcAddr       string
	SimulationCount    uint
	RandomSeed         int64
	Ratios             []float64
	InitCharacterCount uint
	PreSleepSecs       uint
}

type Settings

type Settings struct {
	EdgeGrpcAddr       string
	RunnerCount        uint
	SimulationCount    uint
	RandomSeed         int64
	Ratios             string
	InitCharacterCount uint
	PreSleepSecs       uint
	DiffWaitSecs       uint
}

type StateDb

type StateDb struct {
	Players    []*Player
	Characters []*Character

	PlayerMap    map[string]*Player
	CharacterMap map[string]*Character
}

func NewStateDb

func NewStateDb() *StateDb

func (*StateDb) Credit

func (stateDb *StateDb) Credit(charId string, funds *pb.Character_Currency) error

func (*StateDb) Debit

func (stateDb *StateDb) Debit(charId string, funds *pb.Character_Currency) error

func (*StateDb) RandomCharacter

func (stateDb *StateDb) RandomCharacter(r *rand.Rand) *Character

func (*StateDb) RandomPlayer

func (stateDb *StateDb) RandomPlayer(r *rand.Rand) *Player

func (*StateDb) UpsertCharacter

func (stateDb *StateDb) UpsertCharacter(character *Character)

func (*StateDb) UpsertPlayer

func (stateDb *StateDb) UpsertPlayer(player *Player)

type StorageTarget

type StorageTarget struct {
	Init   rkcy.StorageInit
	Config map[string]string
}

Jump to

Keyboard shortcuts

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