def FillinSingleCandidatesStep(self): """ Look for cells with only 1 candidate and fill them in. Updates the candidates after finished """ self.ClearHighlights() dups = sd.FindDuplicates(self.currBoard) if sd.CheckValid(dups): prevBoard = deepcopy(self.currBoard) changed, self.currBoard, self.candBoard = sd.FillSingleCandidates( self.currBoard, self.candBoard) if changed: self.UpdateChangedCells(prevBoard) dups = sd.FindDuplicates(self.currBoard) if not sd.CheckValid(dups): print('Invalid') self.ShowInvalidCells(dups)
def FillinSingleCandidates(self): """ Look for cells with only 1 candidate and fill them in Then update candidates and iterate until no more changes """ self.ClearHighlights() dups = sd.FindDuplicates(self.currBoard) if sd.CheckValid(dups): notdone = True prevBoard = deepcopy(self.currBoard) while notdone: notdone, self.currBoard, self.candBoard = sd.FillSingleCandidates( self.currBoard, self.candBoard) self.UpdateChangedCells(prevBoard) dups = sd.FindDuplicates(self.currBoard) if not sd.CheckValid(dups): print('Invalid') self.ShowInvalidCells(dups)