コード例 #1
0
    void LogWires()
    {
        var wireValues = mWires.Select(FormatWireValue);

        var missingWireValues = mWires.Select(wireValue => wireHz.First(pair => (wireValue & pair.Key) == 0).Value);

        Log($"Wire values:\n{wireValues.Take(3).Join(" | ")}\n{wireValues.Skip(3).Join(" | ")}");
        Log($"Missing wire values:\n{missingWireValues.Take(3).Join(" | ")}\n{missingWireValues.Skip(3).Join(" | ")}");

        WireValues redTargetValues  = (WireValues)mTargetWireAField.GetValue(component);
        WireValues blueTargetValues = (WireValues)mTargetWireBField.GetValue(component);

        Log($"The red clip should be connected to a wire containing {FormatWireValue(redTargetValues)} because {redClipRules[redTargetValues]}.");
        Log($"The blue clip should be connected to a wire containing {FormatWireValue(blueTargetValues)} because {blueClipRules[blueTargetValues]}.");
    }
コード例 #2
0
    protected override IEnumerator ForcedSolveIEnumerator()
    {
        yield return(null);

        while (!_component.GetValue <bool>("bActive"))
        {
            yield return(true);
        }
        WireValues[] ansWires = _component.GetValue <WireValues[]>("mWires");
        WireValues   ansAWire = _component.GetValue <WireValues>("mTargetWireA");
        WireValues   ansBWire = _component.GetValue <WireValues>("mTargetWireB");

        yield return(RespondToCommandInternal($"connect {Array.IndexOf(ansWires, ansAWire) + 1} {Array.IndexOf(ansWires, ansBWire) + 1}"));

        while (!_component.GetValue <bool>("bSolved"))
        {
            yield return(true);
        }
    }
コード例 #3
0
 string FormatWireValue(WireValues wireValue) => wireHz
 .Where(pair => (wireValue & pair.Key) != 0)
 .Select(pair => pair.Value)
 .Join("+");