/// <summary>The main.</summary> /// <param name="args">The args.</param> public static void Main(string[] args) { List<string> games = Resources.poker.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList(); var scorer = new PokerScorer(); var player1Wins = new List<string>(); var player2Wins = new List<string>(); DateTime start = DateTime.Now; foreach (var game in games) { bool player1Won = scorer.ScoreGame(game); if (player1Won) { player1Wins.Add(game); } else { player2Wins.Add(game); } } var elapsed = DateTime.Now - start; Console.WriteLine("Player 1 won: " + player1Wins.Count + " games."); Console.WriteLine("Player 2 won: " + player2Wins.Count + " games."); Console.WriteLine("Time taken: " + elapsed.TotalMilliseconds + "ms"); Console.ReadLine(); }
/// <summary>The main.</summary> /// <param name="args">The args.</param> public static void Main(string[] args) { List <string> games = Resources.poker.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList(); var stopwatch = new Stopwatch(); stopwatch.Start(); var scorer = new PokerScorer(); var player1Wins = scorer.ScoreGames(games); stopwatch.Stop(); Console.WriteLine(string.Format("Player 1 won {0} games. Calculation took {1}s", player1Wins, stopwatch.Elapsed.TotalSeconds)); Console.ReadLine(); }
/// <summary>The main.</summary> /// <param name="args">The args.</param> public static void Main(string[] args) { var games = Resources.poker.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList(); var stopwatch = new Stopwatch(); stopwatch.Start(); // Score the games here and find out how many player 1 won var scorer = new PokerScorer(); var result = 0; stopwatch.Stop(); Console.WriteLine(string.Format("Player 1 won {0} games. Calculation took {1}s", result, stopwatch.Elapsed.TotalSeconds)); Console.ReadLine(); }