/// <summary> /// Constructor /// </summary> /// <param name="parentGrid">The parent grid for the node</param> /// <param name="letter">The letter enum used for the node</param> /// <param name="isMandatory">Is the node required to be used in word searches</param> /// <param name="restriction">The restrictions on the use of this node</param> public GridNode(LetterGrid parentGrid, LetterUtil.Letter letter, bool isMandatory, PositionRestriction restriction) { ParentGrid = parentGrid; Letter = letter; AdjacentNodes = new List <GridNode>(); IsMandatory = isMandatory; Restriction = restriction; LetterLength = LetterUtil.GetLetterLength(Letter); if (ParentGrid.Options.IsAnagram) { IsMandatory = true; } }
/// <summary> /// Convenience constructor to go straight from a button /// </summary> /// <param name="parentGrid">The parent grid for the node</param> /// <param name="button">The button to convert</param> public GridNode(LetterGrid parentGrid, LetterButton button) : this(parentGrid, button.SelectedLetter, button.IsRequired, button.Restriction) { }