Пример #1
0
 public ComplicatedWires()
 {
     TextSynthesizer.Speak("complicated wires ok color");
     Recognizer.SetContext(new List <string> {
         "light", "red", "blue", "star", "empty"
     }, 1, 4);
 }
Пример #2
0
 public PasswordModule()
 {
     TextSynthesizer.Speak("password ok one");
     Recognizer.SetContext(new List <string> {
         "alfa", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "india", "juliet", "kilo", "lima", "mike", "november", "oscar", "papa", "quebec", "romeo", "sierra", "tango", "uniform", "victor", "whiskey", "x-ray", "yankee", "zulu"
     }, 6, 6);
 }
Пример #3
0
 public SimpleWires()
 {
     TextSynthesizer.Speak("wires ok sequence");
     Recognizer.SetContext(new List <string> {
         "blue", "red", "yellow", "white", "black"
     }, 3, 6);
 }
Пример #4
0
 public BombCheck()
 {
     Recognizer.SetContext(new List <string> {
         "snd", "clr", "car", "ind", "frq", "sig", "nsa", "msa", "trn", "bob", "frk", "on", "off", "batteries", "zero", "one", "two", "more", "finish", "number", "para"
     }, 1, 2);
     TextSynthesizer.Speak("bomb setup ok");
 }
Пример #5
0
 private void FourWires()
 {
     if (colors.Count(x => x.Contains("red")) > 1 && (!Converter.isSerialLastEven())) //more than one red and if last(5) digit of sn is odd
     {
         int num = (colors.LastIndexOf("red") + 1);
         TextSynthesizer.Speak(num.ToOrdinalWords() + " wire");
     }
     else if (colors.Last() == "yellow" && colors.Count(x => x.Contains("red")) == 0)
     {
         TextSynthesizer.Speak("first wire");
     }
     else if (colors.Count(x => x.Contains("blue")) == 1)
     {
         TextSynthesizer.Speak("first wire");
     }
     else if (colors.Count(x => x.Contains("yellow")) > 1)
     {
         TextSynthesizer.Speak("last wire");
     }
     else
     {
         TextSynthesizer.Speak("second wire");
     }
     Interpreter.IdleBomb();
 }
Пример #6
0
        private void SerialNumber(string text)
        {
            text = Converter.fixSerial(text);
            string        serial     = "";
            List <string> longSerial = text.Split(' ').ToList();

            foreach (string letter in longSerial)
            {
                try
                {
                    int i = Converter.ToInt(letter);
                    serial += i;
                }catch (Exception ex)
                {
                    string let = Converter.FromNATO(letter);
                    serial += let;
                }
            }
            if (serial.Length != 6)
            {
                TextSynthesizer.Speak("again");
                return;
            }
            TextSynthesizer.Speak(Converter.ToNATO(serial));
            Interpreter.serialNumber = serial;
            Recognizer.SetContext(new List <string> {
                "snd", "clr", "car", "ind", "frq", "sig", "nsa", "msa", "trn", "bob", "frk", "on", "off", "batteries", "zero", "one", "two", "more", "finish", "number", "para"
            }, 1, 2);
            serialnumber = false;
        }
Пример #7
0
        public Keypad()
        {
            columns = new Dictionary <int, List <string> >();
            TextSynthesizer.Speak("keypad ok sequence"); //sequence check keypad chars.png
            Recognizer.SetContext(new List <string> {
                "quebec", "alfa", "alpha", "lamp", "potter", "aliens", "hotel", "delta", "echo", "six", "papa", "wave", "empty", "full", "question", "copy", "whiskey", "bravo", "x-ray", "romeo", "face", "three", "free", "charlie", "puzzle", "letter", "candle", "november", "omega"
            }, 4, 4);

            columns[0] = new List <string> {
                "quebec", "alfa", "lamp", "potter", "aliens", "hotel", "delta"
            };
            columns[1] = new List <string> {
                "echo", "quebec", "delta", "wave", "empty", "hotel", "question"
            };
            columns[2] = new List <string> {
                "copy", "whiskey", "wave", "x-ray", "romeo", "lamp", "empty"
            };
            columns[3] = new List <string> {
                "six", "papa", "bravo", "aliens", "x-ray", "question", "face"
            };
            columns[4] = new List <string> {
                "candle", "face", "bravo", "charlie", "papa", "three", "full"
            };
            columns[5] = new List <string> {
                "six", "echo", "puzzle", "letter", "candle", "november", "omega"
            };
            columns[6] = new List <string> {
                "quebec", "alpha", "lamp", "potter", "aliens", "hotel", "delta"
            };                                                                                                 //variants speech
            columns[7] = new List <string> {
                "candle", "face", "bravo", "charlie", "papa", "free", "full"
            };
        }
