Esempio n. 1
0
        public void CheckIfBurnBlocksSuit(Burn burn)
        {
            var suit            = burn.Card.GetSuit();
            var number          = burn.Card.GetNumber();
            var currentProgress = Progress[suit];

            if (IsReadyForBurn(burn.Card))
            {
                return;
            }

            var unplayedCards = Deck.GetRemainingCards();

            unplayedCards = Players.Aggregate(unplayedCards, (current, player) => current.Concat(player.GetHand()));
            if (unplayedCards.Any(card => card.GetSuit() == suit && card.GetNumber() == number))
            {
                return;
            }

            blockedSuitCount++;
            PushUndoable(delegate()
            {
                blockedSuitCount--;
            });
        }
Esempio n. 2
0
 private void CheckForBadBurn(Burn burn)
 {
     if (IsReadyForGain(burn.Card))
     {
         badBurnCount++;
         PushUndoable(delegate() { badBurnCount--; });
     }
 }
Esempio n. 3
0
        public void HandleBurn(Burn burn)
        {
            HintTokens++;
            PushUndoable(delegate()
            {
                HintTokens--;
            });

            CheckForBadBurn(burn);
            CheckIfBurnBlocksSuit(burn);
        }
Esempio n. 4
0
        public Move Yolo()
        {
            var       canBurn             = game.CanBurn();
            var       knownRemainingCards = KnownRemainingCards();
            const int goodGainValue       = 30;
            var       badGainValue        = game.GetNextDeathTokenValue();
            var       goodBurnValue       = canBurn ? game.GetNextHintTokenValue() : 0;
            const int badBurnValue        = -10;

            var  bestUtility = double.MinValue;
            Move bestMove    = null;

            foreach (var card in cards)
            {
                var probabilities       = card.CalculateProbabilityOfSafePlays(knownRemainingCards, game.Progress);
                var safeGainProbability = probabilities.Item1;
                var safeBurnProbability = probabilities.Item2;

                var gainUtility = (goodGainValue * safeGainProbability) + (badGainValue * (1 - safeGainProbability));
                var burnUtility = canBurn ? (goodBurnValue * safeBurnProbability) + (badBurnValue * (1 - safeGainProbability)) : int.MinValue;

                if (gainUtility > bestUtility)
                {
                    bestMove    = new Gain(card);
                    bestUtility = gainUtility;
                }

                if (burnUtility > bestUtility)
                {
                    bestMove    = new Burn(card);
                    bestUtility = burnUtility;
                }
            }

            return(bestMove);
        }
Esempio n. 5
0
        public Move Yolo()
        {
            var canBurn = game.CanBurn();
             var knownRemainingCards = KnownRemainingCards();
             const int goodGainValue = 30;
             var badGainValue = game.GetNextDeathTokenValue();
             var goodBurnValue = canBurn ? game.GetNextHintTokenValue() : 0;
             const int badBurnValue = -10;

             var bestUtility = double.MinValue;
             Move bestMove = null;

             foreach (var card in cards)
             {
            var probabilities = card.CalculateProbabilityOfSafePlays(knownRemainingCards, game.Progress);
            var safeGainProbability = probabilities.Item1;
            var safeBurnProbability = probabilities.Item2;

            var gainUtility = (goodGainValue * safeGainProbability) + (badGainValue * (1 - safeGainProbability));
            var burnUtility = canBurn ? (goodBurnValue * safeBurnProbability) + (badBurnValue * (1 - safeGainProbability)) : int.MinValue;

            if (gainUtility > bestUtility)
            {
               bestMove = new Gain(card);
               bestUtility = gainUtility;
            }

            if (burnUtility > bestUtility)
            {
               bestMove = new Burn(card);
               bestUtility = burnUtility;
            }
             }

             return bestMove;
        }