public List <Meld> GetBestMeldSet(Hand hand) { List <Card> cards = hand.ViewHand(); List <List <Meld> > allPossibleMeldSets = GetAllPossibleMeldSets(cards); List <Meld> bestMeldSet = null; int lowestDeadWoodPenalty = int.MaxValue; foreach (List <Meld> meldSet in allPossibleMeldSets) { List <Card> deadWood = GetDeadWood(meldSet, cards); int nextDeadWoodPenalty = _deadWoodScorer.GetDeadWoodPenalty(deadWood); if (nextDeadWoodPenalty < lowestDeadWoodPenalty) { lowestDeadWoodPenalty = nextDeadWoodPenalty; bestMeldSet = meldSet; } } return(bestMeldSet); }
private bool CanKnock(Hand hand) { return(_deadWoodScorer.GetDeadWoodPenalty(hand.ViewHand()) <= Game.MinimumDeadWoodForKnock); }