Simulator class in Global context

The Framsticks simulator.

41 members:

integer autosaveperiod
integer, 0 .. 100000

Save backup

Save simulation state once every n-th event
(events are defined by the script. For 'standard.expdef' it is after each death).
Save EXPT file first to initialize name for autosave files.

integer createrr
integer, 0 .. 2
  • 0 = Ignore
  • 1 = Show summary (default)
  • 2 = Show details
  • Object creation errors

    integer creatwarnfail
    integer, 0 .. 1 (false/true)

    Fail on warnings

    Creatures grown with warnings will not be simulated.

    string expdef
    string

    Experiment definition

    Choose the experiment framework
    (in Windows GUI, confirm by pressing 'Apply')

    Stop the simulation before selecting another experiment definition.
    It is a good practice to initialize the experiment before running the simulation.

    string expdef_info
    multiline string

    Description

    string expdef_title
    string

    Title

    integer filecomm
    integer, 0 .. 1 (false/true)
    default=1

    Show file comments

    Display comments encountered in opened files

    object genolib

    gene pools object

    integer groupchk
    integer, 0 .. 1 (false/true)

    Check genotypes added to groups

    integer importchk
    integer, 0 .. 1 (false/true)

    Check imported genotypes

    object livelib

    populations object

    integer loadchk
    integer, 0 .. 1 (false/true)

    Check genotypes loaded from experiment

    float maxjoint
    float, 0 .. 100
    default=2

    Maximal joint length

    float minjoint
    float, 0 .. 100
    default=0

    Minimal joint length

    integer overwrite
    integer, 0 .. 1 (false/true)

    Overwrite

    Overwite existing files or create their backups

    integer resetonexpdef
    integer, 0 .. 1 (false/true)
    default=1

    Reset before changing experiment definition

    If turned on: when a new experiment definition is selected, default values are loaded for most of the simulator parameters, and gene pools and populations are cleared.
    When turned off: parameters from previous experiment definition will remain.

    integer running
    integer, 0 .. 1 (false/true)

    is the simulation running?

    for synchronizing the user interface state

    integer simspeed
    integer

    simulation speed

    steps/second

    integer time
    integer

    number of steps

    string usercode
    multiline string

    User script

    This script overrides the experiment definition

    integer vmdebug
    integer, 0 .. 1 (false/true)

    VM debug

    object world

    world object

    function beep
    doesn't return a value

    beep

    function beep()

    Plays a default system sound

    function checkpoint
    doesn't return a value

    Notify that the experiment state was significantly updated.

    function checkpoint()

    This function was previously called "autosave".

    function eval
    doesn't return a value

    evaluate expression

    function eval(string script_expression)
    function export
    doesn't return a value

    export

    function export(string filename, integer options, integer genepool, integer population)

    Save some data to file. arguments:
    - filename
    - flags: composed of the following bit values:
    1 - experiment (works like "save" and all other bits are ignored)
    2 - genotypes
    4 - simulator parameters
    8 - simulator stats
    16 - genepool settings
    32 - population settings
    64 - do autosave
    - selected genepool
    - selected population

    function import
    doesn't return a value

    import

    function import(string filename, integer options)

    Load some data from file. The second optional argument selects what section(s) will be imported:
    1 - experiment (works like "load" and can reset the simulator state!)
    2 - genotypes
    4 - simulator parameters
    8 - genepool settings
    16 - population settings
    32 - new groups will be created for imported genepools and populations
    64 - allow switching to a different expdef while importing parameters (4)

    The standard behavior (without the second argument) is to import genotypes, parameters, and genepool and population settings (2+4+8+16). Note that "64" is not included by default, because the expdef change resets all simulator parameters, which contradicts the usual meaning of "import" in Framsticks ("add data", as opposed to "load" meaning "replace data"). Moreover, using the "64" option in scripts can be dengerous, especially all expdef and show scripts should always declare the proper expdef name in their header rather than change the expdef directly. Without the "64" option, it is always safe to "import" any file in a script regardless of the current simulator state.

    function init
    doesn't return a value

    Initialize experiment

    function init()

    Performs initialization procedures, like resetting counters, states, gene pools, etc.

    function load
    doesn't return a value

    load

    function load(string filename)

    Load experiment file (calls onExpLoad() in the current experiment definition). This function is intended to replace the simulator state; the old state is cleared by automatically calling "resetToDefaults()" (only if "resetonexpdef" is enabled). Use "import" if you don't want to loose the old simulator state.

    function loadexpdef
    doesn't return a value

    Reload experiment definition

    function loadexpdef()
    function loadNeurons
    doesn't return a value

    (re)load neuron definitions

    function loadNeurons(string directory_path)
    function message
    doesn't return a value

    print message

    function message(string text, integer level)

    The second argument can be:
    -1 = debugging message
    0 = information
    1 = warning
    2 = error
    3 = critical error

    function new
    returns Simulator

    create new Simulator

    function new()
    function print
    doesn't return a value

    print information message

    function print(string text)

    One argument: message to be printed

    function resetToDefaults
    doesn't return a value

    Reset the simulator state

    function resetToDefaults()

    Clears groups and loads default values for simulator parameters, then calls onExpDefLoad() of the current experiment definition.

    function save
    doesn't return a value

    save

    function save(string filename)

    Save experiment file (calls onExpSave() in the current experiment definition)

    function sleep
    doesn't return a value

    sleep

    function sleep(integer milliseconds)

    Suspends the execution for a specified interval

    function sound
    doesn't return a value

    sound

    function sound(integer freqency_in_Hz, integer length_in_milliseconds)

    Generates a simple tone on the speaker

    function start
    doesn't return a value

    start simulation

    function start()

    called by the user interface

    function step
    doesn't return a value

    do single simulation step

    function step()
    function stop
    doesn't return a value

    stop simulation

    function stop()

    the expdef script calls this to stop simulation


    Global context