public Player(String name, Random random, Game game) { Name = name; this.random = random; this.game = game; cards = new Deck(new Card[] { }); game.AddProgress(name + " has just joined the game"); }
public void AskForACard(List<Player> players, int myIndex, Deck stock) { if (stock.Count > 0) { if (cards.Count == 0) cards.Add(stock.Deal()); AskForACard(players, myIndex, stock, GetRandomValue()); } }
public void AskForACard(List<Player> players, int myIndex, Deck stock, Values value) { game.AddProgress(Name + " asks if anyone has a " + value.ToString()); int numberOfFoundCards = 0; for(int i=0; i<players.Count; ++i) { if(i != myIndex) { Deck foundCards = players[i].DoYouHaveAny(value); numberOfFoundCards += foundCards.Count; TakeCards(foundCards); } } if (numberOfFoundCards == 0 && stock.Count > 0) { TakeCard(stock.Deal()); game.AddProgress(Name + " had to draw from the stock."); } }
private void ResetGame() { GameInProgress = false; OnPropertyChanged("GameInProgress"); OnPropertyChanged("GameNotStarted"); books = new Dictionary<Values, Player>(); stock = new Deck(); Hand.Clear(); }
public void TakeCards(Deck deck) { cards.Add(deck); }
public void Add(Deck deck) { foreach(Card card in deck.Cards) Cards.Add(card); }
public Deck PullOutValues(Values value) { Deck deckToReturn = new Deck(new Card[] { }); for(int i = Cards.Count-1; i>= 0; --i) { if (Cards[i].Value == value) deckToReturn.Add(Deal(i)); } return deckToReturn; }