public AssignmentConstraint Assign(AssignmentConstraint inAssignmentConstraint)
 {
     mAllowedValues.Clear();
     foreach (int number in inAssignmentConstraint.mAllowedValues.Keys)
         mAllowedValues.Add(number, number);
     return this;
 }
 public AssignmentConstraint IntersectWith(AssignmentConstraint inAssignmentConstraint)
 {
     int[] allowedValues = new int[mAllowedValues.Keys.Count];
     mAllowedValues.Keys.CopyTo(allowedValues, 0);
     mAllowedValues.Clear();
     foreach (int number in allowedValues)
         if(inAssignmentConstraint.mAllowedValues.ContainsKey(number))
             mAllowedValues.Add(number, number);
     return this;
 }
 public bool Init(
     Board inBoard,
     AssignmentConstraint[] inConstraints,
     int inConstraintsCount
 )
 {
     if (inBoard.IsAvailable(mCellColumn, mCellRow))
     {
         if(inConstraintsCount > 0)
         {
             Assign(inConstraints[0]);
             for (int i = 1; i < inConstraintsCount; ++i)
                 IntersectWith(inConstraints[i]);
         }
         return (0 < mAllowedValues.Count);
     }
     else
         return true;
 }
        private bool SetupCellConstraints(bool inEnforceDiagonalConstraints)
        {
            bool statusOK = true;
            int k;
            AssignmentConstraint[] thisCellConstraints = new AssignmentConstraint[5];

            if (inEnforceDiagonalConstraints)
            {
                for (int i = 0; i < 9 && statusOK; ++i)
                    for (int j = 0; j < 9 && statusOK; ++j)
                    {
                        thisCellConstraints[0] = ThreeByTreeBlockConstraints[i / 3, j / 3];
                        thisCellConstraints[1] = ColumnsConstraints[i];
                        thisCellConstraints[2] = RowsConstraints[j];
                        k = 3;
                        if (i == j)
                            thisCellConstraints[k++] = TopToBottomDiagonalConstraint;
                        if (i == 8 - j)
                            thisCellConstraints[k++] = mBottomToTopDiagonalConstraint;
                        statusOK = CellsConstraints[i, j].Init(mBoard, thisCellConstraints, k);
                    }

            }
            else
            {
                for (int i = 0; i < 9 && statusOK; ++i)
                    for (int j = 0; j < 9 && statusOK; ++j)
                    {
                        thisCellConstraints[0] = ThreeByTreeBlockConstraints[i / 3, j / 3];
                        thisCellConstraints[1] = ColumnsConstraints[i];
                        thisCellConstraints[2] = RowsConstraints[j];
                        statusOK = CellsConstraints[i, j].Init(mBoard, thisCellConstraints,3);
                    }
            }
            return statusOK;
        }