Skip to content

RuleBlueprintWithAccept

Defined in: blueprint/rule-blueprint.ts:108

Extended rule blueprint that additionally exposes the accept method for choosing how multiple conditions are evaluated.

new RuleBlueprintWithAccept(context, automaton, rule): RuleBlueprintWithAccept

Defined in: blueprint/rule-blueprint.ts:13

BlueprintContext

Automaton

Rule

RuleBlueprintWithAccept

RuleBlueprint.constructor

accept(strategy): void

Defined in: blueprint/rule-blueprint.ts:119

Sets the acceptance strategy for multiple conditions on this rule.

  • "all" (default) — every condition must pass.
  • "any" — at least one condition must pass.
  • "one" — exactly one condition must pass.
  • "none" — no condition must pass (negation).

Strategy

The acceptance strategy.

void


chance(part, whole?): RuleBlueprintWithAccept

Defined in: blueprint/rule-blueprint.ts:82

Adds a chance condition to the rule. The rule passes with a probability of part / whole.

number

The numerator of the probability fraction.

number = 100

The denominator of the probability fraction. Defaults to 100.

RuleBlueprintWithAccept

A RuleBlueprintWithAccept for chaining more conditions or setting an accept strategy.

RuleBlueprint.chance


count(refBlueprintOrNeighbor, …count): RuleBlueprintWithAccept

Defined in: blueprint/rule-blueprint.ts:37

Adds a count condition to the rule. The rule passes only if the number of matching neighbors equals one of the specified count values.

The element, kind, or neighbor reference to count.

AnyNeighbor | RefBlueprint

…(number | number[])[]

The accepted count values. Can be individual numbers or arrays. When omitted, matches any count from 1 to the neighborhood size.

RuleBlueprintWithAccept

A RuleBlueprintWithAccept for chaining more conditions or setting an accept strategy.

RuleBlueprint.count


is(neighbor, refBlueprintOrNeighbor): RuleBlueprintWithAccept

Defined in: blueprint/rule-blueprint.ts:63

Adds an is condition to the rule. Checks whether a specific neighbor position matches a given element, kind, or another neighbor position.

AnyNeighbor

The neighbor position to inspect (e.g. vi.neighbor.TOP).

The element, kind, or neighbor position to compare against.

AnyNeighbor | RefBlueprint

RuleBlueprintWithAccept

A RuleBlueprintWithAccept for chaining more conditions or setting an accept strategy.

RuleBlueprint.is