예제 #1
0
        public void DefinePosition3()
        {
            int column = InternalFunctions.GetNumberFromLetter(InternalFunctions.GetLetterFromPhoneticLetter(Positions[2].Split('-')[0])) - 1;
            int row    = int.Parse(Positions[2].Split('-')[1]) - 1;

            int count = 0;

            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    if (Chessboard[i, j].Piece == "rook")
                    {
                        count++;
                    }
                }
            }

            if (count < 2)
            {
                Chessboard[row, column].Piece = "queen";
            }
            else
            {
                Chessboard[row, column].Piece = "king";
            }

            ChangeOtherTiles(row, column, Chessboard[row, column].Piece);
        }
예제 #2
0
        public override string Command(Bomb bomb, string command)
        {
            var row    = -1;
            var column = -1;

            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.GetLetterFromPhoneticLetter(word) != "")
                {
                    column = InternalFunctions.GetNumberFromLetter(InternalFunctions.GetLetterFromPhoneticLetter(word)) - 1;
                }
                if (InternalFunctions.IsNumber(word))
                {
                    row = int.Parse(word) - 1;
                }
                if (row != -1 && column != -1)
                {
                    Positions.Add(InternalFunctions.GetPhoneticLetterFromLetter(InternalFunctions.GetLetterFromNumber(column + 1)) + '-' + (row + 1));
                    row    = -1;
                    column = -1;
                }
            }

            return(Solve(bomb));
        }
예제 #3
0
        public void DefinePosition4()
        {
            int column = InternalFunctions.GetNumberFromLetter(InternalFunctions.GetLetterFromPhoneticLetter(Positions[3].Split('-')[0])) - 1;
            int row    = int.Parse(Positions[3].Split('-')[1]) - 1;

            Chessboard[row, column].Piece = "rook";

            ChangeOtherTiles(row, column, Chessboard[row, column].Piece);
        }
        public override string Command(Bomb bomb, string command)
        {
            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.GetLetterFromPhoneticLetter(word) != "")
                {
                    Letters.Add(InternalFunctions.GetLetterFromPhoneticLetter(word).ToLower());
                }
            }

            return(Solve(bomb));
        }
        public override string Command(Bomb bomb, string command)
        {
            if (command.Contains("serial"))
            {
                foreach (var word in command.Split(' '))
                {
                    Serial += InternalFunctions.GetLetterFromPhoneticLetter(word).ToUpper();
                    Serial += InternalFunctions.GetNumber(word) == -1 ? "" : InternalFunctions.GetNumber(word).ToString();
                }
                return("Serial added.");
            }
            if (command.Contains("type"))
            {
                if (command.Contains("strk"))
                {
                    Type = "STRK";
                }
                if (command.Contains("leds"))
                {
                    Type = "LEDS";
                }
                if (command.Contains("cntd"))
                {
                    Type = "CNTD";
                }
                if (command.Contains("expl"))
                {
                    Type = "EXPL";
                }

                if (Type != "")
                {
                    return("Type added.");
                }
            }
            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.IsNumber(word))
                {
                    if (command.Contains("pins"))
                    {
                        PinQuantity = InternalFunctions.GetNumber(word);
                        return("Pin quantity added.");
                    }
                    else
                    {
                        PinNumber = InternalFunctions.GetNumber(word);
                        return(Solve(bomb));
                    }
                }
            }
            return("Cannot resolve, try again.");
        }
예제 #6
0
        public void DefinePosition5()
        {
            int column = InternalFunctions.GetNumberFromLetter(InternalFunctions.GetLetterFromPhoneticLetter(Positions[4].Split('-')[0])) - 1;
            int row    = int.Parse(Positions[4].Split('-')[1]) - 1;

            if (Chessboard[row, column].WhiteSpace)
            {
                Chessboard[row, column].Piece = "queen";
            }
            else
            {
                Chessboard[row, column].Piece = "rook";
            }

            ChangeOtherTiles(row, column, Chessboard[row, column].Piece);
        }
예제 #7
0
        public void DefinePosition2(bool bombSerialIsOdd)
        {
            int column = InternalFunctions.GetNumberFromLetter(InternalFunctions.GetLetterFromPhoneticLetter(Positions[1].Split('-')[0])) - 1;
            int row    = int.Parse(Positions[1].Split('-')[1]) - 1;

            if (bombSerialIsOdd)
            {
                Chessboard[row, column].Piece = "rook";
            }
            else
            {
                Chessboard[row, column].Piece = "knight";
            }

            ChangeOtherTiles(row, column, Chessboard[row, column].Piece);
        }
예제 #8
0
        public void DefinePosition1()
        {
            int column  = InternalFunctions.GetNumberFromLetter(InternalFunctions.GetLetterFromPhoneticLetter(Positions[0].Split('-')[0])) - 1;
            int row     = int.Parse(Positions[0].Split('-')[1]) - 1;
            int column5 = InternalFunctions.GetNumberFromLetter(InternalFunctions.GetLetterFromPhoneticLetter(Positions[4].Split('-')[0])) - 1;
            int row5    = int.Parse(Positions[4].Split('-')[1]) - 1;

            if (Chessboard[row5, column5].Piece == "queen")
            {
                Chessboard[row, column].Piece = "king";
            }
            else
            {
                Chessboard[row, column].Piece = "bishop";
            }

            ChangeOtherTiles(row, column, Chessboard[row, column].Piece);
        }
