Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var secretAgent = new FindSecretAgent();
            var result      = secretAgent.StartSearch(new[] { 1, 2, 3, 4, 4 });

            Console.WriteLine(result);
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            FindSecretAgent findSecretAgent = new FindSecretAgent();

            IEnumerable <int> soldiers = new List <int>()
            {
                1, 5, 6, 4, 9, 2, 22, 13, 4, 0
            };

            Console.WriteLine(findSecretAgent.StartSearch(soldiers));

            Console.WriteLine("Press any key to close");
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        private static void Main(string[] args)
        {
            //Add agentFinder instance
            var agentFinder = new FindSecretAgent();

            //Create list of Agents
            IEnumerable <int> agentLineup = new List <int> {
                1, 3, 5, 6, 7, 8, 5, 22, 34
            };

            //SecretAgentID stores the identity that the secret agent is imposing as + (added timing operation)
            var before        = DateTime.Now;
            var secretAgentID = agentFinder.StartSearch(agentLineup);
            var after         = DateTime.Now;

            Console.WriteLine($"One of the two Agents, who goes by number {secretAgentID} is working for the opposition!");
            Console.WriteLine("Found him in: " + (before - after));



            Console.ReadLine();
        }