Esempio n. 1
0
        protected override void DoRun()
        {
            PrimeTool tool = new PrimeTool(new SieveOfEratosthenesPrimeStrategy(100));

            TestPrimes(tool);
            tool.Strategy = new BruteForcePrimeStrategy();
            TestPrimes(tool);
        }
Esempio n. 2
0
 private void TestPrimes(PrimeTool tool)
 {
     Console.WriteLine($"Checking first 100 primes using {tool.Strategy.GetType()}");
     for (int x = 0; x <= 100; x++)
     {
         tool.CheckPrime(x);
     }
 }