static void Main(string[] args) { //////******UNCOMMENT OUT THE PLAYER YOU WOULD LIKE TO PLAY******////// //Player p1 = new ABCplayer(); //HangmanGame hg1 = new HangmanGame(p1); //Player p2 = new HumanPlayer(); //HangmanGame hg2 = new HangmanGame(p2); //Player p3 = new BruteForcePlayer(); //HangmanGame hg3 = new HangmanGame(p3); Player p4 = new SmartyPlayer(); HangmanGame hg4 = new HangmanGame(p4); //Player p5 = new RandomPlayer(); //HangmanGame hg5 = new HangmanGame(p5); }
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]}"); } }