Example #1
0
        public void Process(AppProperties props)
        {
            props.WordList = _fileUtility.FileToList(props.FilePath);
            props.WordList.Remove(props.StartWord);

            _outputPath = props.ResultPath;

            _currentNodes = new List <Node>();
            _currentNodes.Add(new Node()
            {
                IsStartNode = true, Word = props.StartWord
            });

            _nodeProcessor.OnComplete += OnPuzzleCompleted;

            Stopwatch sw = new Stopwatch();

            sw.Start();
            int iterations = 0;

            while (!_goalReached)
            {
                iterations++;
                if (_currentNodes.Count == 0)
                {
                    Console.WriteLine("No route was found :(");
                    break;
                }

                _goalReached = _nodeProcessor.ProcessNodes(_currentNodes, props);

                if (!_goalReached)
                {
                    _nodeProcessor.AdvanceCurrentNodes(_currentNodes);
                }
                else
                {
                    break;
                }
            }

            sw.Stop();
            _timeTaken = sw.Elapsed;
            Console.WriteLine($"Puzzle complete in {_timeTaken.ToString(@"mm\:ss\:fff")}");
            Console.WriteLine("File out put to : " + props.ResultPath);
        }
Example #2
0
        public void LoadFile_All4LetterWords_ListNotNull()
        {
            all4LetterWords = _fileUtility.FileToList(@"C:\Users\lsall\Downloads\Blue Prism\words-english.txt");

            Assert.IsNotNull(all4LetterWords);
        }