예제 #9
0
        public override string Command(Bomb bomb, string command)
        {
            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.IsNumber(word))
                {
                    Numbers.Add(InternalFunctions.GetNumber(word));
                }
                if (InternalFunctions.IsPhoneticLetter(word))
                {
                    Letters.Add(InternalFunctions.GetLetterFromPhoneticLetter(word));
                }
            }

            if (Letters.Count != 5)
            {
                return("Not enought phonetic letters.");
            }

            return(Solve(bomb));
        }
예제 #10
0
        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));
        }
예제 #11
0
        public override string Command(Bomb bomb, string command)
        {
            foreach (var word in command.Split(' '))
            {
                if (InternalFunctions.GetLetterFromPhoneticLetter(word) != "")
                {
                    if (string.IsNullOrWhiteSpace(FirstLetter))
                    {
                        FirstLetter = InternalFunctions.GetLetterFromPhoneticLetter(word);
                    }
                    else
                    {
                        SecondLetter = InternalFunctions.GetLetterFromPhoneticLetter(word);
                    }
                }
            }

            if (string.IsNullOrWhiteSpace(FirstLetter) || string.IsNullOrWhiteSpace(SecondLetter))
            {
                return("Missing letter.");
            }
            return(Solve(bomb));
        }
예제 #12
0
        public void DefinePosition6()
        {
            int column      = InternalFunctions.GetNumberFromLetter(InternalFunctions.GetLetterFromPhoneticLetter(Positions[5].Split('-')[0])) - 1;
            int row         = int.Parse(Positions[5].Split('-')[1]) - 1;
            int queenCount  = 0;
            int knightCount = 0;

            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    if (Chessboard[i, j].Piece == "queen")
                    {
                        queenCount++;
                    }
                    if (Chessboard[i, j].Piece == "knight")
                    {
                        knightCount++;
                    }
                }
            }

            if (queenCount == 0)
            {
                Chessboard[row, column].Piece = "queen";
            }
            else if (knightCount == 0)
            {
                Chessboard[row, column].Piece = "knight";
            }
            else
            {
                Chessboard[row, column].Piece = "bishop";
            }

            ChangeOtherTiles(row, column, Chessboard[row, column].Piece);
        }
예제 #13
0
        public void AddLetters(string input)
        {
            if (input.Contains("first"))
            {
                Group1.Clear();
                foreach (var phoneticLetter in input.Split(' '))
                {
                    var letter = InternalFunctions.GetLetterFromPhoneticLetter(phoneticLetter);
                    if (!string.IsNullOrEmpty(letter))
                    {
                        Group1.Add(letter);
                    }
                }

                Group2.Clear();
                Group3.Clear();
                Group4.Clear();
                Group5.Clear();

                Group2.Add(" ");
                Group3.Add(" ");
                Group4.Add(" ");
                Group5.Add(" ");

                return;
            }

            if (input.Contains("second"))
            {
                Group2.Clear();
                foreach (var phoneticLetter in input.Split(' '))
                {
                    var letter = InternalFunctions.GetLetterFromPhoneticLetter(phoneticLetter);
                    if (!string.IsNullOrEmpty(letter))
                    {
                        Group2.Add(letter);
                    }
                }

                Group3.Clear();
                Group4.Clear();
                Group5.Clear();

                Group3.Add(" ");
                Group4.Add(" ");
                Group5.Add(" ");

                return;
            }

            if (input.Contains("third"))
            {
                Group3.Clear();
                foreach (var phoneticLetter in input.Split(' '))
                {
                    var letter = InternalFunctions.GetLetterFromPhoneticLetter(phoneticLetter);
                    if (!string.IsNullOrEmpty(letter))
                    {
                        Group3.Add(letter);
                    }
                }

                Group4.Clear();
                Group5.Clear();

                Group4.Add(" ");
                Group5.Add(" ");

                return;
            }

            if (input.Contains("fourth"))
            {
                Group4.Clear();
                foreach (var phoneticLetter in input.Split(' '))
                {
                    var letter = InternalFunctions.GetLetterFromPhoneticLetter(phoneticLetter);
                    if (!string.IsNullOrEmpty(letter))
                    {
                        Group4.Add(letter);
                    }
                }

                Group5.Clear();

                Group5.Add(" ");

                return;
            }

            if (input.Contains("fifth") || input.Contains("last"))
            {
                Group5.Clear();
                foreach (var phoneticLetter in input.Split(' '))
                {
                    var letter = InternalFunctions.GetLetterFromPhoneticLetter(phoneticLetter);
                    if (!string.IsNullOrEmpty(letter))
                    {
                        Group5.Add(letter);
                    }
                }
                return;
            }
        }