# Gates

The Nodes that redistribute Resources

Once activated, a Gate will immediately redistribute Resources, without collecting them.

As all other Nodes, Gates support all 4 Activation Modes. Set this in Functional > Activation. Instead of a flow rate, each output is labeled with a probability (probable outputs) or a condition (conditional outputs).

All outputs of a single Gate must be of the same type: when one output is probable, all must be probable, and when one output is conditional, all must be conditional.

## Probable Outputs

Probabilities can be represented as percentages (X%) or weights indicated by single numbers (1 or 3).

In case of percentages, a Resource flowing into a Gate will have a probability equal to the percentage indicated by each output.

The sum of these probabilities should not add up to more than 100%.

If the total is less than 100%, there is a chance that the Resource will not be sent along any output and be destroyed instead.

In the case of weights, the chance that a Resource will flow through a particular output is equal to the weight of that output divided by the sum of the weights of all outputs of the Gate.

In other words, if there are two outputs, one with a weight of 1 and the other with a weight of 3, the chance that a Resource will flow out the first one is 1 in 4, and the chance that it will flow out the second one is 3 in 4.

Gates with probable outputs can be used to represent chances and risks.

In Risk, players put armies in danger to gain territories. This type of risk can be represented easily by a Gate with probable outputs indicating the rates for success or failure. An output is conditional when it is Labeled with a condition (such as >3 or ==0 or 3-5). In this case, all conditions are checked every time a Resource arrives at the Gate, and one Resource is sent along every output whose condition is met. The conditions might overlap; this can lead to duplication of Resources or, when no condition is met, to the destruction of the Resource.

When a Gate has no inputs, it triggers every time it fires.

This way Gates can be used to produce Triggers either automatically or in response to player actions.

Gates use only 1 time step to both get the input and redistribute the output.

## Gates Distribution Modes

Gates have one of two distribution modes: deterministic distribution and random distribution. Set this in Functional > Distribution. Choose the diamond shape for a deterministic and the die symbol for a random/probabilistic Gate.

### Deterministic Gates

Distribute Resources evenly according to the distribution probabilities indicated by percentages or weights if it has probable outputs.

With conditional outputs, it will count the number of Resources that have passed through it every time step and will use that number to check the conditions of its outputs. (It can be convenient to think of a deterministic Gate with conditional outputs as a counting Gate.)

A deterministic Gate has no special symbol and is represented as a small open diamond.

### Random Gates

Generate a random value to determine where it will distribute incoming Resources.

When it has probable outputs, it will generate a suitable number (either a value between 0% and 100% or a number below the total weights of the outputs).

When its outputs are conditional, it will produce a value between 1 and x, where x can be defined in the Dice variable as Dx, in the Diagram's Functional menu (see screenshot below). This checks against the conditions, just as if the diagram rolled a normal x-sided die. By default, the die value is set to 6.

Random Gates are marked with a die symbol.

Gates might have only one output. Gates with one output act the same way as Gates with multiple outputs.

All output State Connections from a Gate are Triggers.

These Triggers can also be conditional or probabilistic. In this way, Gates can be used to control the flow of Resources (see example below).

Gates do not accumulate Resources, therefore Label Modifiers, Node Modifiers, and Activators originating from a Gate serve no purpose.