Artificial Player
Last updated
Last updated
Note: machinations.io does not have an Artificial Player Node. However, most situations solved with the AP Node in the original version, may be modelled with existing Components.
This article deals with a few examples of how to to this.
fire(node)
Fire a specific Node on the diagram
fireAll(node, node...)
Fire multiple Nodes simultaneously
fireSequence(node, node...)
fireRandom(node, node...)
To fire multiple Nodes randomly, use a Random Sorting Gate with probable outcomes to trigger each Node and balance the probability with which each Node is fired, to fit your needs.
You can emulate conditional commands like if(condition)command
using multiple components.
Here's a simple example of how to emulate if(pool>2)fire(source)
Here's such an example: if(pool>3&&pool<8)fire(source)
The passive Register verifies if the value "a" - equal to the number of Resources in "pool" at every time-step - is larger than 3 and smaller than 8. This returns a binary result (1-true; 0-false). As long as the value of the passive Register is >0, "source" is active and produces resources.
Here's how to emulate theif(Resources>4) fireRandom(Consume, Upgrade)
example
The Pool Resources fills with more than 4 Resources before randomly choosing between a Consume or Upgrade action, with a probability of 30% by 70%, respectively.
To emulate the statement above, use a Deterministic Sorting Gate with weighted outcomes. Note that the order in which the gate sends Resources along its outputs is determined by the order in which these outputs were added to the diagram.
If you're trying to model a more complex if statement, you can use Registers to calculate conditions. Note that in machinations.io Registers support all math.js functions.