コード例 #1
0
        public override string Command(Bomb bomb, string command)
        {
            var color  = "";
            var number = "";

            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.IsNumber(word))
                {
                    number = word;
                }
                if (InternalFunctions.IsColor(word))
                {
                    color = word;
                }
                if (!string.IsNullOrWhiteSpace(number) && !string.IsNullOrWhiteSpace(word))
                {
                    Numbers.Add(color, number);
                    color  = "";
                    number = "";
                }
            }

            if (Numbers.Count != 3)
            {
                return("Could not find enought numbers.");
            }

            return(Solve(bomb));
        }
コード例 #2
0
        public override string Command(Bomb bomb, string command)
        {
            if (command.Contains("color"))
            {
                foreach (var word in command.Split(' '))
                {
                    if (InternalFunctions.IsColor(word))
                    {
                        Colors.Add(word);
                    }
                }

                return("Sequence saved.");
            }

            Stage++;
            ColorsFlashed.Clear();

            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.IsColor(word))
                {
                    ColorsFlashed.Add(word);
                }
            }

            return(Solve(bomb));
        }
コード例 #3
0
 public string WhatToDoWithTheButton(Bomb bomb)
 {
     if (Color == "blue" && bomb.BatteryAA > bomb.BatteryD)
     {
         return(TextPressOrHold(1));
     }
     if (Color == "blue" || Color == "yellow" || Text.Count() >= bomb.GetBiggestSerialDigit())
     {
         return(TextPressOrHold(2));
     }
     if (Color == "blue" || Color == "yellow" || InternalFunctions.IsColor(Text))
     {
         return(TextPressOrHold(1));
     }
     if (string.IsNullOrWhiteSpace(Text))
     {
         return(TextPressOrHold(1));
     }
     if (Text != "dark grey" && Text.Count() > bomb.GetLitIndicators())
     {
         return(TextPressOrHold(2));
     }
     if (bomb.GetUnlitIndicators() <= 2 && bomb.HasSerialVowel())
     {
         return(TextPressOrHold(2));
     }
     return(TextPressOrHold(1));
 }
コード例 #4
0
        public override string Command(Bomb bomb, string command)
        {
            StartPosition = new Wire();
            var positionList = new List <int>()
            {
            };
            var colorList = new List <string>();

            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.IsNumber(word))
                {
                    positionList.Add(InternalFunctions.GetNumber(word));
                }
                if (InternalFunctions.IsColor(word))
                {
                    colorList.Add(word);
                }
            }

            if (positionList.Count != colorList.Count || positionList.Count == 0 || colorList.Count == 0)
            {
                return("Different number of colors and positions.");
            }

            var originalStart = StartPosition;

            for (int i = 0; i < positionList.Count - 1; i++)
            {
                StartPosition.Start         = positionList[i];
                StartPosition.End           = positionList[i + 1 % positionList.Count];
                StartPosition.Color         = colorList[i];
                StartPosition.Next          = new Wire();
                StartPosition.Next.Previous = StartPosition;
                StartPosition = StartPosition.Next;
            }

            StartPosition.Start         = positionList[positionList.Count - 1];
            StartPosition.End           = positionList[0];
            StartPosition.Color         = colorList[colorList.Count - 1];
            StartPosition.Next          = originalStart;
            StartPosition.Next.Previous = StartPosition;
            StartPosition = StartPosition.Next;

            return(Solve(bomb));
        }
コード例 #5
0
        public override string Command(Bomb bomb, string command)
        {
            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.IsNumber(word))
                {
                    Quantity = InternalFunctions.GetNumber(word);
                }
                if (InternalFunctions.IsColor(word))
                {
                    Color = word;
                }
            }
            if (Quantity == 0 || string.IsNullOrEmpty(Color))
            {
                return("Cannot find quantity and color");
            }

            return(Solve(bomb));
        }
コード例 #6
0
ファイル: Screw.cs プロジェクト: 1537592846/ktane-bomb-manual
        public override string Command(Bomb bomb, string command)
        {
            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.IsColor(word))
                {
                    Colors.Add(word);
                }
                if (InternalFunctions.GetLetterFromPhoneticLetter(word) != "")
                {
                    Buttons.Add(word);
                }
            }

            if (Colors.Count != 6)
            {
                return("Not enough colors.");
            }

            return(Solve(bomb));
        }
コード例 #7
0
        public override string Command(Bomb bomb, string command)
        {
            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.IsColor(word))
                {
                    Color = word;
                }

                if (InternalFunctions.IsNumber(word))
                {
                    Volume = InternalFunctions.GetNumber(word);
                }
            }

            if (string.IsNullOrEmpty(Color))
            {
                return("Could not identify solution.");
            }
            return(Solve(bomb));
        }
コード例 #8
0
        public override string Command(Bomb bomb, string command)
        {
            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.IsColor(word))
                {
                    StageColor = word;
                }
                if (InternalFunctions.IsPhoneticLetter(word))
                {
                    if (string.IsNullOrWhiteSpace(FirstLetter))
                    {
                        FirstLetter = word; continue;
                    }
                    if (string.IsNullOrWhiteSpace(SecondLetter))
                    {
                        SecondLetter = word; continue;
                    }
                    if (string.IsNullOrWhiteSpace(ThirdLetter))
                    {
                        ThirdLetter = word; continue;
                    }
                    if (string.IsNullOrWhiteSpace(FourthLetter))
                    {
                        FourthLetter = word; continue;
                    }
                }
            }

            if (!string.IsNullOrWhiteSpace(StageColor) && !string.IsNullOrWhiteSpace(FirstLetter) && !string.IsNullOrWhiteSpace(SecondLetter) && !string.IsNullOrWhiteSpace(ThirdLetter) && !string.IsNullOrWhiteSpace(FourthLetter))
            {
                return(Solve(bomb));
            }
            else
            {
                return("Cannot resolve, try again.");
            }
        }