API Documentation for: 0.1.0
Show:

Utility Class

Defined in: Utility:35
Module: StateJS

This machine uses utility functions to select the current state.

States must implement potential method, returning a numeric value. The potential is the utility function of that state. The state that returns the biggest utility will be selected as the current one. The tick method is only called in the current state.

Item Index

Properties

Methods

_to

(
  • name
  • state
  • name
)
private

Defined in _to:160

Change the machine to the new state.

Parameters:

  • name String

    The unique name that identifies the state.

  • state State

    The state object.

  • name String

    The state name.

add

(
  • name
  • state
)

Defined in add:68

Adds a new state to the Utility. The state is identified by a name, which must be unique.

Parameters:

  • name String

    The unique name that identifies the state.

  • state State

    The state object.

get

(
  • name
)
State

Defined in get:90

Returns a registered state instance by name.

Parameters:

Returns:

State:

The state.

initialize

()

Defined in initialize:57

Initialization method.

list

() Array

Defined in list:105

Returns a list of all state names registered in this machine.

Returns:

Array:

An array of state names.

name

(
  • memory
)
String

Defined in name:120

Return the name of the current state. Requires a blackboard instance.

Parameters:

  • memory statejs.Blackboard

    A Blackboard instance.

Returns:

String:

the name of the current state or null if none.

tick

(
  • target
  • memory
)

Defined in tick:131

Verifies which state will assume the current execution and propagates the update to current state.

Parameters:

  • target Object

    A target object.

  • memory statejs.Blackboard

    A Blackboard instance.

Properties

id

String

Defined in id:48

Machine unique ID.