Example #1
0
        private string MorseCodeGameRows(RandomizeMorseCodeGame mcg)
        {
            StringBuilder MorseCodeGamesb      = new StringBuilder();
            string        MorseCodeGameHeading = "Morse Code Game \n\n";
            string        MorseCodeGameHead    = "{Word} -> {Character to enter}\n";

            MorseCodeGamesb.Append("\n");
            MorseCodeGamesb.Append(MorseCodeGameHeading);
            MorseCodeGamesb.Append(MorseCodeGameHead);

            for (int i = 0; i < mcg.Words.Count; i++)
            {
                string word  = mcg.Words[i].ToUpper();
                int    index = mcg.Indexes[i];

                MorseCodeGamesb.Append($"{word} -> {Converter.DecToHex(index)} \n");
            }

            return(MorseCodeGamesb.ToString());
        }
Example #2
0
        private List <char> FormatData(RandomizeButtonGame bg, RandomizeMorseCodeGame mcg, RandomizeSimonSaysGame ssg)    // format data for Arduino
        {
            List <char> rows = new List <char>();

            char[] word = mcg.Word.ToArray();

            // <----- Button Game -----> //

            char color = colors[bg.Index];
            char digit = Converter.DecToHex(bg.TimeValues[bg.Index]);

            rows.Add(color);  // pick the chosen color
            rows.Add(digit);  // pick the chosen digit

            // <------ Morse Code -----> //

            char index = Converter.DecToHex(mcg.Indexes[mcg.IntIndex]);

            rows.Add(index);                      // add MCG index of the word

            for (int i = 0; i < word.Length; i++) // add MCG word as seperate rows
            {
                rows.Add(word[i]);
            }

            // <------ Simon Says -----> //

            for (int i = 0; i < ssg.Nums.Count; i++)
            {
                char currentNum = Converter.DecToHex(ssg.Nums[i]);
                rows.Add(currentNum);
            }

            for (int i = 0; i < ssg.Sequence.Count; i++)
            {
                char currentElement = Converter.DecToHex(ssg.Sequence[i]);
                rows.Add(currentElement);
            }

            return(rows);
        }