void CalculatePathChainForOrGate(Gate.OrGate orGate, Requirement requirementToAvoid) { var unlockableGates = orGate.Gates .Where(g => GateCanBeOpenedWithoutSuppliedRequirements(g, requirementToAvoid)) .ToArray(); var unlockableGate = unlockableGates[random.Next(unlockableGates.Length)]; //SelectRandom CalculatePathChain(unlockableGate, requirementToAvoid); }
bool GateCanBeOpenedWithoutSuppliedRequirements(Gate.OrGate orGate, Requirement requirementToAvoid) { return(orGate.Gates.Any(g => GateCanBeOpenedWithoutSuppliedRequirements(g, requirementToAvoid))); }