Пример #8
0
        public override void Interpret(string text)
        {
            if (text == "reset")
            {
                letters = new List <string>();
                TextSynthesizer.Speak("reset");
                return;
            }
            string letter = FromMorse(text);

            if (letter == "er")
            {
                TextSynthesizer.Speak("again");
                return;
            }
            letters.Add(letter);
            TextSynthesizer.Speak(text);
            if (letters.Count == 5 || letters.Count == 6)
            {
                foreach (KeyValuePair <string, string> word in words)
                {
                    List <string> wor = word.Key.Select(c => c.ToString()).ToList();
                    if (areAnagram(letters, wor))
                    {
                        TextSynthesizer.Speak(Converter.ToNATO(word.Value));
                        Interpreter.IdleBomb();
                        return;
                    }
                }
            }
            if (letters.Count > 6)
            {
                TextSynthesizer.Speak("too many letters");
            }
        }
Пример #9
0
 public SimonSays()
 {
     TextSynthesizer.Speak("simon says ok sequence");
     Recognizer.SetContext(new List <string> {
         "blue", "red", "yellow", "green"
     }, 1, 10);
     SerialVowel();
 }
Пример #10
0
 public MorseModule()
 {
     TextSynthesizer.Speak("morse ok");
     Recognizer.SetContext(new List <string> {
         "short", "long", "reset"
     }, 1, 4);
     letters = new List <string>();
 }
Пример #11
0
 public WhoFirst()
 {
     TextSynthesizer.Speak("who's first ok display");
     Recognizer.SetContext(new List <string> {
         "empty", "alfa", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "india", "juliet", "kilo", "lima", "mike", "november", "oscar", "papa", "quebec", "romeo", "sierra", "tango", "uniform", "victor", "whiskey", "x-ray", "yankee", "zulu", "question"
     }, 1, 7);
     stageFirst = true;
 }
Пример #12
0
 public Maze()
 {
     TextSynthesizer.Speak("maze ok circle");
     Recognizer.SetContext(new List <string> {
         "one", "two", "three", "four", "five", "six"
     }, 2, 4);
     LoadMazes();
     stage = 0;
 }
Пример #13
0
 public SimpleButton()
 {
     TextSynthesizer.Speak("button ok color");
     Recognizer.SetContext(new List <string> {
         "blue", "red", "yellow", "white", "abort", "hold", "detonate", "press"
     }, 1, 1);
     colorlabel = true;
     colorb     = true;
 }
Пример #14
0
 Dictionary <int, string> positions; // number,pos
 public MemoryModule()
 {
     TextSynthesizer.Speak("memory ok display");
     Recognizer.SetContext(new List <string> {
         "one", "two", "three", "four"
     }, 1, 2);
     stage     = 1;
     readPos   = false;
     positions = new Dictionary <int, string>();
 }
Пример #15
0
 public SequentialWires()
 {
     TextSynthesizer.Speak("Sequential wires ok wire");
     Recognizer.SetContext(new List <string> {
         "blue", "red", "black", "ay", "be", "see"
     }, 2, 2);
     reds   = 0;
     blues  = 0;
     blacks = 0;
 }
Пример #16
0
 void Even()
 {
     if (Converter.isSerialLastEven())
     {
         TextSynthesizer.Speak("Cut");
     }
     else
     {
         TextSynthesizer.Speak("Don't");
     }
 }
Пример #17
0
 void Parallel()
 {
     if (Interpreter.parraler)
     {
         TextSynthesizer.Speak("Cut");
     }
     else
     {
         TextSynthesizer.Speak("Don't");
     }
 }
Пример #18
0
 void Batteries()
 {
     if (Interpreter.batteries >= 2)
     {
         TextSynthesizer.Speak("Cut");
     }
     else
     {
         TextSynthesizer.Speak("Don't");
     }
 }
Пример #19
0
        public Form1()
        {
            InitializeComponent();
            form        = this;
            mic         = new Microphone();
            syn         = new TextSynthesizer();
            speech      = new Recognizer();
            interpreter = new Interpreter();

            var keybaordHook = new KeyboardHook();

            keybaordHook.OnKeyPressed   += HotKeyManager_HotKeyPressed;
            keybaordHook.OnKeyUnpressed += HotKeyManager_HotKeyReleased;
        }
