예제 #1
0
        public string ShouldICutThisWire(Bomb bomb, ComplicatedWire wire)
        {
            wire.HasSerialLastDigitEven = bomb.HasSerialLastDigitEven();
            wire.HasParallelPort        = bomb.HasPort("parallel");
            wire.HasBatteries           = bomb.HasManyBatteries(2);

            return(CutThisWire(wire) ? "Cut it." : "Leave it.");
        }
예제 #2
0
        public override string Command(Bomb bomb, string command)
        {
            string config = "";

            if (command.Contains("solved"))
            {
                Solved = true;
                return("Module solved.");
            }

            foreach (var word in command.Split(' ').Where(x => x == "none" || x == "white" || x == "blue" || x == "red" || x == "star" || x == "led"))
            {
                config += word + " ";
            }
            wire = new ComplicatedWire(config.Trim());
            return(Solve(bomb));
        }
예제 #3
0
 public bool CutThisWire(ComplicatedWire wire)
 {
     if (wire.HasRed)
     {
         if (wire.HasBlue)
         {
             if (wire.HasStar)
             {
                 if (wire.HasLed)
                 {
                     return(false);
                 }
                 else
                 {
                     return(wire.HasParallelPort);
                 }
             }
             else
             {
                 return(wire.HasSerialLastDigitEven);
             }
         }
         else
         {
             if (wire.HasStar)
             {
                 if (wire.HasLed)
                 {
                     return(wire.HasBatteries);
                 }
                 else
                 {
                     return(true);
                 }
             }
             else
             {
                 if (wire.HasLed)
                 {
                     return(wire.HasBatteries);
                 }
                 else
                 {
                     return(wire.HasSerialLastDigitEven);
                 }
             }
         }
     }
     else
     {
         if (wire.HasBlue)
         {
             if (wire.HasStar)
             {
                 if (wire.HasLed)
                 {
                     return(wire.HasParallelPort);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 if (wire.HasLed)
                 {
                     return(wire.HasParallelPort);
                 }
                 else
                 {
                     return(wire.HasSerialLastDigitEven);
                 }
             }
         }
         else
         {
             if (wire.HasStar)
             {
                 if (wire.HasLed)
                 {
                     return(wire.HasBatteries);
                 }
                 else
                 {
                     return(true);
                 }
             }
             else
             {
                 if (wire.HasLed)
                 {
                     return(false);
                 }
                 else
                 {
                     return(true);
                 }
             }
         }
     }
 }