Example #1
0
        protected CutInstruction GetCutInstructionForWire(VennWireComponent component, VennSnippableWire wire, bool log)
        {
            bool flag      = (wire.Color & VennWireColor.Red) == VennWireColor.Red;
            bool flag2     = (wire.Color & VennWireColor.Blue) == VennWireColor.Blue;
            bool hasSymbol = wire.HasSymbol;
            bool isLEDOn   = wire.IsLEDOn;

            return(this.RuleDict[new VennWireState(flag, flag2, hasSymbol, isLEDOn)]);
        }
Example #2
0
    protected override IEnumerator ForcedSolveIEnumerator()
    {
        yield return(null);

        VennWireComponent vwc     = (VennWireComponent)Module.BombComponent;
        VennWireRuleSet   ruleSet = RuleManager.Instance.VennWireRuleSet;

        foreach (VennSnippableWire wire in _wires)
        {
            if (ruleSet.ShouldWireBeSnipped(vwc, wire.WireIndex, false) && !wire.Snipped)
            {
                yield return(DoInteractionClick(wire));
            }
        }
    }
Example #3
0
        public bool ShouldWireBeSnipped(VennWireComponent component, int indexOfCutWire, bool log)
        {
            VennSnippableWire wire = null;

            foreach (VennSnippableWire vennSnippableWire in component.ActiveWires)
            {
                if (indexOfCutWire == vennSnippableWire.WireIndex)
                {
                    wire = vennSnippableWire;
                    break;
                }
            }
            CutInstruction cutInstructionForWire = this.GetCutInstructionForWire(component, wire, log);

            return(this.ShouldCut(component, cutInstructionForWire));
        }
Example #4
0
        protected bool ShouldCut(VennWireComponent component, CutInstruction instruction)
        {
            switch (instruction)
            {
            case CutInstruction.Cut:
                return(true);

            case CutInstruction.DoNotCut:
                return(false);

            case CutInstruction.CutIfSerialEven:
                return(SerialNumber.SerialNumberLastDigitEven());

            case CutInstruction.CutIfParallelPortPresent:
                return(PortPlate.IsPortPresent(PortTypes.Parallel));

            case CutInstruction.CutIfTwoOrMoreBatteriesPresent:
                return(Batteries.TotalBatteries >= 2);

            default:
                return(false);
            }
        }
 public VennWireComponentSolver(BombCommander bombCommander, VennWireComponent bombComponent, IRCConnection ircConnection, CoroutineCanceller canceller) :
     base(bombCommander, bombComponent, ircConnection, canceller)
 {
     _wires  = bombComponent.ActiveWires;
     modInfo = ComponentSolverFactory.GetModuleInfo("VennWireComponentSolver");
 }
 public VennWireComponentSolver(BombCommander bombCommander, VennWireComponent bombComponent) :
     base(bombCommander, bombComponent)
 {
     _wires  = bombComponent.ActiveWires;
     modInfo = ComponentSolverFactory.GetModuleInfo("VennWireComponentSolver", "!{0} cut 3 [cut wire 3] | !{0} cut 2 3 6 [cut multiple wires] | Wires are ordered from left to right | Empty spaces are not counted");
 }