コード例 #1
0
ファイル: MeldChecker.cs プロジェクト: visualsquid/gin-rummy
        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);
        }
コード例 #2
0
ファイル: GameMaster.cs プロジェクト: visualsquid/gin-rummy
 private bool CanKnock(Hand hand)
 {
     return(_deadWoodScorer.GetDeadWoodPenalty(hand.ViewHand()) <= Game.MinimumDeadWoodForKnock);
 }