Пример #1
0
        public static void WriteTest(WordShuffler.WordShuffler w, int size)
        {
            var model = w.GetNextModel();

            Console.WriteLine("-------------RESULT--------------\n");

            var matrix = model.Matrix.GetMatrix();

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    Console.Write(" [" + matrix[i, j] + "] ");
                }
                Console.WriteLine();
            }
            Console.WriteLine("--------------------------------------\n");

            foreach (var word in model.MatrixWords)
            {
                var pathString = "";

                foreach (var charCoordinate in word.Path)
                {
                    pathString += charCoordinate.ToString() + ", ";
                }
                pathString = pathString.Substring(0, pathString.Length - 2);


                Console.WriteLine(word.Word + "|" + pathString);
            }
            Console.WriteLine("--------------------------------------\n");
        }
Пример #2
0
        public void LoadDictionary()
        {
            System.Collections.Generic.List <string> list = new List <string>(tenthousand.tenthousandwords.Keys);

            System.Collections.Generic.List <string> listlong = new     List <string>(longwords2.longset);

            Dictionary = new WordShuffler.WordShuffler(list, size, listlong);
        }
Пример #3
0
        static void Main(string[] args)
        {
            const int size = 5;

            var w = new WordShuffler.WordShuffler("Res/wordsEn.txt", size);

            var esc = false;

            while (!esc)
            {
                Console.WriteLine("Press a key for new shuffle!");
                var key = Console.ReadKey();
                w.GetNextModel();
                WriteTest(w, size);

                if (key.Key == ConsoleKey.Escape)
                {
                    esc = true;
                }
            }
        }
Пример #4
0
        void b_generate_Click(object sender, RoutedEventArgs e)
        {
            char[,] currentMatrix = GenerateDummyMatrix();

            int currSizeInt = -1;
            var currSizeStr = tb_size.Text;

            if (int.TryParse(currSizeStr, out currSizeInt))
            {
                if (_currentSize != currSizeInt || _wordShuffler == null)
                {
                    _currentSize  = currSizeInt;
                    _wordShuffler = new WordShuffler.WordShuffler(wordsListPath, _currentSize);
                }

                _currentShuffleModel = _wordShuffler.GetNextModel(currentMatrix);
            }
            else
            {
                _currentShuffleModel = _wordShuffler.GetNextModel(currentMatrix);
            }

            printResult();
        }