Exemplo n.º 1
0
 static void Main(string[] args)
 {
     Player      p  = new ABCplayer();
     HumanPlayer p2 = new HumanPlayer();
     //Need to add in how to handle multi letter words like apple
     HangmanGame hg = new HangmanGame(p2);
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Player p  = new ABCplayer();
            Player p2 = new HumanPlayer();
            Player p3 = new BruteMan();
            Player p4 = new RandoMan();
            Player p5 = new _400IQMan();

            HangmanGame hg = new HangmanGame(p5);
        }
Exemplo n.º 3
0
 static void Main(string[] args)
 {
     Player      p  = new ABCplayer();
     HumanPlayer p2 = new HumanPlayer();
     Player      p3 = new Zplayer();
     Player      p4 = new BruteForcePlayer();
     Player      p5 = new RandomPlayer();
     Player      p6 = new SmartPlayer();
     //Need to add in how to handle multi letter words like apple
     HangmanGame hg = new HangmanGame(p2);
 }
Exemplo n.º 4
0
        static void Main(string[] args)


        {
            Player           p   = new ABCplayer();
            HumanPlayer      p2  = new HumanPlayer();
            RandomPlayer     r   = new RandomPlayer();      //not working
            BruteForcePlayer bfp = new BruteForcePlayer();
            //Need to add in how to handle multi letter words like apple
            HangmanGame hg = new HangmanGame(p2);  //apple
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            // POLYMORPHISM!!!
            Player p1 = new ABCplayer();
            Player p2 = new RandomPlayer();
            Player p3 = new SmartyPants();
            Player p4 = new HumanPlayer();

            List <Player> x = new List <Player>();

            x.Add(p1);
            x.Add(p2);
            x.Add(p3);
            //x.Add(p4);

            int        wins          = 0;
            double     sumABC        = 0;
            double     sumRandom     = 0;
            double     sumSmarty     = 0;
            double     averageABC    = 0;
            double     averageRandom = 0;
            double     averageSmarty = 0;
            double     sumHuman      = 0;
            double     averageHuman  = 0;
            List <int> tries         = new List <int>();

            // BRUTEFORCE PLAYER
            wins = 1;
            do
            {
                p1.Reset();
                HangmanGame hg = new HangmanGame(p1);
                tries.Add(hg.tries);
                sumABC += hg.tries;
                wins++;
            } while (wins <= 1000);
            averageABC = sumABC / wins;

            // RANDOM GUESS PLAYER
            wins = 1;
            do
            {
                p2.Reset();
                HangmanGame hg = new HangmanGame(p2);
                sumRandom += hg.tries;
                wins++;
            } while (wins <= 1000);
            averageRandom = sumRandom / wins;

            // SMART PLAYER
            wins = 1;
            do
            {
                p3.Reset();
                HangmanGame hg = new HangmanGame(p3);
                sumSmarty += hg.tries;
                wins++;
            } while (wins <= 1000);
            averageSmarty = sumSmarty / wins;

            //// HUMAN PLAYER
            //wins = 1;
            //do
            //{
            //    p4.Reset();
            //    HangmanGame hg = new HangmanGame(p4);
            //    sumHuman += hg.tries;
            //    wins++;
            //} while (wins <= 10);
            //averageHuman = sumHuman / 10;

            Console.WriteLine("ABC tries: " + averageABC);
            Console.WriteLine("Random tries: " + averageRandom);
            Console.WriteLine("Smarty tries: " + averageSmarty);
            Console.WriteLine("Human tries: " + averageHuman);

            if (averageSmarty < averageABC && averageSmarty < averageRandom && averageSmarty < averageHuman)
            {
                Console.WriteLine($"SmartyPants is the smartest person around!");
            }
            else if (averageABC < averageRandom && averageABC < averageSmarty && averageABC < averageHuman)
            {
                Console.WriteLine($"BruteForce Wins!");
            }
            else if (averageRandom < averageSmarty && averageRandom < averageABC && averageRandom < averageHuman)
            {
                Console.WriteLine("Random Wins!");
            }
            else
            {
                Console.WriteLine("YOU ARE THE SMARTEST AROUND!!");
            }

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            //List<Player> players = new List<Player>();
            //Player p = new EmptyClass();

            //for (int i = 0; i < 10; i++)
            //{

            //    HangmanGame hg = new HangmanGame(new EmptyClass());
            //}

            //players.Add(new BruteForcePlayer());
            //players.Add(new HumanPlayer());
            //players.Add(new SmartyPlayer());

            // foreach loop to itterate through the four players
            // each player will play 10 games, adding their tries together as they go
            // create List<int> to hold the average of all 10 of their games
            // display results in pretty format

            List <int> playerAveragedResults = new List <int>();

            int accumulatedTotal = 0;

            for (int i = 0; i < 10; i++)
            {
                Player      p      = new ABCplayer();
                HangmanGame hg     = new HangmanGame(p);
                int         result = hg.ReturnResult();
                accumulatedTotal += result;
            }

            playerAveragedResults.Add(accumulatedTotal / 10);

            accumulatedTotal = 0;



            for (int i = 0; i < 10; i++)
            {
                Player      p      = new BruteForcePlayer();
                HangmanGame hg     = new HangmanGame(p);
                int         result = hg.ReturnResult();
                accumulatedTotal += result;
            }

            playerAveragedResults.Add(accumulatedTotal / 10);

            accumulatedTotal = 0;


            // play human player twice since who has time for ten hole games?
            for (int i = 0; i < 2; i++)
            {
                Player      p      = new HumanPlayer();
                HangmanGame hg     = new HangmanGame(p);
                int         result = hg.ReturnResult();
                accumulatedTotal += result;
            }

            playerAveragedResults.Add(accumulatedTotal / 2);

            accumulatedTotal = 0;



            for (int i = 0; i < 10; i++)
            {
                Player      p      = new SmartyPlayer();
                HangmanGame hg     = new HangmanGame(p);
                int         result = hg.ReturnResult();
                accumulatedTotal += result;
            }

            playerAveragedResults.Add(accumulatedTotal / 10);



            List <string> playerNames = new List <string>()
            {
                "ABC Player", "Brute Force Player", "Human Player", "Smarty Player"
            };

            Console.WriteLine();
            Console.WriteLine("Average number of attempts per game by player type:");
            for (int i = 0; i < 4; i++)
            {
                Console.WriteLine($"{playerNames[i], 20} : {playerAveragedResults[i]}");
            }
        }