Пример #20
0
        public override void Interpret(string text)
        {
            string        word     = "";
            List <string> longText = text.Split(' ').ToList();

            foreach (string letter in longText)
            {
                string let = Converter.FromNATO(letter);
                word += let;
            }
            if (word.Length != 6)
            {
                TextSynthesizer.Speak("again");
                return;
            }
            letter++;
            if (letter >= 6)
            {
                TextSynthesizer.Speak("word not found");
                Interpreter.IdleBomb();
                return;
            }
            letters[letter - 1] = word;
            List <string> correctWords = new List <string>(words);

            foreach (string wor in words)
            {
                for (int i = 0; i < letters.Length; i++)
                {
                    if (letters[i] == null)
                    {
                        continue;
                    }
                    if (!letters[i].Contains(wor[i]))
                    {
                        correctWords.Remove(wor);
                    }
                }
            }
            if (correctWords.Count == 1)
            {
                TextSynthesizer.Speak(correctWords.First() + ", " + string.Join(", ", Converter.ToNATO(correctWords.First()).Split(' ')));
                Interpreter.IdleBomb();
            }
            else
            {
                TextSynthesizer.Speak("ok" + (letter + 1));
            }
        }
Пример #21
0
        public void ColumnFound(List <string> sequence, List <string> column)
        {
            SortedDictionary <int, string> ordered = new SortedDictionary <int, string>();

            foreach (string seq in sequence)
            {
                int curPos = column.IndexOf(seq);
                ordered[curPos] = seq;
            }
            string finished = "";

            foreach (KeyValuePair <int, string> letter in ordered)
            {
                finished += letter.Value + ", ";
                //TextSynthesizer.Speak(letter.Value);
            }
            TextSynthesizer.Speak(finished);
            Interpreter.IdleBomb();
        }
Пример #22
0
 private void FiveWires()
 {
     if (colors.Last() == "black" && (int.Parse(Interpreter.serialNumber[5].ToString()) % 2 == 1))
     {
         TextSynthesizer.Speak("fourth wire");
     }
     else if (colors.Count(x => x.Contains("red")) == 1 && colors.Count(x => x.Contains("yellow")) > 1)
     {
         TextSynthesizer.Speak("first wire");
     }
     else if (colors.Count(x => x.Contains("black")) == 0)
     {
         TextSynthesizer.Speak("second wire");
     }
     else
     {
         TextSynthesizer.Speak("first wire");
     }
     Interpreter.IdleBomb();
 }
Пример #23
0
 private void SixWires()
 {
     if (colors.Count(x => x.Contains("yellow")) == 0 && (int.Parse(Interpreter.serialNumber[5].ToString()) % 2 == 1))
     {
         TextSynthesizer.Speak("third wire");
     }
     else if (colors.Count(x => x.Contains("yellow")) == 1 && colors.Count(x => x.Contains("white")) > 1)
     {
         TextSynthesizer.Speak("fourth wire");
     }
     else if (colors.Count(x => x.Contains("red")) == 0)
     {
         TextSynthesizer.Speak("last wire");
     }
     else
     {
         TextSynthesizer.Speak("fourth wire");
     }
     Interpreter.IdleBomb();
 }
Пример #24
0
        public override void Interpret(string text)
        {
            text = Converter.fixSerial(text);
            List <string> sequence = text.Split(' ').ToList();

            if (sequence.Count != 4)
            {
                TextSynthesizer.Speak("again");
                return;
            }
            for (int i = 0; i < columns.Count; i++)
            {
                if (columns[i].ContainsAllItems(sequence))
                {
                    ColumnFound(sequence, columns[i]);
                    return;
                }
            }
            TextSynthesizer.Speak("again");
        }
Пример #25
0
        private void ThreeWires()
        {
            if (!colors.Contains("red"))
            {
                TextSynthesizer.Speak("second wire");
            }
            else if (colors.Last() == "white")
            {
                TextSynthesizer.Speak("last wire");
            }
            else if (colors.Count(x => x.Contains("blue")) > 1) //if there is more than one blu wire
            {
                int num = (colors.LastIndexOf("blue") + 1);     //last blue wire

                TextSynthesizer.Speak(num.ToOrdinalWords() + " wire");
            }
            else
            {
                TextSynthesizer.Speak("last wire");
            }
            Interpreter.IdleBomb();
        }
