private bool SingleCandidatesInRow(int index) { IDictionary<int, CandidateHelper> unique = UniquePencilmarks(GetRow(index)); if(unique.Count == 0) { return false; } foreach (var item in unique) { int key = item.Key; CandidateHelper value = unique[key]; AssignCell(index, value.Coordinates.X, key); } return true; }
private static IDictionary<int, CandidateHelper> FilterUniques(IDictionary<int, CandidateHelper> c) { Dictionary<int, CandidateHelper> unique = new Dictionary<int, CandidateHelper>(); foreach (var kvp in c) { int key = kvp.Key; CandidateHelper value = c[key]; if (value.Count == 1) { unique.Add(key, value); } } return unique; }
private bool SingleCandidatesInArea(int index) { IDictionary<int, CandidateHelper> unique = UniquePencilmarks(GetArea(index)); if (unique.Count == 0) { return false; } int deltaX; int deltaY; GetAreaCoordinates(index, out deltaX, out deltaY); foreach (var item in unique) { int key = item.Key; CandidateHelper value = unique[key]; AssignCell(deltaY + value.Coordinates.Y, deltaX + value.Coordinates.X, key); } return true; }
internal CandidateHelper(CandidateHelper h) : this(h.Count + 1, h.Coordinates.X, h.Coordinates.Y) { }