Exemplo n.º 1
0
        public string SelectWord(WordSet wordSet)
        {
            ICollection <string> values  = wordSet.mWords.Keys;
            List <string>        valList = new List <string>(values);

            Random rand = new Random();
            string randomKey;

            do
            {
                randomKey = valList[rand.Next(valList.Count)];
            } while (randomKey.Length < 6);

            return(randomKey);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method that copies existing dictionary into a new one with different language.
        /// </summary>
        /// <param name="inputWordSet">Taken set of words</param>
        /// <param name="newLanguage">Language which dictionary is created for</param>
        /// <returns></returns>
        private WordSet CreateCopy(WordSet inputWordSet, Language newLanguage)
        {
            var output = new WordSet(newLanguage);

            output.mWords    = inputWordSet.mWords.Copy();
            output.mLanguage = newLanguage;
            List <string> list = new List <string>();

            foreach (var word in output.mWords)
            {
                list.Add(word.Key);
            }
            foreach (var word in list)
            {
                output.mWords[word] = "";
            }


            return(output);
        }
Exemplo n.º 3
0
 public TestGenerator(ITestAdapter model, WordSet wordSet)
 {
     mTestModel = model;
     mWordSet   = wordSet;
     mSelector  = new WordSelector(new EasyModeWordSelectionStrategy(), wordSet);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Method that copies existing dictionary into a new one with different language.
 /// </summary>
 /// <param name="language">Language which dictionary is created for</param>
 /// <param name="input">Copied WordSet</param>
 /// <returns>New Dictionary of words</returns>
 public WordSet CreateFromCopy(Language language, WordSet input)
 {
     return(CreateCopy(input, language));
 }
Exemplo n.º 5
0
 public WordSelector(IWordSelectionStrategy strategy, WordSet wordSet)
 {
     mStrategy = strategy;
     mWordSet  = wordSet;
 }