Ejemplo n.º 1
0
 private Sequence(Sequence parent, WordTree wordTree, int row, int col)
 {
     _puzzle   = parent._puzzle;
     _wordTree = wordTree;
     _parent   = parent;
     _row      = row;
     _col      = col;
     Length    = parent.Length + 1;
 }
Ejemplo n.º 2
0
 public Sequence(Puzzle puzzle, WordTree wordTree)
 {
     _puzzle   = puzzle;
     _wordTree = wordTree;
     _parent   = null;
     _row      = -1;
     _col      = -1;
     _toString = string.Empty;
     Length    = 0;
 }
Ejemplo n.º 3
0
        private void Add(string word, int index)
        {
            if (index == word.Length)
            {
                IsWord = true;
                return;
            }

            char c = char.ToUpperInvariant(word[index]);

            if (!_children.TryGetValue(c, out var child))
            {
                child        = new WordTree();
                _children[c] = child;
            }

            child.Add(word, index + 1);
        }
Ejemplo n.º 4
0
 public Solver(WordTree wordTree)
 {
     _wordTree = wordTree ?? throw new ArgumentNullException(nameof(wordTree));
 }