Example #1
0
 /// <summary>
 /// Initializes a new instance of a <see cref="GameManager"/> for playing the card game war.
 /// </summary>
 /// <param name="baseDeck">The base deck to play with</param>
 /// <param name="display">An implementation of the <see cref="IDisplay"/> contract</param>
 /// <param name="statCollector">An implementation of the <see cref="IStatCollector"/> contract</param>
 /// <param name="gameOptions">The options for the game</param>
 public GameManager(IDeck baseDeck, IDisplay display, IStatCollector statCollector, WarGameOptions gameOptions)
 {
     _display       = display;
     _statCollector = statCollector;
     _baseDeck      = baseDeck;
     _gameOptions   = gameOptions;
 }
Example #2
0
 public IEnumerable <IComparedStat> GetStatsComparedTo(IStatCollector statCollector)
 {
     return(GetStats()
            .Zip((statCollector as MinMaxStatCollector <T>).GetStats(), (first, second) =>
     {
         if (first is MinStat <T> )
         {
             return (IComparedStat)(new MinComparedStat <T>(MemberName, first as MinStat <T>, second as MinStat <T>));
         }
         else
         {
             return (IComparedStat)(new MaxComparedStat <T>(MemberName, first as MaxStat <T>, second as MaxStat <T>));
         }
     }));
 }
 public IEnumerable <IComparedStat> GetStatsComparedTo(IStatCollector statCollector) =>
 GetStats()
 .Zip((statCollector as StandardDeviationStatCollector <T>).GetStats(), (first, second) =>
      new StandardDeviationComparedStat <T>(MemberName, first as StandardDeviationStat <T>, second as StandardDeviationStat <T>));
Example #4
0
 public IEnumerable <IComparedStat> GetStatsComparedTo(IStatCollector statCollector) =>
 GetStats()
 .Zip((statCollector as CountStatCollector <T>).GetStats(), (first, second) =>
      new CountComparedStat(MemberName, first as CountStat, second as CountStat));
Example #5
0
 public IEnumerable <IComparedStat> GetStatsComparedTo(IStatCollector statCollector)
 {
     yield break;
 }
Example #6
0
 public static StatCollectorKey GetKey(this IStatCollector statCollector) => new StatCollectorKey(statCollector.MemberName, statCollector.GetType().Name);
Example #7
0
        public IEnumerable <IComparedStat> GetStatsComparedTo(IStatCollector statCollector)
        {
            var otherHashes = (statCollector as ExistenceStatCollector <T>)._hashes;

            return(new ExistenceComparedStat <T>(MemberName, _hashes, otherHashes).ToEnumerable());
        }
Example #8
0
 /// <summary>
 /// Display the game stats
 /// </summary>
 /// <param name="statCollector">An implementation of a <see cref="IStatCollector"/> for collecting the game stats</param>
 public void DisplayGameStats(IStatCollector statCollector)
 {
     Console.WriteLine(statCollector.GetStats());
 }