Esempio n. 1
0
        private bool ShowPossibles()
        {
            bool successful = false;

            SetLog("Show Possibles:\n");

            foreach (Cell solvedCell in Puzzle.SolvedCells)
            {
                HashSet <Cell> connectedCells = new HashSet <Cell>(
                    Puzzle.GetBlock(solvedCell)
                    .Concat(Puzzle.GetCage(solvedCell).Cells)
                    .Concat(Puzzle.GetColumn(solvedCell))
                    .Concat(Puzzle.GetRow(solvedCell))
                    .ToList()
                    );

                foreach (Cell connectedCell in connectedCells)
                {
                    int  toRemove         = solvedCell.Solution;
                    bool candidateRemoved = connectedCell.RemoveCandidate(toRemove);

                    if (candidateRemoved)
                    {
                        successful = true;
                        AppendLog(toRemove + " is removed from: " + connectedCell + "\n");
                    }
                }
            }
            return(successful);
        }