示例#1
0
 Func <Hint, bool> HintIsAt(int selx, int sely)
 {
     return((Hint hint) =>
     {
         SudokuRequirement r = (SudokuRequirement)hint.Requirement;
         if (r != null)
         {
             return r.AppliesAt(selx, sely, this);
         }
         SudokuCandidate c = (SudokuCandidate)hint.Candidate;
         if (c != null)
         {
             return c.x == selx && c.y == sely;
         }
         return false;
     });
 }
示例#2
0
        static bool AppliesAt(Hint hint, int x, int y, SudokuGrid grid)
        {
            if (!(hint is ForcedMoveHint))
            {
                SudokuCandidate k = (SudokuCandidate)hint.Candidate;
                if (k != null)
                {
                    return(k.x == x && k.y == y);
                }
            }

            SudokuRequirement c = (SudokuRequirement)hint.Requirement;

            if (c != null)
            {
                return(c.AppliesAt(x, y, grid));
            }

            return(false);
        }