Пример #1
0
        private Dictionary <String, List <Vector2> > FindAllWordLocations(WordSearchPuzzle puzzle)
        {
            DirectionSearchFactory directionSearchFactory = new DirectionSearchFactory(puzzle);
            WordSearchAlgorithm    algorithm = new WordSearchAlgorithm(directionSearchFactory, puzzle.WordsList);

            return(algorithm.SearchEachWord());
        }
Пример #2
0
        static void Main(string[] args)
        {
            PuzzleFileParser    solver      = new PuzzleFileParser();
            WordSearchPuzzle    puzzle      = solver.ParseFileToWordSearchPuzzle(args[0]);
            WordsLocationFinder wordsFinder = new WordsLocationFinder(puzzle);
            WordsMapDecorator   wordsMap    = wordsFinder.GetWordsMap();

            Console.WriteLine(wordsMap.ToString());
        }
Пример #3
0
        public WordSearchPuzzle ParseFileToWordSearchPuzzle(String fileName)
        {
            puzzle = new WordSearchPuzzle();
            String[] lines = File.ReadAllLines(fileName);
            ParseWordsIntoPuzzle(lines[WORD_ROW_INDEX]);

            String[] rawLetters = new String[lines.Length - NUMBER_OF_WORD_ROWS];
            Array.Copy(lines, LETTER_ROW_FIRST_INDEX, rawLetters, MIN_DIMENSION_INDEX, lines.Length - NUMBER_OF_WORD_ROWS);
            ParseLettersIntoPuzzle(rawLetters);

            return(puzzle);
        }
Пример #4
0
 public WordsLocationFinder(WordSearchPuzzle puzzle)
 {
     wsPuzzle = puzzle;
 }