public SudokuSet Trim() { SudokuSet newSet = new SudokuSet(Index); foreach (SNode sNode in this) { if (!sNode.IsSolved) { newSet.Add(sNode); } } return(newSet); }
} // NakedSingle() /// <summary> /// Finds Pointing Pairs. /// </summary> /// <returns></returns> private static bool PointingPair() { foreach (Box box in board.Boxes) { SudokuSet shrunkenBox = box.Trim(); foreach (int value in sudokuNumbers) { OrderedSet <Row> rows = new OrderedSet <Row>(); OrderedSet <Column> cols = new OrderedSet <Column>(); foreach (SNode sNode in shrunkenBox) { if (sNode.Possibles.Contains(value)) { rows.Add(sNode.Row); cols.Add(sNode.Column); } } bool boardUpdated = false; if (rows.Count == 1) { Row row = rows[0]; foreach (SNode sNode in row) { if (sNode.Box != box && sNode.Possibles.Contains(value)) { sNode.Possibles.Remove(value); boardUpdated = true; } } } if (cols.Count == 1) { Column column = cols[0]; foreach (SNode sNode in column) { if (sNode.Box != box && sNode.Possibles.Contains(value)) { sNode.Possibles.Remove(value); boardUpdated = true; } } } if (boardUpdated) { if (controller != null) { string output = "Updated board with Pointing Pair Reduction. " + value + " was used."; controller.PrintStatement(output); } return(true); } } } return(false); } // PointingPair() ** COVERED BY NAKED PAIR.....THIS TECHNIQUE IS STUPID!!!!!