示例#1
0
        public Game(User user1, User user2)
        {
            this.Id    = Guid.NewGuid().ToString();
            this.User1 = user1;
            this.User1.CurrentGameId = this.Id;
            this.User2 = user2;
            this.User2.CurrentGameId = this.Id;

            this.currentChar = dictionary.GetNode();
        }
示例#2
0
        public void AddWord(string word)
        {
            int          wordLength = word.Length;
            DictTreeNode node       = this.Nodes[word[0]];

            node.RefreshWordLength(wordLength);
            for (int i = 1; i < wordLength; i++)
            {
                node = node.AddChild(word[i]);
                node.RefreshWordLength(wordLength);
            }
        }
示例#3
0
        public DictTreeNode AddChild(char symbol)
        {
            DictTreeNode childNode;

            if (this.Childs.TryGetValue(symbol, out childNode))
            {
                return(childNode);
            }

            childNode = new DictTreeNode(symbol);
            this.Childs.Add(symbol, childNode);
            return(childNode);
        }
示例#4
0
        public bool?ValidateStep(char lastChar)
        {
            DictTreeNode newCharNode = this.currentChar.GetChild(lastChar);

            if (newCharNode == null)
            {
                return(false);
            }

            this.currentChar = newCharNode;
            if (this.currentChar.ChildCount > 0)
            {
                return(true);
            }
            return(null);
        }