private Frame[] CreateFrames(IFrameValueGetter fvGetter) { Frame[] frames = new Frame[CardCount]; List <CardColor> colors = new List <CardColor>(); colors.AddRange(Enumerable.Repeat(CardColor.Blue, RemainingBlueCards)); colors.AddRange(Enumerable.Repeat(CardColor.Red, RemainingRedCards)); colors.AddRange(Enumerable.Repeat(CardColor.Neutral, NeutralCards)); colors.AddRange(Enumerable.Repeat(CardColor.Black, DeathCards)); Random rnd = new Random((int)DateTime.Now.Ticks); for (int i = CardCount; i > 0; i--) { int ind = (rnd.Next() % i); CardColor color = colors[ind]; colors.RemoveAt(ind); frames[i - 1] = new Frame(color, fvGetter.GetNext()); } return(frames); }
public Game(IFrameValueGetter fvGetter) { FrameValueGetter = fvGetter; StartNewGame(); }