public void SetBox(Board.Box box)
 {
     m_box = box;
 }
Exemple #2
0
    /// <summary>
    /// Find the place for the word and return it.
    /// </summary>
    /// <param name="usedChars"></param>
    /// <param name="usedBoardCharPlace"></param>
    /// <param name="box"></param>
    /// <returns></returns>
    private static Dictionary <Board.Box, Letter> CheckPlace(List <Letter> usedChars, int usedBoardCharPlace, Board.Box box)
    {
        var horizontalBoxes = Board.Instance.GetBoxesAroundHorizontal(box, usedBoardCharPlace, usedChars.Count - usedBoardCharPlace - 1);

        if (horizontalBoxes != null)
        {
            if (Board.Instance.CheckWordSpace(horizontalBoxes, box))
            {
                return(horizontalBoxes.Zip(usedChars, (k, v) => new { k, v }).ToDictionary(x => x.k, x => x.v));
            }
        }

        var verticalBoxes = Board.Instance.GetBoxesAroundVertical(box, usedBoardCharPlace, usedChars.Count - usedBoardCharPlace - 1);

        if (verticalBoxes != null)
        {
            if (Board.Instance.CheckWordSpace(verticalBoxes, box))
            {
                return(verticalBoxes.Zip(usedChars, (k, v) => new { k, v }).ToDictionary(x => x.k, x => x.v));
            }
        }

        return(null);
    }