protected override Card PlayCard(CardsPlayedCollection cardsPlayed) { if (!cardsPlayed.Any() && IsDeclarer) { } if (cardsPlayed.Any() && CanFollowSuit(cardsPlayed.First().Card)) { var card = Hand.First(c => c.Suit == cardsPlayed.First().Card.Suit); return card; } return Hand.First(); }
public Player DetermineWinner(CardsPlayedCollection cardsPlayed) { var winner = cardsPlayed.First(); foreach (var cardPlayed in cardsPlayed) { if (cardPlayed.Card.Suit == winner.Card.Suit && cardPlayed.Card.Rank > winner.Card.Rank) { winner = cardPlayed; continue; } if (cardPlayed.Card.Suit == Contract.Suit && winner.Card.Suit != Contract.Suit) { winner = cardPlayed; continue; } } return cardsPlayed.Single(cp => cp == winner).Player; }