Table of Contents

Class DNFLogicDef

Namespace
RandomizerCore.Logic
Assembly
RandomizerCore.dll

A LogicDef which stores its contents in disjunctive normal form.
Preferred for operations which need to inspect the successful subexpression after evaluation, such as most state operations.

public class DNFLogicDef : StateLogicDef, ILogicDef
Inheritance
DNFLogicDef
Implements
Inherited Members

Constructors

DNFLogicDef(DNFLogicDef)

protected DNFLogicDef(DNFLogicDef other)

Parameters

other DNFLogicDef

Methods

CanGet(ProgressionManager)

Evaluates the logic, for the given progression data input.

public override bool CanGet(ProgressionManager pm)

Parameters

pm ProgressionManager

Returns

bool

CheckForUpdatedState(ProgressionManager, StateUnion?, List<State>, int, out StateUnion)

Runs EvaluateState, and returns true if any new states are added to the state union.

public override bool CheckForUpdatedState(ProgressionManager pm, StateUnion? current, List<State> newStates, int modifiedTerm, out StateUnion result)

Parameters

pm ProgressionManager
current StateUnion
newStates List<State>
modifiedTerm int
result StateUnion

Returns

bool

DetailedEvaluateStateFrom(ProgressionManager, IStateProvider, bool, List<StatePathResult>)

Keeps states from true StatePaths separated, along with their corresponding true conjunctions. API for "explaining" a state evaluation.

public bool DetailedEvaluateStateFrom(ProgressionManager pm, IStateProvider stateProvider, bool firstConjunctionsOnly, List<DNFLogicDef.StatePathResult> results)

Parameters

pm ProgressionManager
stateProvider IStateProvider
firstConjunctionsOnly bool
results List<DNFLogicDef.StatePathResult>

Returns

bool

EvaluateState(ProgressionManager, List<State>)

Uses the current progression data to determine under what state(s) the logic is satisfiable.
Appends a (possibly empty, non-reduced) sequence of result states to the input list. Returns true if the result is nonempty, or the result is empty but represents a nonnull indeterminate result.

public override bool EvaluateState(ProgressionManager pm, List<State> states)

Parameters

pm ProgressionManager
states List<State>

Returns

bool

EvaluateStateFrom(ProgressionManager, IStateProvider, List<State>)

Uses the current progression data what state(s) the logic is satisfiable, only allowing input states from the given state provider (recognized by reference equality).

public override bool EvaluateStateFrom(ProgressionManager pm, IStateProvider stateProvider, List<State> states)

Parameters

pm ProgressionManager
stateProvider IStateProvider
states List<State>

Returns

bool

GetAllSuccessfulConjunctions(ProgressionManager)

public IEnumerable<IEnumerable<TermToken>> GetAllSuccessfulConjunctions(ProgressionManager pm)

Parameters

pm ProgressionManager

Returns

IEnumerable<IEnumerable<TermToken>>

GetFirstSuccessfulConjunction(ProgressionManager)

public IEnumerable<TermToken>? GetFirstSuccessfulConjunction(ProgressionManager pm)

Parameters

pm ProgressionManager

Returns

IEnumerable<TermToken>

GetStateProviders()

Gets a sequence of unique state providers the LogicDef may depend on, for use with EvaluateStateFrom(ProgressionManager, IStateProvider, List<State>).

public override IEnumerable<IStateProvider> GetStateProviders()

Returns

IEnumerable<IStateProvider>

GetTerms()

The sequence of terms on which the LogicDef depends. Terms not included in the sequence must not affect the value of CanGet.

public override IEnumerable<Term> GetTerms()

Returns

IEnumerable<Term>

ToTermTokenSequences()

public IEnumerable<IEnumerable<TermToken>> ToTermTokenSequences()

Returns

IEnumerable<IEnumerable<TermToken>>

ToTokenSequence()

Converts the LogicDef to its equivalent sequence of LogicTokens in RPN format.

public override IEnumerable<LogicToken> ToTokenSequence()

Returns

IEnumerable<LogicToken>