Пример #1
0
 public void TestFullCandidateValues()
 {
     _puzzle = new cPuzzle();
     for (int row = 0; row < g.SIZE; row++)
     {
         for (int col = 0; col < g.SIZE; col++)
         {
             Assert.AreEqual(sumOfCellCandidate(_puzzle.Grid[row][col]), 45, "Cell Candidates were not correctly refilled");
         }
     }
 }
Пример #2
0
 public void CandidateRemoveTest()
 {
     _puzzle = new cPuzzle();
     for (int loopN = 1; loopN <= g.SIZE; loopN++)
     {
         for (int r = 0; r < g.SIZE; r++)
         {
             for (int c = 0; c < g.SIZE; c++)
             {
                 _puzzle.Grid[r][c].RefillCandidates();
                 Assert.AreEqual(sumOfCellCandidate(_puzzle.Grid[r][c]), 45, "Cell Candidates were not correctly refilled");
             }
         }
         RemoveAllExcept(loopN);
         Assert.AreEqual(81 * loopN, SumOfCandidates(), "Incorrect Candidate Sum.");
     }
 }
Пример #3
0
        static void Main(string[] args)
        {
            int seed = 1;

            if (args.Count() > 0)
            {
                seed = int.Parse(args[0]);
                g.Banner($"Using seed {seed}");
            }
            else
            {
                g.Banner($"Using default seed: {seed}.");
            }

            cPuzzle puzzle = new cPuzzle();

            if (puzzle.BuildPuzzle(seed))
            {
                puzzle.PrintPuzzle();
            }
        }