private PlayerPosition FindWinner(Trick trick, Trump trump) { var highestTrump = trick.Deck.Cards.Where(c => c.Suit.Order == trump.Order).OrderByDescending(c => c.Rank.Score); var highestInTrickDealerSuit = trick.Deck.Cards.Where(c => c.Suit.Order == trick.TrickDealerSuit.Order).OrderByDescending(c => c.Rank.Score); return(highestTrump.Any() ? highestTrump.First().PlayerPosition : highestInTrickDealerSuit.First().PlayerPosition); }
public Contract(string contract, PlayerPosition declarer) { Value = int.Parse(contract[0].ToString()); PlayerPosition = declarer; var suit = Suit.Suits.FirstOrDefault(x => x.ShortName == new string(contract[1], 1)); if (suit != null) { Trump = new Trump(suit); } else { Trump = Trump.NoTrump; } }