simulator

package
v0.0.0-...-dff1495 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CryptoRandSeed

func CryptoRandSeed() int64

cryptoRandSeed generates a random seed using crypo rand

func GenerateCharacterDetails

func GenerateCharacterDetails(cfg *info.ActionList) ([]*model.Character, error)

func GenerateResult

func GenerateResult(cfg string, simcfg *info.ActionList) (*model.SimulationResult, error)

Note: this generation should be iteration independent (iterations do not change output)

func GenerateSampleWithSeed

func GenerateSampleWithSeed(cfg string, seed uint64, opts Options) (*model.Sample, error)

GenerateSampleWithSeed will run one simulation with debug enabled using the given seed and output the debug log. Used for generating debug for min/max runs

func Parse

func Parse(cfg string) (*info.ActionList, ast.Node, error)

func ReadConfig

func ReadConfig(fpath string) (string, error)

readConfig will load and read the config at specified path. Will resolve any import statements as well

func Run

Run will run the simulation given number of times

func RunWithConfig

func RunWithConfig(ctx context.Context, cfg string, simcfg *info.ActionList, gcsl ast.Node, opts Options, start time.Time) (*model.SimulationResult, error)

Runs the simulation with a given parsed config TODO: cfg string should be in the action list instead TODO: need to add a context here to avoid infinite looping

func Version

func Version() string

Types

type Options

type Options struct {
	ResultSaveToPath string // file name (excluding ext) to save the result file; if "" then nothing is saved to file
	GZIPResult       bool   // should the result file be gzipped; only if ResultSaveToPath is not ""
	ConfigPath       string // path to the config file to read
}

Options sets out the settings to run the sim by (such as debug mode, etc..)

Jump to

Keyboard shortcuts

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