/// <summary> /// Constructor. /// </summary> /// <param name="number">Field number.</param> public Field(int number, GameRandom random) { this.number = number; this.color = Color.GetRandom(random); cardList[0] = new CardDeck(MAX_DISCARD, Constants.DECK_NORTH_FIELD + number); cardList[1] = new CardDeck(MAX_DISCARD, Constants.DECK_SOUTH_FIELD + number); }
/// <summary> /// Constructor. /// </summary> /// <param name="playerA">Player1 name</param> /// <param name="playerB">Player2 name</param> public CardGame(string playerA, string playerB, GameRandom random, bool rev) { this.players[0] = new Player(playerA, 0); this.players[1] = new Player(playerB, 1); for (int i = 0; i < FIELD_NUM; i++) { this.fields[i] = new Field(i, random); } this.talon = new Talon(random); this.random = random; this.rev = rev; }
public Talon(GameRandom random) { List <Card> list = new List <Card>(); foreach (Color color in Color.List) { for (int i = 1; i <= 9; i++) { list.Add(new Card(i, color)); } } this.deck = new CardDeck(list, Constants.DECK_TALON); this.random = random; deck.Shuffle(random); }
/// <summary> /// Shuffle the card. /// </summary> public void Shuffle(GameRandom random) { this.list = this.list.OrderBy(i => random.Next()).ToList(); }
/// <summary> /// Constructor. /// </summary> /// <param name="n">Round number.</param> /// <param name="name1">Player1 name.</param> /// <param name="name2">Player2 name.</param> public GameRound(int n, string name1, string name2, GameRandom random, bool rev) { this.game = new CardGame(name1, name2, random, rev); }
/// <summary> /// Get random color. /// </summary> /// <returns>Color instance.</returns> public static Color GetRandom(GameRandom random) { return(Color.List[random.Next() % Color.List.Length]); }