public Markov(GameManager manager, IEnumerable<string> arguments) { if (arguments.Count() < 3) throw new Exception("Usage: markov max_white max_black deck_type [deck_arguments]"); _maxWhite = int.Parse(arguments.ElementAt(0)); _maxBlack = int.Parse(arguments.ElementAt(1)); _deck = (IDeckType)GameManager.DeckTypes[arguments.ElementAt(2)] .GetConstructor(new Type[] { typeof(GameManager), typeof(IEnumerable<string>) }) .Invoke(new object[] { manager, arguments.Skip(3) }); while (_deck.WhiteCards > 0) _whiteGenerator.Feed(_deck.TakeWhiteCard().Parts.First().Split(' ')); while (_deck.BlackCards > 0) _blackGenerator.Feed(_deck.TakeBlackCard().Parts); }
public Randkov(GameManager manager, IEnumerable<string> arguments) { if (arguments.Count() == 0) { throw new ArgumentException("Pass a deck to randkov!"); } try { _deck = (IDeckType) GameManager.DeckTypes[arguments.First()].GetConstructor(new Type[] { typeof(GameManager), typeof(IEnumerable<string>) }).Invoke(new object[] { Manager, arguments.Skip(1) }); while (_deck.WhiteCards > 0) _generator.Feed(string.Join(" ", _deck.TakeWhiteCard().Parts).Split(' ')); } catch (Exception) { throw new ArgumentException("Failed to load deck!"); } Manager = manager; }