public Board MakeMove(Move move) { int row = (int)move.Row; int column = (int)move.Column; _BoardValues[column, row] = move.Value; //int bit = (int) move.Value; if ((_RowValues[row] & move.Value) == move.Value) throw new ArgumentException( string.Format("Invalid move {2}.\nNumber {0}. \nAlready present in row {1}\n{3}", move.Value, move.Row, move.ToString(), this.ToString() )); if ((_ColumnValues[column] & move.Value) == move.Value) throw new ArgumentException( string.Format("Invalid move {2}.\nNumber {0} already present in column {1}\n{3}", move.Value, move.Column, move.ToString(), this.ToString() )); if ((_RegionValues[column / 3, row / 3] & move.Value) == move.Value) throw new ArgumentException( string.Format("Invalid move {1}.\nNumber {0} already present in this region\n{2}", move.Value, move.ToString(), this.ToString() )); _RowValues[row] |= move.Value; _ColumnValues[column] |= move.Value; _RegionValues[column / 3, row / 3] |= move.Value; _EmptySquaresCount--; return this; }