protected override void CreateRuleInformation() { int pmComplementMask = PencilmarkList.ToBitMask(); pmComplementMask = Mask.ForSettingPencilMarks(Board.Dimension) & ~pmComplementMask; int pmMaskList = 0; affectedCells.ForEach(cell => pmMaskList |= (cell.PMSignature & pmComplementMask)); List <int> pmList = pmMaskList.ListOfBits(); string csvPattern = CellsInCsvFormat(patternCells); string csvAffected = CellsInCsvFormat(affectedCells); string csvPencilmarks = PMsInCsvFormat(PencilmarkList); string csvOtherPMs = PMsInCsvFormat(pmList); bool multiCell = patternCells.Count > 1; bool multiPM = PencilmarkList.Count > 1; string cellPlurality = (multiCell) ? "s" : string.Empty; string cellArticle = (multiCell) ? "these" : "this"; string valuePlurality = (multiPM) ? "s" : string.Empty; string valueReference = (multiPM) ? "they do" : "it does"; string optionPlurality = (pmList.Count > 1) ? "s" : string.Empty; Solution.Description = string.Format("Hidden Values Rule: Cell{0} {1} must have value{2} {3}, since " + "{7} not appear anywhere else in the {8}. Therefore option{4} {5} can be removed from {6} cell{0}.", cellPlurality, csvPattern, valuePlurality, csvPencilmarks, optionPlurality, csvOtherPMs, cellArticle, valueReference, Coord.Name(LineCoordinate)); }
protected override void CalculateAffectedCells(List <Cell> line) { int pmMask = PencilmarkList.ToBitMask(); affectedCells = line.Except(patternCells) .Where(t => (t.PMSignature & pmMask) != 0) .ToList(); }
protected override void CalculateAffectedCells(List <Cell> line) { int pmMask = (Mask.ForSettingPencilMarks(Board.Dimension) & ~PencilmarkList.ToBitMask()); affectedCells = patternCells .Where(t => (t.PMSignature & pmMask) != 0) .ToList(); }
protected override int GetPencilmarkMask() { int returnValue = PencilmarkList.ToBitMask(); return(returnValue); }
protected override int GetPencilmarkMask() { int returnValue = (Mask.ForSettingPencilMarks(Board.Dimension) & ~PencilmarkList.ToBitMask()); return(returnValue); }