Utility functions (global)

Members

default_colours

A list of default colours if nothing is given by the user.
Source:

Methods

CopyGridODEs(cols, rows, template)

Make a back-up of all the ODE states (for synchronous ODE updating)
Parameters:
Name Type Description
cols int Width of the grid
rows int Height of the grid
template 2DArray Get ODE states from here
Source:

dict_reverse(obj)

Reverse dictionary
Parameters:
Name Type Description
obj Object dictionary-style object to reverse in order
Source:

hexToRGB(hex)

Convert hexadecimal to RGB
Parameters:
Name Type Description
hex String string to convert to RGB
Source:

MakeGrid(cols, rows, template)

Make a grid, or when a template is given, a COPY of a grid.
Parameters:
Name Type Description
cols int Width of the new grid
rows int Height of the new grid
template 2DArray Template to be used for copying (if not set, a new empty grid is made)
Source:

nameToRGB(name)

Convert colour name to RGB
Parameters:
Name Type Description
name String string to look up in the set of known colours (see below)
Source:

parseColours(cols)

Make sure all colours, even when of different types, are stored in the same format (RGB, as cacatoo uses internally)
Parameters:
Name Type Description
cols Array array of strings, or [R,G,B]-arrays. Only strings are converted, other returned.
Source:

pause()

Below are a few global functions that are used by Simulation classes, but not a method of a Simulation instance per se
Source:

shuffle(array, rng)

Randomly shuffle an array with custom RNG
Parameters:
Name Type Description
array Array array to be shuffled
rng MersenneTwister MersenneTwister RNG
Source:

stringToRGB$1(string)

Convert colour string to RGB. Works for colour names ('red','blue' or other colours defined in cacatoo), but also for hexadecimal strings
Parameters:
Name Type Description
string String string to convert to RGB
Source: