Global

Members

(constant) ActionType :number

Enum for ActionType

Type:
  • number
Properties:
Name Type Description
NONE number
MOVE number
HARVEST number
ATTACK number
TRANSFER number
PHEROMONE number
Source:

(constant) DirectionType :number

Enum for DirectionType

Type:
  • number
Properties:
Name Type Description
FORWARD number
BACKWARD number
NONE number
Source:

(constant) ObjectType :number

Enum for ObjectType

Type:
  • number
Properties:
Name Type Description
NONE number
HIVE number
FOOD number
ANT number
SPIDER number
PHEROMONE number
Source:

(constant) PheromoneType :number

Enum for PheromoneType

Type:
  • number
Properties:
Name Type Description
NONE number
ATTACK number
DEFEND number
FOOD number
DANGER number
Source:

Methods

angleBetweenVectorsDeg(Vector, Vector) → {number}

Gets the angle in degree between to vectors [-180,180].

Parameters:
Name Type Description
Vector dict

a.

Vector dict

b.

Source:
Returns:

angle in degree.

Type
number

angleBetweenVectorsRad(Vector, Vector) → {number}

Gets the angle in radians between to vectors [-PI,PI].

Parameters:
Name Type Description
Vector dict

a.

Vector dict

b.

Source:
Returns:

angle in radians.

Type
number

argmax(List) → {number}

Gets the position inside a list of the maximum value.

Parameters:
Name Type Description
List list

of numbers.

Source:
Returns:

Position of the maximum value.

Type
number

degToRad() → {number}

Returns a number converted from radians to degree.

Parameters:
Name Type Description
degree. number
Source:
Returns:

radians.

Type
number

getDistance(Point, Point) → {number}

Gets the distance between to points.

Parameters:
Name Type Description
Point dict

a.

Point dict

b.

Source:
Returns:

distance.

Type
number

maxElement(List) → {number}

Gets the maximum value in a list.

Parameters:
Name Type Description
List list

of numbers.

Source:
Returns:

Maximum value.

Type
number

normalize() → {dict}

Gets the normalized vector.

Parameters:
Name Type Description
Vector. dict
Source:
Returns:

Normalized vector.

Type
dict

radToDeg() → {number}

Returns a number converted from degree to radians.

Parameters:
Name Type Description
radians. number
Source:
Returns:

degree.

Type
number

rand(min, max) → {number}

Returns a random value between min and max.

Parameters:
Name Type Description
min number

Lower threshold.

max number

Upper threshold.

Source:
Returns:

random number.

Type
number

rotateVector(Rotation) → {dict}

Rotates a vector by given radians.

Parameters:
Name Type Description
Vector. dict
Rotation number

given in radians.

Source:
Returns:

Rotated vector.

Type
dict