VAT

The VAT (Visual AgenTalk) Formula Syntax is used to create VAT formulas. It contains the mathematical functions that are supported by AgentCubes.

Shows the location of actions in AgentCubes
OperationDefinitionExampleResult
Arithmetic Operationsx + yBasic arithmetic operations. 3 + 47
x - y
x * yx * (3 - y)f(x, y)
x / y
Agent Query Functionsagents_with_shape(shape_name) Query function that returns the number of agents with a given shape. agents_with_shape("dead_frog") Returns the number of agents that have a shape with the name "dead_frog" in the simulation.
agents_of_type(agent_name)Query function that returns the number of agents with a given name.agents_of_type("frog")Returns the number of "frog" agents in the simulation.
get_direction()Query function that returns the direction the agent is facing.get_direction()Returns a number the agent is facing.
Top: 0
Right: 3
Bottom: 2
left: 1
get_direction_angle()get_direction_angle()Returns a number the agent is facing.
Top: 0
Right: 270
Bottom: 180
left: 90
get_row()Function to query the row in which the agent is located in the world.get_row()Returns the numerical row where the agent is located in the world.
get_column()Function to query the column in which the agent is located in the world.get_column()Returns the numerical column where the agent is located in the world.
Agent Attribute AccessAttribute Access the value of an agent attribute. An agent can have any number of attributes defined by the user.DiameterValue of the agent attribute "Diameter".
Diameter * 3.14 Value of attribute "Diameter" multiplied by 3.14 .
Remote Agent Attribute attribute[up]
attribute[down]
attribute[left]
attribute[right]
attribute[top]
attribute[bottom]
attribute[col, row]
attribute[stacked_below]
attribute[stacked_above]
attribute[layer_above]
attribute[layer_below]
Access the value of other agents' attribute using relative coordinates.

Valid coordinates are up, down, left, right, top and bottom. Coordinates can also be specified numerically as column, row. Valid values for row and column are -1, 0, 1. Positive row values indicates down, positive column indicates right.
age[left]Value of the "Age" attribute of agent to the left.
age[top]value of the "Age" attribute of the agent on top
Temperature[-1,-1]Value of the "Temperature" attribute of the agent above to the left.
0.25 * (Temp[left] + Temp[right]+ Temp[up] + Temp[down]) The average of the value of the "Temp" attribute of the agents left, right, up and down.
Simulation Property Access@simpropertyAccess the value of a global simulation property.

Simulation Properties are used to share information between agents. Users can inspect and edit the values of simulation properties using the simulation property editor. The "@" sign is used to differentiate the simulation properties from agent attributes.
@TimeValue of simulation property "Time".
Trigonometric Functionssin(x)Trigonometric function sine, where x is expressed in radians.sin(3)0.1411
cos(x)Trigonometric function cosine, where x is expressed in radians.cos(3)-0.9900
tan(x)Trigonometric function tangent, where x is expressed in radians.tan(3)-0.1425
Random Number Generatorrandom(number)Returns a pseudo random number between zero and number.random(4.0)returns decimal number between 0 (inclusive) and 4.0 (exclusive).
AgentCubes differentiates between integers and decimal numbers. If the number is an integer (e.g. 4), an integer between 0 and number is returned, whereas if number is a decimal number, a decimal number between 0 and number is returned.random(4)returns either 0, 1, 2, or 3
Otherx ^^ yExponentiation function. Raises the base number x to the exponent y.15^^4 50625
sqrt(x)Square root function. Takes the square root of number x, where x is a non-negative integer or a decimal number (x>=0).sqrt(10)3.1622776601683795
x % y Modulo function. Gives the remainder of the division of x / y. 17 % 41
round(x)Round function. Rounds x. round(10.45)10
floor(x) or truncate(x)Floor function. Rounds downs x. Truncate also rounds down x.floor(10.8) or truncate(10.8)10
ceil(x)Ceiling function. Rounds up x. ceil(9.1)10
max(x,y)Max function. returns the largest numeric value of x or y. max(2,11)11
min(x,y)Min function. returns the smallest numeric value of x or y. min(11,2)2
abs(x)Absolute function. The absolute value of x is the non-negative value of x.abs(-10)10