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(); }
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); } }
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); }
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); }