Пример #26
0
        public override void Interpret(string text)
        {
            colors = text.Split(' ').ToList();
            foreach (string color in colors) // check colors
            {
                if (!(new List <string> {
                    "blue", "red", "yellow", "white", "black"
                }.Any(color.Contains)))
                {
                    TextSynthesizer.Speak("again");
                    return;
                }
            }
            TextSynthesizer.Speak(string.Join(" ", colors.ToArray()) + " ok");
            switch (colors.Count)
            {
            case 3:
                ThreeWires();
                break;

            case 4:
                FourWires();
                break;

            case 5:
                FiveWires();
                break;

            case 6:
                SixWires();
                break;

            default:
                TextSynthesizer.Speak("again");
                return;
            }
        }
Пример #27
0
 void DontCut()
 {
     TextSynthesizer.Speak("Dont");
 }
Пример #28
0
 void Cut()
 {
     TextSynthesizer.Speak("Cut");
 }
Пример #29
0
        public override void Interpret(string text)
        {
            List <string> longText = text.Split(' ').ToList();

            if (longText.Count != 2)
            {
                TextSynthesizer.Speak("again");
                return;
            }
            if (!(new List <string> {
                "blue", "red", "black"
            }.Any(longText[0].Contains)))
            {
                TextSynthesizer.Speak("again");
                return;
            }
            if (!(new List <string> {
                "ay", "be", "see"
            }.Any(longText[1].Contains)))
            {
                TextSynthesizer.Speak("again");
                return;
            }
            if (longText[0] == "red")
            {
                reds++;
                switch (reds)
                {
                case 1:
                    if (longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 2:
                    if (longText[1] == "be")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 3:
                    if (longText[1] == "ay")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 4:
                    if (longText[1] == "ay" || longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 5:
                    if (longText[1] == "be")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 6:
                    if (longText[1] == "ay" || longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 7:
                    Cut();
                    break;

                case 8:
                    if (longText[1] == "ay" || longText[1] == "be")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 9:
                    if (longText[1] == "be")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;
                }
            }
            if (longText[0] == "blue")
            {
                blues++;
                switch (blues)
                {
                case 1:
                    if (longText[1] == "be")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 2:
                    if (longText[1] == "ay" || longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 3:
                    if (longText[1] == "be")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 4:
                    if (longText[1] == "ay")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 5:
                    if (longText[1] == "be")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 6:
                    if (longText[1] == "by" || longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 7:
                    if (longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 8:
                    if (longText[1] == "ay" || longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 9:
                    if (longText[1] == "ay")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;
                }
            }
            if (longText[0] == "black")
            {
                blacks++;
                switch (blacks)
                {
                case 1:
                    Cut();
                    break;

                case 2:
                    if (longText[1] == "ay" || longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 3:
                    if (longText[1] == "be")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 4:
                    if (longText[1] == "ay" || longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 5:
                    if (longText[1] == "be")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 6:
                    if (longText[1] == "be" || longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 7:
                    if (longText[1] == "ay" || longText[1] == "be")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 8:
                    if (longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;

                case 9:
                    if (longText[1] == "see")
                    {
                        Cut();
                    }
                    else
                    {
                        DontCut();
                    }
                    break;
                }
            }
        }
Пример #30
0
        public override void Interpret(string text)
        {
            if (colorlabel)
            {
                if (colorb)
                {
                    if (new List <string> {
                        "blue", "red", "yellow", "white"
                    }.Any(text.Contains))
                    {
                        color  = text;
                        colorb = false;
                        TextSynthesizer.Speak("ok label");
                    }
                    else
                    {
                        TextSynthesizer.Speak("again");
                    }
                }
                else
                {
                    if (new List <string> {
                        "abort", "hold", "detonate", "press"
                    }.Any(text.Contains))
                    {
                        label = text;
                        TextSynthesizer.Speak(color + " " + label + " ok");
                        colorb = true;
                        ButtonLogic();
                    }
                    else
                    {
                        TextSynthesizer.Speak("again");
                    }
                }
            }
            else
            {
                if (new List <string> {
                    "blue", "red", "yellow", "white"
                }.Any(text.Contains))
                {
                    switch (text)
                    {
                    case "blue":
                        TextSynthesizer.Speak("4 in any position");
                        break;

                    case "white":
                        TextSynthesizer.Speak("1 in any position");
                        break;

                    case "yellow":
                        TextSynthesizer.Speak("5 in any position");
                        break;

                    case "red":
                        TextSynthesizer.Speak("1 in any position");
                        break;
                    }
                    Interpreter.IdleBomb();
                }
                else
                {
                    TextSynthesizer.Speak("again");
                }
            }
        }